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
--- 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);