Index: webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java |
diff --git a/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java b/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java |
index 6800a7c0232719c7d63b5fda817f7538b7797d7c..ab55567b3caa10dcda14a477ec4c6728a68cf458 100644 |
--- a/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java |
+++ b/webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java |
@@ -173,12 +173,14 @@ public class WebRtcAudioTrack { |
// Stops playing the audio data. Since the instance was created in |
// MODE_STREAM mode, audio will stop playing after the last buffer that |
// was written has been played. |
- final AudioTrack at = audioTrack; |
- if (at != null) { |
+ if (audioTrack != null) { |
Logging.d(TAG, "Stopping the audio track..."); |
- at.stop(); |
- Logging.d(TAG, "The audio track has now been stopped."); |
- at.flush(); |
+ try { |
+ audioTrack.stop(); |
+ Logging.d(TAG, "The audio track has now been stopped."); |
+ } catch (IllegalStateException e) { |
+ Logging.e(TAG, "AudioTrack.stop failed: " + e.getMessage()); |
+ } |
} |
} |