summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/httplive/LiveSession.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-01-06 16:32:05 -0800
committerAndreas Huber <andih@google.com>2011-01-06 16:32:05 -0800
commitaea5aff45a1af14e249ac311f0a128a621a7d13e (patch)
tree2db633500809c43dd58e07a0245660e4fd1354a9 /media/libstagefright/httplive/LiveSession.cpp
parent9a3c0d65bfa55df779ebe285d5d26e257ca37c22 (diff)
downloadframeworks_av-aea5aff45a1af14e249ac311f0a128a621a7d13e.zip
frameworks_av-aea5aff45a1af14e249ac311f0a128a621a7d13e.tar.gz
frameworks_av-aea5aff45a1af14e249ac311f0a128a621a7d13e.tar.bz2
If the stream for the new bandwidth doesn't have the segment we're looking for...
go back to the previous bandwidth' stream. Change-Id: I3477cb6932102883509a7cbe9fb2b3bb02dac8c6
Diffstat (limited to 'media/libstagefright/httplive/LiveSession.cpp')
-rw-r--r--media/libstagefright/httplive/LiveSession.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp
index a3e7fc7..9e63c41 100644
--- a/media/libstagefright/httplive/LiveSession.cpp
+++ b/media/libstagefright/httplive/LiveSession.cpp
@@ -340,6 +340,7 @@ size_t LiveSession::getBandwidthIndex() {
void LiveSession::onDownloadNext() {
size_t bandwidthIndex = getBandwidthIndex();
+rinse_repeat:
int64_t nowUs = ALooper::GetNowUs();
if (mLastPlaylistFetchTimeUs < 0
@@ -437,6 +438,18 @@ void LiveSession::onDownloadNext() {
if (mSeqNumber < firstSeqNumberInPlaylist
|| mSeqNumber > lastSeqNumberInPlaylist) {
+ if (mSeqNumber < firstSeqNumberInPlaylist
+ && mPrevBandwidthIndex != (ssize_t)bandwidthIndex) {
+ // Go back to the previous bandwidth.
+
+ LOGI("new bandwidth does not have the sequence number "
+ "we're looking for, switching back to previous bandwidth");
+
+ mLastPlaylistFetchTimeUs = -1;
+ bandwidthIndex = mPrevBandwidthIndex;
+ goto rinse_repeat;
+ }
+
if (!mPlaylist->isComplete()
&& mSeqNumber > lastSeqNumberInPlaylist
&& mNumRetries < kMaxNumRetries) {