terminate with application failure when failing to apply ICE restart

This is fairly unlikely to happen in practice
This commit is contained in:
Daniel Gultsch 2021-11-15 17:18:43 +01:00
parent 3f402b132b
commit 0a3947b8e3

View file

@ -319,14 +319,17 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
respondWithTieBreak(jinglePacket); respondWithTieBreak(jinglePacket);
return true; return true;
} }
} catch (Exception e) { } catch (final Exception exception) {
Log.d(Config.LOGTAG, "failure to apply ICE restart. sending error", e); respondOk(jinglePacket);
//TODO respond OK and then terminate session final Throwable rootCause = Throwables.getRootCause(exception);
Log.d(Config.LOGTAG, "failure to apply ICE restart", rootCause);
webRTCWrapper.close();
sendSessionTerminate(Reason.ofThrowable(rootCause), rootCause.getMessage());
return true; return true;
} }
} }
private boolean applyIceRestart(final JinglePacket jinglePacket, final RtpContentMap restartContentMap, final boolean isOffer) throws ExecutionException, InterruptedException { private boolean applyIceRestart(final JinglePacket jinglePacket, final RtpContentMap restartContentMap, final boolean isOffer) throws ExecutionException, InterruptedException {
final SessionDescription sessionDescription = SessionDescription.of(restartContentMap); final SessionDescription sessionDescription = SessionDescription.of(restartContentMap);
final org.webrtc.SessionDescription.Type type = isOffer ? org.webrtc.SessionDescription.Type.OFFER : org.webrtc.SessionDescription.Type.ANSWER; final org.webrtc.SessionDescription.Type type = isOffer ? org.webrtc.SessionDescription.Type.OFFER : org.webrtc.SessionDescription.Type.ANSWER;
org.webrtc.SessionDescription sdp = new org.webrtc.SessionDescription(type, sessionDescription.toString()); org.webrtc.SessionDescription sdp = new org.webrtc.SessionDescription(type, sessionDescription.toString());
@ -574,7 +577,7 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
} catch (final Exception e) { } catch (final Exception e) {
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": unable to set remote description after receiving session-accept", Throwables.getRootCause(e)); Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": unable to set remote description after receiving session-accept", Throwables.getRootCause(e));
webRTCWrapper.close(); webRTCWrapper.close();
sendSessionTerminate(Reason.FAILED_APPLICATION); sendSessionTerminate(Reason.FAILED_APPLICATION, Throwables.getRootCause(e).getMessage());
return; return;
} }
processCandidates(contentMap.contents.entrySet()); processCandidates(contentMap.contents.entrySet());
@ -624,7 +627,6 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
org.webrtc.SessionDescription webRTCSessionDescription = this.webRTCWrapper.setLocalDescription().get(); org.webrtc.SessionDescription webRTCSessionDescription = this.webRTCWrapper.setLocalDescription().get();
prepareSessionAccept(webRTCSessionDescription); prepareSessionAccept(webRTCSessionDescription);
} catch (final Exception e) { } catch (final Exception e) {
//TODO sending the error text is worthwhile as well. Especially for FailureToSet exceptions
failureToAcceptSession(e); failureToAcceptSession(e);
} }
} }
@ -633,9 +635,10 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
if (isTerminated()) { if (isTerminated()) {
return; return;
} }
Log.d(Config.LOGTAG, "unable to send session accept", Throwables.getRootCause(throwable)); final Throwable rootCause = Throwables.getRootCause(throwable);
Log.d(Config.LOGTAG, "unable to send session accept", rootCause);
webRTCWrapper.close(); webRTCWrapper.close();
sendSessionTerminate(Reason.ofThrowable(throwable)); sendSessionTerminate(Reason.ofThrowable(rootCause), rootCause.getMessage());
} }
private void addIceCandidatesFromBlackLog() { private void addIceCandidatesFromBlackLog() {