From 022048e95f3f1d65cb776cf21de2001423fcf7d9 Mon Sep 17 00:00:00 2001 From: James Dong Date: Wed, 16 May 2012 19:06:19 -0700 Subject: Stop audio source if AudioPlayer could not be started related-to-bug: 6500580 Change-Id: If47e442db2f1ea400e9b598502bb48513f28cd6d --- media/libstagefright/AudioPlayer.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'media/libstagefright/AudioPlayer.cpp') diff --git a/media/libstagefright/AudioPlayer.cpp b/media/libstagefright/AudioPlayer.cpp index 4208019..6b1be1f 100644 --- a/media/libstagefright/AudioPlayer.cpp +++ b/media/libstagefright/AudioPlayer.cpp @@ -142,9 +142,10 @@ status_t AudioPlayer::start(bool sourceAlreadyStarted) { mFirstBuffer = NULL; } - if (!sourceAlreadyStarted) { - mSource->stop(); - } + // At this point, source already got started + // Stop the source when error is found. + mSource->stop(); + mSource = NULL; return err; } @@ -174,9 +175,9 @@ status_t AudioPlayer::start(bool sourceAlreadyStarted) { mFirstBuffer = NULL; } - if (!sourceAlreadyStarted) { - mSource->stop(); - } + // At this point, source already got started + // Stop the source when error is found. + mSource->stop(); return err; } -- cgit v1.1