8000 Adds additional dispose method to the MethodCallHandlerImpl · hicodeboy/flutter-webrtc@d23899f · GitHub
[go: up one dir, main page]

Skip to content

Commit d23899f

Browse files
committed
Adds additional dispose method to the MethodCallHandlerImpl
1 parent f04e600 commit d23899f

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

android/src/main/java/com/cloudwebrtc/webrtc/FlutterWebRTCPlugin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@ public void setSpeakerphoneOn(boolean on) {
117117
}
118118

119119
private void stopListening() {
120-
channel.setMethodCallHandler(null);
120+
methodCallHandler.dispose();
121121
methodCallHandler = null;
122+
channel.setMethodCallHandler(null);
122123

123124
if (rtcAudioManager != null) {
124125
Log.d(TAG, "Stopping the audio manager...");

android/src/main/java/com/cloudwebrtc/webrtc/MethodCallHandlerImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ interface AudioManager {
115115
this.audioManager = audioManager;
116116
}
117117

118+
void dispose() {
119+
mPeerConnectionObservers.clear();
120+
}
121+
118122
private void ensureInitialized() {
119123
if (mFactory != null) {
120124
return;

android/src/main/java/com/cloudwebrtc/webrtc/PeerConnectionObserver.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ void close() {
7575

7676
void dispose() {
7777
this.close();
78+
7879
peerConnection.dispose();
7980
eventChannel.setStreamHandler(null);
8081
}

0 commit comments

Comments
 (0)
0