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

Commit 98b48dee authored by Andreas Huber's avatar Andreas Huber
Browse files

Make sure the OMX component is synchronously shutdown before we try to...

Make sure the OMX component is synchronously shutdown before we try to instantiate another one. Also properly cleanup the software AVC decoder to avoid leaking memory.

related-to-bug: 2404786
parent d425a45f
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -249,7 +249,16 @@ void AwesomePlayer::reset_l() {

    if (mVideoSource != NULL) {
        mVideoSource->stop();

        // The following hack is necessary to ensure that the OMX
        // component is completely released by the time we may try
        // to instantiate it again.
        wp<MediaSource> tmp = mVideoSource;
        mVideoSource.clear();
        while (tmp.promote() != NULL) {
            usleep(1000);
        }
        IPCThreadState::self()->flushCommands();
    }

    mAudioSource.clear();
+2 −0
Original line number Diff line number Diff line
@@ -80,6 +80,8 @@ AVCDecoder::~AVCDecoder() {
        stop();
    }

    PVAVCCleanUpDecoder(mHandle);

    delete mHandle;
    mHandle = NULL;
}