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

Unified Diff: webrtc/examples/androidapp/src/org/appspot/apprtc/PeerConnectionClient.java

Issue 2117463002: Dispose audio source correctly in AppRTC Demo on Android. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 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/examples/androidapp/src/org/appspot/apprtc/PeerConnectionClient.java
diff --git a/webrtc/examples/androidapp/src/org/appspot/apprtc/PeerConnectionClient.java b/webrtc/examples/androidapp/src/org/appspot/apprtc/PeerConnectionClient.java
index e8e1f85039199e1c196487dbf6c3115a69f62fbf..294b1ef07baeb6e91e6cfe26a3eb66afe8f3c910 100644
--- a/webrtc/examples/androidapp/src/org/appspot/apprtc/PeerConnectionClient.java
+++ b/webrtc/examples/androidapp/src/org/appspot/apprtc/PeerConnectionClient.java
@@ -10,12 +10,14 @@
package org.appspot.apprtc;
+import org.appspot.apprtc.AppRTCClient.SignalingParameters;
+
import android.content.Context;
-import android.os.ParcelFileDescriptor;
import android.os.Environment;
+import android.os.ParcelFileDescriptor;
import android.util.Log;
-import org.appspot.apprtc.AppRTCClient.SignalingParameters;
+import org.webrtc.AudioSource;
import org.webrtc.AudioTrack;
import org.webrtc.CameraEnumerationAndroid;
import org.webrtc.DataChannel;
@@ -96,6 +98,7 @@ public class PeerConnectionClient {
private PeerConnectionFactory factory;
private PeerConnection peerConnection;
PeerConnectionFactory.Options options = null;
+ private AudioSource audioSource;
private VideoSource videoSource;
private boolean videoCallEnabled;
private boolean preferIsac;
@@ -542,6 +545,11 @@ public class PeerConnectionClient {
peerConnection.dispose();
peerConnection = null;
}
+ Log.d(TAG, "Closing audio source.");
+ if (audioSource != null) {
+ audioSource.dispose();
+ audioSource = null;
+ }
Log.d(TAG, "Closing video source.");
if (videoSource != null) {
videoSource.dispose();
@@ -777,9 +785,8 @@ public class PeerConnectionClient {
}
private AudioTrack createAudioTrack() {
- localAudioTrack = factory.createAudioTrack(
- AUDIO_TRACK_ID,
- factory.createAudioSource(audioConstraints));
+ audioSource = factory.createAudioSource(audioConstraints);
+ localAudioTrack = factory.createAudioTrack(AUDIO_TRACK_ID, audioSource);
localAudioTrack.setEnabled(enableAudio);
return localAudioTrack;
}
« 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