diff options
Diffstat (limited to 'media/libstagefright/AudioPlayer.cpp')
-rw-r--r-- | media/libstagefright/AudioPlayer.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/media/libstagefright/AudioPlayer.cpp b/media/libstagefright/AudioPlayer.cpp index 57f58be..5e6e0da 100644 --- a/media/libstagefright/AudioPlayer.cpp +++ b/media/libstagefright/AudioPlayer.cpp @@ -18,6 +18,7 @@ #define LOG_TAG "AudioPlayer" #include <utils/Log.h> +#include <binder/IPCThreadState.h> #include <media/AudioTrack.h> #include <media/stagefright/AudioPlayer.h> #include <media/stagefright/MediaDebug.h> @@ -164,6 +165,16 @@ void AudioPlayer::stop() { mSource->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 = mSource; + mSource.clear(); + while (tmp.promote() != NULL) { + usleep(1000); + } + IPCThreadState::self()->flushCommands(); + mNumFramesPlayed = 0; mPositionTimeMediaUs = -1; mPositionTimeRealUs = -1; |