diff options
author | Chong Zhang <chz@google.com> | 2014-06-26 13:03:47 -0700 |
---|---|---|
committer | Chong Zhang <chz@google.com> | 2014-06-26 16:30:00 -0700 |
commit | 632740c58119a132ce19f6d498e39c5c3773971a (patch) | |
tree | 834b867457d9f538f452e58c2372d791668befa5 /media/libstagefright/mpeg2ts | |
parent | e8f2c6cfe9afc5b303ab6b0fb51e18ddce512b54 (diff) | |
download | frameworks_av-632740c58119a132ce19f6d498e39c5c3773971a.zip frameworks_av-632740c58119a132ce19f6d498e39c5c3773971a.tar.gz frameworks_av-632740c58119a132ce19f6d498e39c5c3773971a.tar.bz2 |
HLS: do not discard packets when queuing explicit discontinuity
in case of explicit discontinuity (#EXT-X-DISCONTINUITY tag in the
playlist), do not discard packets that's already queued.
(when seeking, the old fetcher will be discarded so this won't affect
seeking case.)
Bug: 15020526
Change-Id: I5d3fc489df35e3bc44acb1ee7851571cb99cb56b
Diffstat (limited to 'media/libstagefright/mpeg2ts')
-rw-r--r-- | media/libstagefright/mpeg2ts/ATSParser.cpp | 2 | ||||
-rw-r--r-- | media/libstagefright/mpeg2ts/AnotherPacketSource.cpp | 27 | ||||
-rw-r--r-- | media/libstagefright/mpeg2ts/AnotherPacketSource.h | 4 |
3 files changed, 19 insertions, 14 deletions
diff --git a/media/libstagefright/mpeg2ts/ATSParser.cpp b/media/libstagefright/mpeg2ts/ATSParser.cpp index 338e899..3d241e0 100644 --- a/media/libstagefright/mpeg2ts/ATSParser.cpp +++ b/media/libstagefright/mpeg2ts/ATSParser.cpp @@ -669,7 +669,7 @@ void ATSParser::Stream::signalDiscontinuity( } if (mSource != NULL) { - mSource->queueDiscontinuity(type, extra); + mSource->queueDiscontinuity(type, extra, true); } } diff --git a/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp b/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp index 021b640..871824a 100644 --- a/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp +++ b/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp @@ -217,22 +217,25 @@ void AnotherPacketSource::clear() { void AnotherPacketSource::queueDiscontinuity( ATSParser::DiscontinuityType type, - const sp<AMessage> &extra) { + const sp<AMessage> &extra, + bool discard) { Mutex::Autolock autoLock(mLock); - // Leave only discontinuities in the queue. - List<sp<ABuffer> >::iterator it = mBuffers.begin(); - while (it != mBuffers.end()) { - sp<ABuffer> oldBuffer = *it; + if (discard) { + // Leave only discontinuities in the queue. + List<sp<ABuffer> >::iterator it = mBuffers.begin(); + while (it != mBuffers.end()) { + sp<ABuffer> oldBuffer = *it; + + int32_t oldDiscontinuityType; + if (!oldBuffer->meta()->findInt32( + "discontinuity", &oldDiscontinuityType)) { + it = mBuffers.erase(it); + continue; + } - int32_t oldDiscontinuityType; - if (!oldBuffer->meta()->findInt32( - "discontinuity", &oldDiscontinuityType)) { - it = mBuffers.erase(it); - continue; + ++it; } - - ++it; } mEOSResult = OK; diff --git a/media/libstagefright/mpeg2ts/AnotherPacketSource.h b/media/libstagefright/mpeg2ts/AnotherPacketSource.h index 9b193a2..06c49bd 100644 --- a/media/libstagefright/mpeg2ts/AnotherPacketSource.h +++ b/media/libstagefright/mpeg2ts/AnotherPacketSource.h @@ -54,7 +54,9 @@ struct AnotherPacketSource : public MediaSource { void queueAccessUnit(const sp<ABuffer> &buffer); void queueDiscontinuity( - ATSParser::DiscontinuityType type, const sp<AMessage> &extra); + ATSParser::DiscontinuityType type, + const sp<AMessage> &extra, + bool discard); void signalEOS(status_t result); |