Dispose audio source correctly in AppRTC Demo on Android.
Call dispose method on audio source in PeerConnectionClient dispose method. R=magjed@webrtc.org Review URL: https://codereview.webrtc.org/2117463002 . Cr-Commit-Position: refs/heads/master@{#13348}
This commit is contained in:
parent
c5ad0c81c7
commit
039083aedc
@ -10,12 +10,14 @@
|
|||||||
|
|
||||||
package org.appspot.apprtc;
|
package org.appspot.apprtc;
|
||||||
|
|
||||||
|
import org.appspot.apprtc.AppRTCClient.SignalingParameters;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.ParcelFileDescriptor;
|
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
|
import android.os.ParcelFileDescriptor;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.appspot.apprtc.AppRTCClient.SignalingParameters;
|
import org.webrtc.AudioSource;
|
||||||
import org.webrtc.AudioTrack;
|
import org.webrtc.AudioTrack;
|
||||||
import org.webrtc.CameraEnumerationAndroid;
|
import org.webrtc.CameraEnumerationAndroid;
|
||||||
import org.webrtc.DataChannel;
|
import org.webrtc.DataChannel;
|
||||||
@ -96,6 +98,7 @@ public class PeerConnectionClient {
|
|||||||
private PeerConnectionFactory factory;
|
private PeerConnectionFactory factory;
|
||||||
private PeerConnection peerConnection;
|
private PeerConnection peerConnection;
|
||||||
PeerConnectionFactory.Options options = null;
|
PeerConnectionFactory.Options options = null;
|
||||||
|
private AudioSource audioSource;
|
||||||
private VideoSource videoSource;
|
private VideoSource videoSource;
|
||||||
private boolean videoCallEnabled;
|
private boolean videoCallEnabled;
|
||||||
private boolean preferIsac;
|
private boolean preferIsac;
|
||||||
@ -542,6 +545,11 @@ public class PeerConnectionClient {
|
|||||||
peerConnection.dispose();
|
peerConnection.dispose();
|
||||||
peerConnection = null;
|
peerConnection = null;
|
||||||
}
|
}
|
||||||
|
Log.d(TAG, "Closing audio source.");
|
||||||
|
if (audioSource != null) {
|
||||||
|
audioSource.dispose();
|
||||||
|
audioSource = null;
|
||||||
|
}
|
||||||
Log.d(TAG, "Closing video source.");
|
Log.d(TAG, "Closing video source.");
|
||||||
if (videoSource != null) {
|
if (videoSource != null) {
|
||||||
videoSource.dispose();
|
videoSource.dispose();
|
||||||
@ -777,9 +785,8 @@ public class PeerConnectionClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private AudioTrack createAudioTrack() {
|
private AudioTrack createAudioTrack() {
|
||||||
localAudioTrack = factory.createAudioTrack(
|
audioSource = factory.createAudioSource(audioConstraints);
|
||||||
AUDIO_TRACK_ID,
|
localAudioTrack = factory.createAudioTrack(AUDIO_TRACK_ID, audioSource);
|
||||||
factory.createAudioSource(audioConstraints));
|
|
||||||
localAudioTrack.setEnabled(enableAudio);
|
localAudioTrack.setEnabled(enableAudio);
|
||||||
return localAudioTrack;
|
return localAudioTrack;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user