Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Unified Diff: webrtc/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java

Issue 3010973002: Resolves crash in AudioTrack.flush() on Android (Closed)
Patch Set: nit Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
+ }
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698