diff options
author | Andreas Huber <andih@google.com> | 2010-03-01 14:27:00 -0800 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2010-03-01 14:58:39 -0800 |
commit | 5f0d5ce38a4f01ca986e6fe514c57a17b83dd841 (patch) | |
tree | 7f49f491634443c9602507f5b5e0229582ae35b4 /media | |
parent | aceb6fe23edacf0a945ff8f73fbf31ba1fdc2f0e (diff) | |
download | frameworks_base-5f0d5ce38a4f01ca986e6fe514c57a17b83dd841.zip frameworks_base-5f0d5ce38a4f01ca986e6fe514c57a17b83dd841.tar.gz frameworks_base-5f0d5ce38a4f01ca986e6fe514c57a17b83dd841.tar.bz2 |
Ensure that the audio codec instance is actually going away before we attempt to instantiate another one, otherwise we might end up with the software codec even though the hardware codec would have been available shortly.
Diffstat (limited to 'media')
-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; |