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

Commit 03a58995 authored by Hongguang Chen's avatar Hongguang Chen Committed by Automerger Merge Worker
Browse files

Merge "Set null sideband handle for non-tunneled playback." am: 4b2cb4ef

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/1839861

Change-Id: I8c182116a17032b9517c4677cd5dd2047285b3ed
parents f6d6a800 4b2cb4ef
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -1875,9 +1875,11 @@ status_t CCodec::setSurface(const sp<Surface> &surface) {
    {
        Mutexed<std::unique_ptr<Config>>::Locked configLocked(mConfig);
        const std::unique_ptr<Config> &config = *configLocked;
        if (config->mTunneled && config->mSidebandHandle != nullptr) {
        sp<ANativeWindow> nativeWindow = static_cast<ANativeWindow *>(surface.get());
            status_t err = native_window_set_sideband_stream(
        status_t err = OK;

        if (config->mTunneled && config->mSidebandHandle != nullptr) {
            err = native_window_set_sideband_stream(
                    nativeWindow.get(),
                    const_cast<native_handle_t *>(config->mSidebandHandle->handle()));
            if (err != OK) {
@@ -1885,6 +1887,15 @@ status_t CCodec::setSurface(const sp<Surface> &surface) {
                        nativeWindow.get(), config->mSidebandHandle->handle(), err);
                return err;
            }
        } else {
            // Explicitly reset the sideband handle of the window for
            // non-tunneled video in case the window was previously used
            // for a tunneled video playback.
            err = native_window_set_sideband_stream(nativeWindow.get(), nullptr);
            if (err != OK) {
                ALOGE("native_window_set_sideband_stream(nullptr) failed! (err %d).", err);
                return err;
            }
        }
    }
    return mChannel->setSurface(surface);