Bug 1368959 - Set the MediaInfo duration to zero if the HLS source is live streaming. r?jya draft
authorJames Cheng <jacheng@mozilla.com>
Mon, 05 Jun 2017 12:13:50 +0800
changeset 588811 006fd51e859180ade7ca45fe09c7c5e6b6a6691d
parent 588783 8a3aa1701537ea6b8334f432cd030d260d492fa3
child 631685 86e154e9e92a20f133fe9464980f7e0c3c8ea252
push id62162
push userbmo:jacheng@mozilla.com
push dateMon, 05 Jun 2017 04:16:48 +0000
reviewersjya
bugs1368959
milestone55.0a1
Bug 1368959 - Set the MediaInfo duration to zero if the HLS source is live streaming. r?jya Exoplayer will return the wrong duration when playing live stream based on the current playing chunk. And the duration will change dynamically which is not the right behavior, should set the duration to zero in this case. MozReview-Commit-ID: EgbcPMOsVBI
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
@@ -559,16 +559,19 @@ public class GeckoHlsPlayer implements E
 
     public ConcurrentLinkedQueue<GeckoHlsSample> getAudioSamples(int number) {
         return mARenderer != null ? mARenderer.getQueuedSamples(number) :
                                     new ConcurrentLinkedQueue<GeckoHlsSample>();
     }
 
     public long getDuration() {
         assertTrue(mPlayer != null);
+        if (isLiveStream()) {
+            return 0L;
+        }
         // Value returned by getDuration() is in milliseconds.
         long duration = mPlayer.getDuration() * 1000;
         if (DEBUG) { Log.d(LOGTAG, "getDuration : " + duration  + "(Us)"); }
         return duration;
     }
 
     public long getBufferedPosition() {
         assertTrue(mPlayer != null);