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

Commit 9ffed7b4 authored by Brian Lindahl's avatar Brian Lindahl
Browse files

Defer peek legacy configuration until after startup

The OMX codec path will silently drop calls to set parameters until the
codec has been started. By moving the configuration of peek legacy mode
out of kWhatConfigure and into kWhatStartCompleted, this allows the
feature to function on the OMX code path and not just the Codec2 code
path.

Test: add logging for when legacy mode is sent to OMX, and use atest
testTunneledVideoPeekOnAvc with the peek enabled line commented out to
verify that legacy mode is correctly configured in the OMX code path

Bug: 220266078
Bug: 235775488
Change-Id: Ibc8df52cb1b04e787df7f3aa22169e55d0589696
parent 27d4fdd7
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);