OSDN Git Service

Make sure the OMX component is synchronously shutdown before we try to instantiate...
authorAndreas Huber <andih@google.com>
Fri, 29 Jan 2010 18:10:22 +0000 (10:10 -0800)
committerAndreas Huber <andih@google.com>
Fri, 29 Jan 2010 18:11:11 +0000 (10:11 -0800)
related-to-bug: 2404786

media/libstagefright/AwesomePlayer.cpp
media/libstagefright/codecs/avc/dec/AVCDecoder.cpp

index d6db59f..85019aa 100644 (file)
@@ -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();
index d874224..36272ea 100644 (file)
@@ -80,6 +80,8 @@ AVCDecoder::~AVCDecoder() {
         stop();
     }
 
+    PVAVCCleanUpDecoder(mHandle);
+
     delete mHandle;
     mHandle = NULL;
 }