catch illegal state exception in TrackWrapper
This commit is contained in:
parent
09993b8319
commit
7e9980d997
|
@ -6,6 +6,8 @@ import com.google.common.base.CaseFormat;
|
|||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import eu.siacs.conversations.Config;
|
||||
|
||||
import org.webrtc.MediaStreamTrack;
|
||||
import org.webrtc.PeerConnection;
|
||||
import org.webrtc.RtpSender;
|
||||
|
@ -16,8 +18,6 @@ import java.util.UUID;
|
|||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import eu.siacs.conversations.Config;
|
||||
|
||||
class TrackWrapper<T extends MediaStreamTrack> {
|
||||
public final T track;
|
||||
public final RtpSender rtpSender;
|
||||
|
@ -43,7 +43,13 @@ class TrackWrapper<T extends MediaStreamTrack> {
|
|||
final RtpTransceiver transceiver =
|
||||
peerConnection == null ? null : getTransceiver(peerConnection, trackWrapper);
|
||||
if (transceiver == null) {
|
||||
Log.w(Config.LOGTAG, "unable to detect transceiver for " + trackWrapper.rtpSender.id());
|
||||
final String id;
|
||||
try {
|
||||
id = trackWrapper.rtpSender.id();
|
||||
} catch (final IllegalStateException e) {
|
||||
return Optional.absent();
|
||||
}
|
||||
Log.w(Config.LOGTAG, "unable to detect transceiver for " + id);
|
||||
return Optional.of(trackWrapper.track);
|
||||
}
|
||||
final RtpTransceiver.RtpTransceiverDirection direction = transceiver.getDirection();
|
||||
|
|
|
@ -520,7 +520,7 @@ public class WebRTCWrapper {
|
|||
return false;
|
||||
}
|
||||
} else {
|
||||
throw new IllegalStateException("Local audio track does not exist (yet)");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue