Skip to content

Commit

Permalink
reset renderer initialization in close (#50)
Browse files Browse the repository at this point in the history
* reset renderer initialization in close

* add new test

---------

Co-authored-by: burak-58 <burakkekec@gmail.com>
  • Loading branch information
burak-58 and burak-58 authored Dec 13, 2023
1 parent 35a4cbb commit 587d3db
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2445,16 +2445,19 @@ public void closeInternal() {
if (factory != null) {
factory.dispose();
factory = null;
PeerConnectionFactory.stopInternalTracingCapture();
PeerConnectionFactory.shutdownInternalTracer();
}
if(eglBase != null) {
eglBase.release();
eglBase = null;
}
Log.d(TAG, "Closing peer connection done.");
onPeerConnectionClosed();
PeerConnectionFactory.stopInternalTracingCapture();
PeerConnectionFactory.shutdownInternalTracer();

streamStarted = false;

renderersInitiated = false;
}

public boolean isHDVideo() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1164,4 +1164,20 @@ public void testDegradationPreference() {

verify(sender, timeout(1000).times(1)).setParameters(parameters);
}

@Test
public void testCloseInternal() {
String streamId = "stream1";

IWebRTCListener listener = Mockito.mock(IWebRTCListener.class);
WebRTCClient webRTCClientReal = new WebRTCClient(listener, mock(Context.class));
WebSocketHandler wsHandler = mock(WebSocketHandler.class);
webRTCClientReal.setWsHandler(wsHandler);

WebRTCClient webRTCClient = spy(webRTCClientReal);
final Handler handler = getMockHandler();
webRTCClient.setHandler(handler);

webRTCClient.closeInternal();
}
}

0 comments on commit 587d3db

Please sign in to comment.