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

Commit b6f22b51 authored by Brian Lindahl's avatar Brian Lindahl Committed by Android (Google) Code Review
Browse files

Merge "Defer peek legacy configuration until after startup" into tm-qpr-dev

parents 1ccce7e1 9ffed7b4
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -3534,6 +3534,17 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
                    }
                    setState(STARTED);
                    postPendingRepliesAndDeferredMessages("kWhatStartCompleted");

                    // Now that the codec has started, configure, by default, the peek behavior to
                    // be undefined for backwards compatibility with older releases. Later, if an
                    // app explicitly enables or disables peek, the parameter will be turned off and
                    // the legacy undefined behavior is disallowed.
                    // See updateTunnelPeek called in onSetParameters for more details.
                    if (mTunneled && mTunnelPeekState == TunnelPeekState::kLegacyMode) {
                        sp<AMessage> params = new AMessage;
                        params->setInt32("android._tunnel-peek-set-legacy", 1);
                        mCodec->signalSetParameters(params);
                    }
                    break;
                }

@@ -3973,14 +3984,6 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
                mTunneled = false;
            }

            // If mTunnelPeekState is still in kLegacyMode at this point,
            // configure the codec in legacy mode
            if (mTunneled && (mTunnelPeekState == TunnelPeekState::kLegacyMode)) {
                sp<AMessage> params = new AMessage;
                params->setInt32("android._tunnel-peek-set-legacy", 1);
                onSetParameters(params);
            }

            int32_t background = 0;
            if (format->findInt32("android._background-mode", &background) && background) {
                androidSetThreadPriority(gettid(), ANDROID_PRIORITY_BACKGROUND);