From 2bdf63236989105aa685d7a855a274388a93f3a4 Mon Sep 17 00:00:00 2001 From: rohks Date: Wed, 2 Apr 2025 04:41:23 -0700 Subject: [PATCH] Remove incorrect frame rate calculation using `tkhd` box duration Frame rate is correctly determined using the media duration from the `mdhd` box and the sample count from the `stsz` box. The fallback calculation using the edited sample count and `tkhd` box duration is incorrect, as added silence at the beginning can increase the track duration without affecting the sample count. No-op change, as we never use the fallback calculation for our sample files in the test. PiperOrigin-RevId: 743081118 (cherry picked from commit c0e518df9709cc858c0610e4694d8753bdb638b7) --- .../java/androidx/media3/extractor/mp4/Mp4Extractor.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/Mp4Extractor.java b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/Mp4Extractor.java index 3899eefdb4..8d8719e411 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/Mp4Extractor.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/Mp4Extractor.java @@ -757,12 +757,6 @@ public final class Mp4Extractor implements Extractor, SeekMap { roleFlags |= firstVideoTrackIndex == C.INDEX_UNSET ? C.ROLE_FLAG_MAIN : C.ROLE_FLAG_ALTERNATE; } - if (track.format.frameRate == Format.NO_VALUE - && trackDurationUs > 0 - && trackSampleTable.sampleCount > 0) { - float frameRate = trackSampleTable.sampleCount / (trackDurationUs / 1000000f); - formatBuilder.setFrameRate(frameRate); - } if (readingAuxiliaryTracks) { roleFlags |= C.ROLE_FLAG_AUXILIARY; formatBuilder.setAuxiliaryTrackType(auxiliaryTrackTypesForAuxiliaryTracks.get(i));