diff options
author | Andreas Huber <andih@google.com> | 2010-12-22 10:03:04 -0800 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2010-12-22 10:03:04 -0800 |
commit | 222e689267cae5b21821e45e67968d330bd47bd3 (patch) | |
tree | bce6dc7c6a40f0b3bdea6f210a590552aaf782c2 /media/libstagefright/mpeg2ts | |
parent | f74dcfcf001849096a95496a8cd30bed25e79757 (diff) | |
download | frameworks_base-222e689267cae5b21821e45e67968d330bd47bd3.zip frameworks_base-222e689267cae5b21821e45e67968d330bd47bd3.tar.gz frameworks_base-222e689267cae5b21821e45e67968d330bd47bd3.tar.bz2 |
Distinguish discontinuities w/ a format change from those without.
Shutdown decoders as needed in anticipation of a format change, otherwise just flush.
Change-Id: Ieb04f8aa8658569b091409c4903075fd496e5abb
Diffstat (limited to 'media/libstagefright/mpeg2ts')
-rw-r--r-- | media/libstagefright/mpeg2ts/ATSParser.cpp | 4 | ||||
-rw-r--r-- | media/libstagefright/mpeg2ts/AnotherPacketSource.cpp | 8 | ||||
-rw-r--r-- | media/libstagefright/mpeg2ts/AnotherPacketSource.h | 2 |
3 files changed, 8 insertions, 6 deletions
diff --git a/media/libstagefright/mpeg2ts/ATSParser.cpp b/media/libstagefright/mpeg2ts/ATSParser.cpp index afacb2e..ee9b573 100644 --- a/media/libstagefright/mpeg2ts/ATSParser.cpp +++ b/media/libstagefright/mpeg2ts/ATSParser.cpp @@ -334,7 +334,7 @@ void ATSParser::Stream::signalDiscontinuity(DiscontinuityType type) { if (mStreamType == 0x1b && mSource != NULL) { // Don't signal discontinuities on audio streams. - mSource->queueDiscontinuity(); + mSource->queueDiscontinuity(true /* formatChange */); } break; } @@ -348,7 +348,7 @@ void ATSParser::Stream::signalDiscontinuity(DiscontinuityType type) { if (mSource != NULL) { mSource->clear(); - mSource->queueDiscontinuity(); + mSource->queueDiscontinuity(!isASeek); } break; } diff --git a/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp b/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp index 7a1d5b0..a8fe2c1 100644 --- a/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp +++ b/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp @@ -63,8 +63,6 @@ status_t AnotherPacketSource::dequeueAccessUnit(sp<ABuffer> *buffer) { int32_t discontinuity; if ((*buffer)->meta()->findInt32("discontinuity", &discontinuity) && discontinuity) { - buffer->clear(); - return INFO_DISCONTINUITY; } @@ -125,10 +123,14 @@ void AnotherPacketSource::queueAccessUnit(const sp<ABuffer> &buffer) { mCondition.signal(); } -void AnotherPacketSource::queueDiscontinuity() { +void AnotherPacketSource::queueDiscontinuity(bool formatChange) { sp<ABuffer> buffer = new ABuffer(0); buffer->meta()->setInt32("discontinuity", true); + if (formatChange) { + buffer->meta()->setInt32("format-change", true); + } + Mutex::Autolock autoLock(mLock); mBuffers.push_back(buffer); diff --git a/media/libstagefright/mpeg2ts/AnotherPacketSource.h b/media/libstagefright/mpeg2ts/AnotherPacketSource.h index 2bc7404..f25a067 100644 --- a/media/libstagefright/mpeg2ts/AnotherPacketSource.h +++ b/media/libstagefright/mpeg2ts/AnotherPacketSource.h @@ -42,7 +42,7 @@ struct AnotherPacketSource : public MediaSource { status_t nextBufferTime(int64_t *timeUs); void queueAccessUnit(const sp<ABuffer> &buffer); - void queueDiscontinuity(); + void queueDiscontinuity(bool formatChange); void signalEOS(status_t result); void clear(); |