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

Commit 67d464f4 authored by Andreas Huber's avatar Andreas Huber
Browse files

Enable signalling of a stream discontinuity involving a format-change

through IStreamListener.

Change-Id: Ic0409cdc4891ad26b61f2f98bdda3c7fb2e2de6a
related-to-bug: 5022434
parent 9cba6863
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -51,6 +51,17 @@ struct IStreamListener : public IInterface {
    // will be suppressed until media time reaches this timestamp.
    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
    // command.
    // 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;

    virtual void issueCommand(
            Command cmd, bool synchronous, const sp<AMessage> &msg = NULL) = 0;
};
+3 −0
Original line number Diff line number Diff line
@@ -29,6 +29,9 @@ namespace android {
// static
const char *const IStreamListener::kKeyResumeAtPTS = "resume-at-PTS";

// static
const char *const IStreamListener::kKeyFormatChange = "format-change";

enum {
    // IStreamSource
    SET_LISTENER = IBinder::FIRST_CALL_TRANSACTION,
+11 −2
Original line number Diff line number Diff line
@@ -63,8 +63,17 @@ bool NuPlayer::StreamingSource::feedMoreTSData() {
            mEOS = true;
            break;
        } else if (n == INFO_DISCONTINUITY) {
            mTSParser->signalDiscontinuity(
                    ATSParser::DISCONTINUITY_SEEK, extra);
            ATSParser::DiscontinuityType type = ATSParser::DISCONTINUITY_SEEK;

            int32_t formatChange;
            if (extra != NULL
                    && extra->findInt32(
                        IStreamListener::kKeyFormatChange, &formatChange)
                    && formatChange != 0) {
                type = ATSParser::DISCONTINUITY_FORMATCHANGE;
            }

            mTSParser->signalDiscontinuity(type, extra);
        } else if (n < 0) {
            CHECK_EQ(n, -EWOULDBLOCK);
            break;