Store AudioTrack return value for error condition
Store AudioTrack->initCheck()'s return value so we can return it after
the AudioTrack is deleted.
Change-Id: Ie042a7d6a54d7f9afd8a5767cfd167dbeb2e5c04
diff --git a/media/libstagefright/AudioPlayer.cpp b/media/libstagefright/AudioPlayer.cpp
index 12d7ee2..7997cd6 100644
--- a/media/libstagefright/AudioPlayer.cpp
+++ b/media/libstagefright/AudioPlayer.cpp
@@ -99,13 +99,13 @@
: AudioSystem::CHANNEL_OUT_MONO,
8192, 0, &AudioCallback, this, 0);
- if (mAudioTrack->initCheck() != OK) {
+ if ((err = mAudioTrack->initCheck()) != OK) {
delete mAudioTrack;
mAudioTrack = NULL;
mSource->stop();
- return mAudioTrack->initCheck();
+ return err;
}
mLatencyUs = (int64_t)mAudioTrack->latency() * 1000;