Skip to content

Commit

Permalink
android: release audio device module after creating factory
Browse files Browse the repository at this point in the history
  • Loading branch information
davidliu committed Jun 21, 2024
1 parent c8829cb commit 71da6c7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
11 changes: 3 additions & 8 deletions android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ public WebRTCModule(ReactApplicationContext reactContext) {
.setVideoDecoderFactory(decoderFactory)
.createPeerConnectionFactory();

// PeerConnectionFactory now owns the adm native pointer, and we don't need it anymore.
adm.release();

// Saving the encoder and decoder factories to get codec info later when needed.
mVideoEncoderFactory = encoderFactory;
mVideoDecoderFactory = decoderFactory;
Expand All @@ -116,14 +119,6 @@ public String getName() {
return "WebRTCModule";
}

@Override
public void onCatalystInstanceDestroy() {
if (mAudioDeviceModule != null) {
mAudioDeviceModule.release();
}
super.onCatalystInstanceDestroy();
}

private PeerConnection getPeerConnection(int id) {
PeerConnectionObserver pco = mPeerConnectionObservers.get(id);
return (pco == null) ? null : pco.getPeerConnection();
Expand Down
2 changes: 1 addition & 1 deletion examples/GumTestApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"react": "18.2.0",
"react-native": "0.71.4",
"react-native-webrtc": "*"
"@livekit/react-native-webrtc": "*"
},
"devDependencies": {
"@babel/core": "^7.20.0",
Expand Down

0 comments on commit 71da6c7

Please sign in to comment.