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

Commit e6f46638 authored by Brian Lindahl's avatar Brian Lindahl
Browse files

Allow the default mode for video peek to be undefined

Forcing the default mode for video peek to be defined to on has broken
use cases for Broadcom devices.

See go/video-peek-legacy-mode for more details.

Bug: 220266078
Test: atest android.media.decoder.cts.DecoderTest
Change-Id: I9d2579f71365fdef0c23f76575d21813016cb80c
parent f3e84296
Loading
Loading
Loading
Loading
+44 −10
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ enum {
namespace {

constexpr char TUNNEL_PEEK_KEY[] = "android._trigger-tunnel-peek";
constexpr char TUNNEL_PEEK_SET_LEGACY_KEY[] = "android._tunnel-peek-set-legacy";

}

@@ -2483,17 +2484,39 @@ status_t ACodec::setTunnelPeek(int32_t tunnelPeek) {
        return BAD_VALUE;
    }

    OMX_CONFIG_BOOLEANTYPE config;
    InitOMXParams(&config);
    config.bEnabled = (OMX_BOOL)(tunnelPeek != 0);
    OMX_CONFIG_BOOLEANTYPE tunnelPeekConfig;
    InitOMXParams(&tunnelPeekConfig);
    tunnelPeekConfig.bEnabled = (OMX_BOOL)(tunnelPeek != 0);
    status_t err = mOMXNode->setConfig(
            (OMX_INDEXTYPE)OMX_IndexConfigAndroidTunnelPeek,
            &config, sizeof(config));
            &tunnelPeekConfig, sizeof(tunnelPeekConfig));
    if (err != OK) {
        ALOGE("decoder cannot set %s to %d (err %d)",
                TUNNEL_PEEK_KEY, tunnelPeek, err);
    }
    return err;
}

status_t ACodec::setTunnelPeekLegacy(int32_t isLegacy) {
    if (mIsEncoder) {
        ALOGE("encoder does not support %s", TUNNEL_PEEK_SET_LEGACY_KEY);
        return BAD_VALUE;
    }
    if (!mTunneled) {
        ALOGE("%s is only supported in tunnel mode", TUNNEL_PEEK_SET_LEGACY_KEY);
        return BAD_VALUE;
    }

    OMX_CONFIG_BOOLEANTYPE tunnelPeekLegacyModeConfig;
    InitOMXParams(&tunnelPeekLegacyModeConfig);
    tunnelPeekLegacyModeConfig.bEnabled = (OMX_BOOL)(isLegacy != 0);
    status_t err = mOMXNode->setConfig(
            (OMX_INDEXTYPE)OMX_IndexConfigAndroidTunnelPeekLegacyMode,
            &tunnelPeekLegacyModeConfig, sizeof(tunnelPeekLegacyModeConfig));
    if (err != OK) {
        ALOGE("decoder cannot set video peek legacy mode to %d (err %d)",
                isLegacy,  err);
    }
    return err;
}

@@ -7934,6 +7957,7 @@ status_t ACodec::setParameters(const sp<AMessage> &params) {
        }
    }

    {
        int32_t tunnelPeek = 0;
        if (params->findInt32(TUNNEL_PEEK_KEY, &tunnelPeek)) {
            status_t err = setTunnelPeek(tunnelPeek);
@@ -7941,6 +7965,16 @@ status_t ACodec::setParameters(const sp<AMessage> &params) {
                return err;
            }
        }
    }
    {
        int32_t tunnelPeekSetLegacy = 0;
        if (params->findInt32(TUNNEL_PEEK_SET_LEGACY_KEY, &tunnelPeekSetLegacy)) {
            status_t err = setTunnelPeekLegacy(tunnelPeekSetLegacy);
            if (err != OK) {
                return err;
            }
        }
    }

    return setVendorParameters(params);
}
+1 −0
Original line number Diff line number Diff line
@@ -522,6 +522,7 @@ private:
    status_t setLatency(uint32_t latency);
    status_t getLatency(uint32_t *latency);
    status_t setTunnelPeek(int32_t tunnelPeek);
    status_t setTunnelPeekLegacy(int32_t isLegacy);
    status_t setAudioPresentation(int32_t presentationId, int32_t programId);
    status_t setOperatingRate(float rateFloat, bool isVideo);
    status_t getIntraRefreshPeriod(uint32_t *intraRefreshPeriod);