diff options
author | Leena Winterrowd <lenhardw@codeaurora.org> | 2014-11-17 17:29:20 -0800 |
---|---|---|
committer | Lajos Molnar <lajos@google.com> | 2015-01-28 21:52:09 -0800 |
commit | 174609765fb9c8cbd6aeb61f489746c3570bfee2 (patch) | |
tree | e09281e57664ae0b642eff41379fec9bef6101c0 /media/libstagefright/httplive/LiveSession.cpp | |
parent | 5cf91c5067a9c7ed3c138d4e56fb176b28f5dc3a (diff) | |
download | frameworks_av-174609765fb9c8cbd6aeb61f489746c3570bfee2.zip frameworks_av-174609765fb9c8cbd6aeb61f489746c3570bfee2.tar.gz frameworks_av-174609765fb9c8cbd6aeb61f489746c3570bfee2.tar.bz2 |
stagefright: httplive: Fix deadlock for low duration clips
PlaylistFetcher buffers up to 3 * target-duration bytes of data,
but if a stream is slow (ie due to bad network conditions), a
buffer threshold of 10s is used to resume playback. This results
in an indefinite freeze as PlaylistFetcher has stopped buffering
before this threshold. Reduce the 10s threshold to be more in-sync
with PlaylistFetcher's buffering size.
Bug: 18821145
Change-Id: Ife846e7c5b4f9645895873d08250c4bee0164972
Diffstat (limited to 'media/libstagefright/httplive/LiveSession.cpp')
-rw-r--r-- | media/libstagefright/httplive/LiveSession.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp index 0b18666..cad4c2d 100644 --- a/media/libstagefright/httplive/LiveSession.cpp +++ b/media/libstagefright/httplive/LiveSession.cpp @@ -145,10 +145,24 @@ status_t LiveSession::dequeueAccessUnit( } } + int32_t targetDuration = 0; + sp<AMessage> meta = packetSource->getLatestEnqueuedMeta(); + if (meta != NULL) { + meta->findInt32("targetDuration", &targetDuration); + } + + int64_t targetDurationUs = targetDuration * 1000000ll; + if (targetDurationUs == 0 || + targetDurationUs > PlaylistFetcher::kMinBufferedDurationUs) { + // Fetchers limit buffering to + // min(3 * targetDuration, kMinBufferedDurationUs) + targetDurationUs = PlaylistFetcher::kMinBufferedDurationUs; + } + if (mBuffering[idx]) { if (mSwitchInProgress || packetSource->isFinished(0) - || packetSource->getEstimatedDurationUs() > 10000000ll) { + || packetSource->getEstimatedDurationUs() > targetDurationUs) { mBuffering[idx] = false; } } |