@@ -277,17 +277,17 @@ public void createReconnectorRunnables() {
277277 && pc .iceConnectionState () != PeerConnection .IceConnectionState .COMPLETED )) {
278278
279279
280- if (peerInfo .mode .equals (Mode .PUBLISH )) {
281- if (pc != null ) {
282- pc .close ();
283- /*
284- This is a FIX of a reconnection bug.
285- If dispose is used instead of close, in one of consequent reconnection attempts segmentation fault occurs.
286- pc.dispose();
287- */
288- }
280+ if (pc != null ) {
281+ pc .close ();
282+ /*
283+ This is a FIX of a reconnection bug.
284+ If dispose is used instead of close, in one of consequent reconnection attempts segmentation fault occurs.
285+ pc.dispose();
286+ */
287+ }
289288
290- config .webRTCListener .onReconnectionAttempt (peerInfo .id ,peerInfo .mode );
289+ config .webRTCListener .onReconnectionAttempt (peerInfo .id ,peerInfo .mode );
290+ if (peerInfo .mode .equals (Mode .PUBLISH )) {
291291
292292 Log .d (TAG , "Reconnect attempt for publish" );
293293 wsHandler .stop (peerInfo .id );
@@ -316,20 +316,19 @@ public void createReconnectorRunnables() {
316316 && pc .iceConnectionState () != PeerConnection .IceConnectionState .CONNECTED
317317 && pc .iceConnectionState () != PeerConnection .IceConnectionState .COMPLETED )) {
318318
319- if (peerInfo .mode .equals (Mode .PLAY )) {
320-
321- releaseRemoteRenderers ();
322319
323- if (pc != null ) {
324- pc .close ();
325- /*
326- This is a FIX of a reconnection bug.
327- If dispose is used instead of close, in one of consequent reconnection attempts segmentation fault occurs.
328- pc.dispose();
329- */
330- }
320+ releaseRemoteRenderers ();
321+ if (pc != null ) {
322+ pc .close ();
323+ /*
324+ This is a FIX of a reconnection bug.
325+ If dispose is used instead of close, in one of consequent reconnection attempts segmentation fault occurs.
326+ pc.dispose();
327+ */
328+ }
331329
332- config .webRTCListener .onReconnectionAttempt (peerInfo .id ,peerInfo .mode );
330+ config .webRTCListener .onReconnectionAttempt (peerInfo .id ,peerInfo .mode );
331+ if (peerInfo .mode .equals (Mode .PLAY )) {
333332 Log .d (TAG , "Reconnect attempt for play" );
334333
335334 play (peerInfo .id ,
@@ -348,6 +347,10 @@ public void createReconnectorRunnables() {
348347 if (released || streamStoppedByUser ){
349348 return ;
350349 }
350+ if (wsHandler .pingPongExecutor == null ){
351+ wsHandler .startPingPongTimer ();
352+ }
353+
351354 peerReconnectionHandler .postDelayed (peerReconnectorRunnable , PEER_RECONNECTION_RETRY_DELAY_MS );
352355
353356 for (PeerInfo peerInfo : peers .values ()) {
@@ -674,7 +677,7 @@ public void onCreateSuccess(final SessionDescription desc) {
674677 PeerConnection pc = peerInfo .peerConnection ;
675678 if (pc != null ) {
676679 Log .d (TAG , "Set local SDP from " + desc .type );
677- pc .setLocalDescription (this , newDesc );
680+ pc .setLocalDescription (this , newDesc );
678681 }
679682 });
680683 }
@@ -1379,11 +1382,6 @@ public void rePublishPlay() {
13791382 publishReconnectionHandler .postDelayed (publishReconnectorRunnable , PEER_RECONNECTION_DELAY_MS );
13801383 Log .d (TAG , "------------------------------------- Publish Reconnection --------------------------------------" );
13811384 }
1382- if (!isPlayConnected () && !playReconnectionInProgress ) {
1383- playReconnectionInProgress = true ;
1384- playReconnectionHandler .postDelayed (playReconnectorRunnable , PEER_RECONNECTION_DELAY_MS );
1385- Log .d (TAG , "------------------------------------- Play Reconnection --------------------------------------" );
1386- }
13871385 } else {
13881386 Log .i (TAG , "Peer was connected before. Will try to republish/replay in " + PEER_RECONNECTION_DELAY_MS + " ms." );
13891387 publishReconnectionInProgress = true ;
@@ -1490,6 +1488,12 @@ public void onConnected(String streamId) {
14901488 Log .i (TAG , "Connected for streamId:" + streamId );
14911489
14921490 if (isConference () && config .reconnectionEnabled ){
1491+ if (!isPlayConnected () && !playReconnectionInProgress ) {
1492+ playReconnectionInProgress = true ;
1493+ playReconnectionHandler .postDelayed (playReconnectorRunnable , PEER_RECONNECTION_DELAY_MS );
1494+ Log .d (TAG , "------------------------------------- Play Reconnection --------------------------------------" );
1495+ }
1496+
14931497 if (isPublishConnected ()){
14941498 Log .i (TAG ,"Publish reconnected" );
14951499 publishReconnectionHandler .removeCallbacksAndMessages (null );
0 commit comments