Bug 1419249 - Fix the wrong logic calculating starttime of the first sample. r=kikuo
authorJames Cheng <jacheng@mozilla.com>
Wed, 22 Nov 2017 17:47:03 +0800
changeset 393244 4e75818a3342ace6e21331bcc1a8096869a6ebe2
parent 393243 c90c64a0adaf0861e49bbcd6239f64c20e4bfa81
child 393245 4b371af47c94ed1c272ce16c0204c1b07f24f093
push id32955
push usercsabou@mozilla.com
push dateThu, 23 Nov 2017 09:42:21 +0000
treeherdermozilla-central@4f8b98354732 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskikuo
bugs1419249
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1419249 - Fix the wrong logic calculating starttime of the first sample. r=kikuo MozReview-Commit-ID: 3je7idVeYoZ
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsPlayer.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsPlayer.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsPlayer.java
@@ -709,27 +709,27 @@ public class GeckoHlsPlayer implements B
         //        2) positionUs is samples PTS from MFR, we need to re-adjust it
         //           for ExoPlayer by subtracting sample start time.
         //        3) Time unit for ExoPlayer.seek() is milliseconds.
         try {
             // TODO : Gather Timeline Period / Window information to develop
             //        complete timeline, and seekTime should be inside the duration.
             Long startTime = Long.MAX_VALUE;
             for (GeckoHlsRendererBase r : mRenderers) {
-                if (r == mVRenderer && mRendererController.isVideoRendererEnabled() ||
-                    r == mARenderer && mRendererController.isAudioRendererEnabled()) {
+                if (r == mVRenderer && mRendererController.isVideoRendererEnabled() && mTracksInfo.hasVideo() ||
+                    r == mARenderer && mRendererController.isAudioRendererEnabled() && mTracksInfo.hasAudio()) {
                 // Find the min value of the start time
                     startTime = Math.min(startTime, r.getFirstSamplePTS());
                 }
             }
             if (DEBUG) {
                 Log.d(LOGTAG, "seeking  : " + positionUs / 1000 +
                               " (ms); startTime : " + startTime / 1000 + " (ms)");
             }
-            assertTrue(startTime != Long.MAX_VALUE);
+            assertTrue(startTime != Long.MAX_VALUE && startTime != Long.MIN_VALUE);
             mPlayer.seekTo(positionUs / 1000 - startTime / 1000);
         } catch (Exception e) {
             if (mDemuxerCallbacks != null) {
                 mDemuxerCallbacks.onError(DemuxerError.UNKNOWN.code());
             }
             return false;
         }
         return true;