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

Commit 73721170 authored by Lajos Molnar's avatar Lajos Molnar Committed by Android (Google) Code Review
Browse files

Merge "mediaplayer: handle surface dis/connection errors" into lmp-dev

parents 47e89d7d 14986f6c
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -122,14 +122,17 @@ void NuPlayer::Decoder::onConfigure(const sp<AMessage> &format) {

    mCodec->getName(&mComponentName);

    status_t err;
    if (mNativeWindow != NULL) {
        // disconnect from surface as MediaCodec will reconnect
        CHECK_EQ((int)NO_ERROR,
                native_window_api_disconnect(
                        surface.get(),
                        NATIVE_WINDOW_API_MEDIA));
    }
    status_t err = mCodec->configure(
        err = native_window_api_disconnect(
                surface.get(), NATIVE_WINDOW_API_MEDIA);
        // We treat this as a warning, as this is a preparatory step.
        // Codec will try to connect to the surface, which is where
        // any error signaling will occur.
        ALOGW_IF(err != OK, "failed to disconnect from surface: %d", err);
    }
    err = mCodec->configure(
            format, surface, NULL /* crypto */, 0 /* flags */);
    if (err != OK) {
        ALOGE("Failed to configure %s decoder (err=%d)", mComponentName.c_str(), err);