OSDN Git Service

PlaylistFetcher: add lower bound check when starting live streams
authorRobert Shih <robertshih@google.com>
Thu, 28 Aug 2014 22:18:53 +0000 (15:18 -0700)
committerRobert Shih <robertshih@google.com>
Thu, 28 Aug 2014 22:33:43 +0000 (15:33 -0700)
Avoid false 'missed the boat' alarms that cause us to queue a bogus
discontinuity before even starting.

Bug: 17303166
Change-Id: I5003934fc695f30db2df9a0803b8fe960d77a458

media/libstagefright/httplive/PlaylistFetcher.cpp

index 80cb2d0..4d5d79e 100644 (file)
@@ -754,6 +754,9 @@ void PlaylistFetcher::onDownloadNext() {
             if (!mPlaylist->isComplete() && !mPlaylist->isEvent()) {
                 // If this is a live session, start 3 segments from the end on connect
                 mSeqNumber = lastSeqNumberInPlaylist - 3;
+                if (mSeqNumber < firstSeqNumberInPlaylist) {
+                    mSeqNumber = firstSeqNumberInPlaylist;
+                }
             } else {
                 mSeqNumber = getSeqNumberForTime(mStartTimeUs);
                 mStartTimeUs -= getSegmentStartTimeUs(mSeqNumber);