Merge "Updated (internal) API for IStreamSource to signal discontinuities" into ics-mr1

This commit is contained in:
Andreas Huber
2011-11-29 14:08:45 -08:00
committed by Android (Google) Code Review
3 changed files with 23 additions and 13 deletions

View File

@ -52,15 +52,20 @@ struct IStreamListener : public IInterface {
static const char *const kKeyResumeAtPTS; static const char *const kKeyResumeAtPTS;
// When signalling a discontinuity you can optionally // When signalling a discontinuity you can optionally
// signal that this is a "hard" discontinuity, i.e. the format // specify the type(s) of discontinuity, i.e. if the
// or configuration of subsequent stream data differs from that // audio format has changed, the video format has changed,
// currently active. To do so, include a non-zero int32_t value // time has jumped or any combination thereof.
// under the key "kKeyFormatChange" when issuing the DISCONTINUITY // To do so, include a non-zero int32_t value
// under the key "kKeyDiscontinuityMask" when issuing the DISCONTINUITY
// command. // 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 // information for playback to continue, i.e. SPS and PPS in the case
// of AVC video etc. // 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( virtual void issueCommand(
Command cmd, bool synchronous, const sp<AMessage> &msg = NULL) = 0; Command cmd, bool synchronous, const sp<AMessage> &msg = NULL) = 0;

View File

@ -30,7 +30,7 @@ namespace android {
const char *const IStreamListener::kKeyResumeAtPTS = "resume-at-PTS"; const char *const IStreamListener::kKeyResumeAtPTS = "resume-at-PTS";
// static // static
const char *const IStreamListener::kKeyFormatChange = "format-change"; const char *const IStreamListener::kKeyDiscontinuityMask = "discontinuity-mask";
enum { enum {
// IStreamSource // IStreamSource

View File

@ -63,17 +63,22 @@ status_t NuPlayer::StreamingSource::feedMoreTSData() {
mFinalResult = ERROR_END_OF_STREAM; mFinalResult = ERROR_END_OF_STREAM;
break; break;
} else if (n == INFO_DISCONTINUITY) { } 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 if (extra != NULL
&& extra->findInt32( && extra->findInt32(
IStreamListener::kKeyFormatChange, &formatChange) IStreamListener::kKeyDiscontinuityMask, &mask)) {
&& formatChange != 0) { if (mask == 0) {
type = ATSParser::DISCONTINUITY_FORMATCHANGE; LOGE("Client specified an illegal discontinuity type.");
return ERROR_UNSUPPORTED;
} }
mTSParser->signalDiscontinuity(type, extra); type = mask;
}
mTSParser->signalDiscontinuity(
(ATSParser::DiscontinuityType)type, extra);
} else if (n < 0) { } else if (n < 0) {
CHECK_EQ(n, -EWOULDBLOCK); CHECK_EQ(n, -EWOULDBLOCK);
break; break;