diff options
| author | Andreas Huber <andih@google.com> | 2010-01-29 10:10:22 -0800 |
|---|---|---|
| committer | Andreas Huber <andih@google.com> | 2010-01-29 10:11:11 -0800 |
| commit | 98b48dee325bd22ae73029cd6a42047036ed5ab1 (patch) | |
| tree | 8604779b4b56d107cadff531ea4ed115fedd4250 | |
| parent | d425a45f8d7c0e94d2db4c0a5c8157e6c846b853 (diff) | |
| download | frameworks_base-98b48dee325bd22ae73029cd6a42047036ed5ab1.zip frameworks_base-98b48dee325bd22ae73029cd6a42047036ed5ab1.tar.gz frameworks_base-98b48dee325bd22ae73029cd6a42047036ed5ab1.tar.bz2 | |
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
| -rw-r--r-- | media/libstagefright/AwesomePlayer.cpp | 9 | ||||
| -rw-r--r-- | media/libstagefright/codecs/avc/dec/AVCDecoder.cpp | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index d6db59f..85019aa 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -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(); diff --git a/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp b/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp index d874224..36272ea 100644 --- a/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp +++ b/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp @@ -80,6 +80,8 @@ AVCDecoder::~AVCDecoder() { stop(); } + PVAVCCleanUpDecoder(mHandle); + delete mHandle; mHandle = NULL; } |
