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

Commit 4b2cb4ef authored by Hongguang Chen's avatar Hongguang Chen Committed by Gerrit Code Review
Browse files

Merge "Set null sideband handle for non-tunneled playback."

parents ff30f705 7ab7ee69
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -1854,9 +1854,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) {
@@ -1864,6 +1866,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);