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

Commit a10613fe authored by Andreas Huber's avatar Andreas Huber
Browse files

Updated (internal) API for IStreamSource to signal discontinuities

Change-Id: Idd4b9d8e7cec16b3e3c91c70e75144d42be30f96
related-to-bug: 5553055
parent fed7a99a
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;