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;
// 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;

View File

@ -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

View File

@ -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;
}
mTSParser->signalDiscontinuity(type, extra);
type = mask;
}
mTSParser->signalDiscontinuity(
(ATSParser::DiscontinuityType)type, extra);
} else if (n < 0) {
CHECK_EQ(n, -EWOULDBLOCK);
break;