diff options
author | Andreas Huber <andih@google.com> | 2011-11-29 14:08:45 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-11-29 14:08:45 -0800 |
commit | 544ee287d01d98efbe9eeeaeb7016c8dd55e3748 (patch) | |
tree | 8a757cc879f9a06bf4b13a94d3831a48787871dd | |
parent | 6e3d311b6631b12aac2879d1b08c3534aece78b1 (diff) | |
parent | bfcc8d8ab7c56bc013bd221a29e1ecf3a6390813 (diff) | |
download | frameworks_av-544ee287d01d98efbe9eeeaeb7016c8dd55e3748.zip frameworks_av-544ee287d01d98efbe9eeeaeb7016c8dd55e3748.tar.gz frameworks_av-544ee287d01d98efbe9eeeaeb7016c8dd55e3748.tar.bz2 |
Merge "Updated (internal) API for IStreamSource to signal discontinuities" into ics-mr1
-rw-r--r-- | include/media/IStreamSource.h | 17 | ||||
-rw-r--r-- | media/libmedia/IStreamSource.cpp | 2 | ||||
-rw-r--r-- | media/libmediaplayerservice/nuplayer/StreamingSource.cpp | 17 |
3 files changed, 23 insertions, 13 deletions
diff --git a/include/media/IStreamSource.h b/include/media/IStreamSource.h index cc63356..19646b0 100644 --- a/include/media/IStreamSource.h +++ b/include/media/IStreamSource.h @@ -52,15 +52,20 @@ struct IStreamListener : public IInterface { static const char *const kKeyResumeAtPTS; // When signalling a discontinuity you can optionally - // signal that this is a "hard" discontinuity, i.e. the format - // or configuration of subsequent stream data differs from that - // currently active. To do so, include a non-zero int32_t value - // under the key "kKeyFormatChange" when issuing the DISCONTINUITY + // specify the type(s) of discontinuity, i.e. if the + // audio format has changed, the video format has changed, + // time has jumped or any combination thereof. + // To do so, include a non-zero int32_t value + // under the key "kKeyDiscontinuityMask" when issuing the DISCONTINUITY // command. - // The new logical stream must start with proper codec initialization + // If there is a change in audio/video format, The new logical stream + // must start with proper codec initialization // information for playback to continue, i.e. SPS and PPS in the case // of AVC video etc. - static const char *const kKeyFormatChange; + // If this key is not present, only a time discontinuity is assumed. + // The value should be a bitmask of values from + // ATSParser::DiscontinuityType. + static const char *const kKeyDiscontinuityMask; virtual void issueCommand( Command cmd, bool synchronous, const sp<AMessage> &msg = NULL) = 0; diff --git a/media/libmedia/IStreamSource.cpp b/media/libmedia/IStreamSource.cpp index b311f35..078be94 100644 --- a/media/libmedia/IStreamSource.cpp +++ b/media/libmedia/IStreamSource.cpp @@ -30,7 +30,7 @@ namespace android { const char *const IStreamListener::kKeyResumeAtPTS = "resume-at-PTS"; // static -const char *const IStreamListener::kKeyFormatChange = "format-change"; +const char *const IStreamListener::kKeyDiscontinuityMask = "discontinuity-mask"; enum { // IStreamSource diff --git a/media/libmediaplayerservice/nuplayer/StreamingSource.cpp b/media/libmediaplayerservice/nuplayer/StreamingSource.cpp index f795654..2e63b3b 100644 --- a/media/libmediaplayerservice/nuplayer/StreamingSource.cpp +++ b/media/libmediaplayerservice/nuplayer/StreamingSource.cpp @@ -63,17 +63,22 @@ status_t NuPlayer::StreamingSource::feedMoreTSData() { mFinalResult = ERROR_END_OF_STREAM; break; } else if (n == INFO_DISCONTINUITY) { - ATSParser::DiscontinuityType type = ATSParser::DISCONTINUITY_SEEK; + int32_t type = ATSParser::DISCONTINUITY_SEEK; - int32_t formatChange; + int32_t mask; if (extra != NULL && extra->findInt32( - IStreamListener::kKeyFormatChange, &formatChange) - && formatChange != 0) { - type = ATSParser::DISCONTINUITY_FORMATCHANGE; + IStreamListener::kKeyDiscontinuityMask, &mask)) { + if (mask == 0) { + LOGE("Client specified an illegal discontinuity type."); + return ERROR_UNSUPPORTED; + } + + type = mask; } - mTSParser->signalDiscontinuity(type, extra); + mTSParser->signalDiscontinuity( + (ATSParser::DiscontinuityType)type, extra); } else if (n < 0) { CHECK_EQ(n, -EWOULDBLOCK); break; |