diff options
author | Andreas Huber <andih@google.com> | 2011-07-22 09:36:24 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2011-08-01 10:06:25 -0700 |
commit | 20f725ebcef13ded1b4b85c61c8a4b37cd030656 (patch) | |
tree | e2d4ace2a91a1116e92fff5d884668be69469a2b /media/libstagefright/httplive/LiveSession.cpp | |
parent | b7c5f8fa2ee707f010b60ff7bea07c2bf1e17e2d (diff) | |
download | frameworks_av-20f725ebcef13ded1b4b85c61c8a4b37cd030656.zip frameworks_av-20f725ebcef13ded1b4b85c61c8a4b37cd030656.tar.gz frameworks_av-20f725ebcef13ded1b4b85c61c8a4b37cd030656.tar.bz2 |
Start playing live streaming HLS content from the first segment.
Also properly signal a "hard" discontinuity, i.e. a possible format change
when a discontinuity is signalled explicitly as part of the playlist.
Change-Id: Ic347d3d11d39b0411c3726a7c723bcf13092b8bc
related-to-bug: 5103155, 5103013
Diffstat (limited to 'media/libstagefright/httplive/LiveSession.cpp')
-rw-r--r-- | media/libstagefright/httplive/LiveSession.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp index 90d64ba..2578d2d 100644 --- a/media/libstagefright/httplive/LiveSession.cpp +++ b/media/libstagefright/httplive/LiveSession.cpp @@ -544,6 +544,7 @@ rinse_repeat: firstSeqNumberInPlaylist = 0; } + bool seekDiscontinuity = false; bool explicitDiscontinuity = false; bool bandwidthChanged = false; @@ -580,10 +581,10 @@ rinse_repeat: // reseting the data source will have had the // side effect of discarding any previously queued // bandwidth change discontinuity. - // Therefore we'll need to treat these explicit + // Therefore we'll need to treat these seek // discontinuities as involving a bandwidth change // even if they aren't directly. - explicitDiscontinuity = true; + seekDiscontinuity = true; bandwidthChanged = true; } } @@ -597,11 +598,7 @@ rinse_repeat: } if (mSeqNumber < 0) { - if (mPlaylist->isComplete()) { - mSeqNumber = firstSeqNumberInPlaylist; - } else { - mSeqNumber = firstSeqNumberInPlaylist + mPlaylist->size() / 2; - } + mSeqNumber = firstSeqNumberInPlaylist; } int32_t lastSeqNumberInPlaylist = @@ -704,15 +701,17 @@ rinse_repeat: bandwidthChanged = false; } - if (explicitDiscontinuity || bandwidthChanged) { + if (seekDiscontinuity || explicitDiscontinuity || bandwidthChanged) { // Signal discontinuity. - LOGI("queueing discontinuity (explicit=%d, bandwidthChanged=%d)", - explicitDiscontinuity, bandwidthChanged); + LOGI("queueing discontinuity (seek=%d, explicit=%d, bandwidthChanged=%d)", + seekDiscontinuity, explicitDiscontinuity, bandwidthChanged); sp<ABuffer> tmp = new ABuffer(188); memset(tmp->data(), 0, tmp->size()); - tmp->data()[1] = bandwidthChanged; + + // signal a 'hard' discontinuity for explicit or bandwidthChanged. + tmp->data()[1] = (explicitDiscontinuity || bandwidthChanged) ? 1 : 0; mDataSource->queueBuffer(tmp); } |