summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-08-25 13:40:16 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-08-25 13:40:16 -0700
commit24245683b9285b0b53c8900f088cf146000501c4 (patch)
tree43b77e68322df454e3b18a7e7bd43a91937eb0e7 /media
parent9a82f8acd4138fe920e91bd73e0041d52b2db237 (diff)
parent9a442c1b9a051edc6d4ceb0daad2d0a8433e7b0b (diff)
downloadframeworks_av-24245683b9285b0b53c8900f088cf146000501c4.zip
frameworks_av-24245683b9285b0b53c8900f088cf146000501c4.tar.gz
frameworks_av-24245683b9285b0b53c8900f088cf146000501c4.tar.bz2
Merge "When encountering a discontinuity, flush(clear) all content enqueued up to that"
Diffstat (limited to 'media')
-rw-r--r--media/libstagefright/mpeg2ts/AnotherPacketSource.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp b/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp
index 2e66a2c..ce07e32 100644
--- a/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp
+++ b/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp
@@ -136,24 +136,28 @@ void AnotherPacketSource::queueAccessUnit(const sp<ABuffer> &buffer) {
void AnotherPacketSource::queueDiscontinuity(
ATSParser::DiscontinuityType type,
const sp<AMessage> &extra) {
- sp<ABuffer> buffer = new ABuffer(0);
- buffer->meta()->setInt32("discontinuity", static_cast<int32_t>(type));
- buffer->meta()->setMessage("extra", extra);
-
Mutex::Autolock autoLock(mLock);
-#if 0
- if (type == ATSParser::DISCONTINUITY_SEEK
- || type == ATSParser::DISCONTINUITY_FORMATCHANGE) {
- // XXX Fix this: This will also clear any pending discontinuities,
- // If there's a pending DISCONTINUITY_FORMATCHANGE and the new
- // discontinuity is "just" a DISCONTINUITY_SEEK, this will effectively
- // downgrade the type of discontinuity received by the client.
+ // 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;
+ }
- mBuffers.clear();
- mEOSResult = OK;
+ ++it;
}
-#endif
+
+ mEOSResult = OK;
+
+ sp<ABuffer> buffer = new ABuffer(0);
+ buffer->meta()->setInt32("discontinuity", static_cast<int32_t>(type));
+ buffer->meta()->setMessage("extra", extra);
mBuffers.push_back(buffer);
mCondition.signal();