Skip to content

Commit 351143f

Browse files
theandi666Android (Google) Code Review
authored andcommitted
Merge "Updated (internal) API for IStreamSource to signal discontinuities" into ics-mr1
2 parents 405a4e3 + a10613f commit 351143f

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

include/media/IStreamSource.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,20 @@ struct IStreamListener : public IInterface {
5252
static const char *const kKeyResumeAtPTS;
5353

5454
// When signalling a discontinuity you can optionally
55-
// signal that this is a "hard" discontinuity, i.e. the format
56-
// or configuration of subsequent stream data differs from that
57-
// currently active. To do so, include a non-zero int32_t value
58-
// under the key "kKeyFormatChange" when issuing the DISCONTINUITY
55+
// specify the type(s) of discontinuity, i.e. if the
56+
// audio format has changed, the video format has changed,
57+
// time has jumped or any combination thereof.
58+
// To do so, include a non-zero int32_t value
59+
// under the key "kKeyDiscontinuityMask" when issuing the DISCONTINUITY
5960
// command.
60-
// The new logical stream must start with proper codec initialization
61+
// If there is a change in audio/video format, The new logical stream
62+
// must start with proper codec initialization
6163
// information for playback to continue, i.e. SPS and PPS in the case
6264
// of AVC video etc.
63-
static const char *const kKeyFormatChange;
65+
// If this key is not present, only a time discontinuity is assumed.
66+
// The value should be a bitmask of values from
67+
// ATSParser::DiscontinuityType.
68+
static const char *const kKeyDiscontinuityMask;
6469

6570
virtual void issueCommand(
6671
Command cmd, bool synchronous, const sp<AMessage> &msg = NULL) = 0;

media/libmedia/IStreamSource.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace android {
3030
const char *const IStreamListener::kKeyResumeAtPTS = "resume-at-PTS";
3131

3232
// static
33-
const char *const IStreamListener::kKeyFormatChange = "format-change";
33+
const char *const IStreamListener::kKeyDiscontinuityMask = "discontinuity-mask";
3434

3535
enum {
3636
// IStreamSource

media/libmediaplayerservice/nuplayer/StreamingSource.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,22 @@ status_t NuPlayer::StreamingSource::feedMoreTSData() {
6363
mFinalResult = ERROR_END_OF_STREAM;
6464
break;
6565
} else if (n == INFO_DISCONTINUITY) {
66-
ATSParser::DiscontinuityType type = ATSParser::DISCONTINUITY_SEEK;
66+
int32_t type = ATSParser::DISCONTINUITY_SEEK;
6767

68-
int32_t formatChange;
68+
int32_t mask;
6969
if (extra != NULL
7070
&& extra->findInt32(
71-
IStreamListener::kKeyFormatChange, &formatChange)
72-
&& formatChange != 0) {
73-
type = ATSParser::DISCONTINUITY_FORMATCHANGE;
71+
IStreamListener::kKeyDiscontinuityMask, &mask)) {
72+
if (mask == 0) {
73+
LOGE("Client specified an illegal discontinuity type.");
74+
return ERROR_UNSUPPORTED;
75+
}
76+
77+
type = mask;
7478
}
7579

76-
mTSParser->signalDiscontinuity(type, extra);
80+
mTSParser->signalDiscontinuity(
81+
(ATSParser::DiscontinuityType)type, extra);
7782
} else if (n < 0) {
7883
CHECK_EQ(n, -EWOULDBLOCK);
7984
break;

0 commit comments

Comments
 (0)