Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 351143fb authored by Andreas Huber's avatar Andreas Huber Committed by Android (Google) Code Review
Browse files

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

parents 405a4e34 a10613fe
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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
+11 −6
Original line number Diff line number Diff line
@@ -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;