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.Optional;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
|
import eu.siacs.conversations.Config;
|
||||||
|
|
||||||
import org.webrtc.MediaStreamTrack;
|
import org.webrtc.MediaStreamTrack;
|
||||||
import org.webrtc.PeerConnection;
|
import org.webrtc.PeerConnection;
|
||||||
import org.webrtc.RtpSender;
|
import org.webrtc.RtpSender;
|
||||||
|
@ -16,8 +18,6 @@ import java.util.UUID;
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import eu.siacs.conversations.Config;
|
|
||||||
|
|
||||||
class TrackWrapper<T extends MediaStreamTrack> {
|
class TrackWrapper<T extends MediaStreamTrack> {
|
||||||
public final T track;
|
public final T track;
|
||||||
public final RtpSender rtpSender;
|
public final RtpSender rtpSender;
|
||||||
|
@ -43,7 +43,13 @@ class TrackWrapper<T extends MediaStreamTrack> {
|
||||||
final RtpTransceiver transceiver =
|
final RtpTransceiver transceiver =
|
||||||
peerConnection == null ? null : getTransceiver(peerConnection, trackWrapper);
|
peerConnection == null ? null : getTransceiver(peerConnection, trackWrapper);
|
||||||
if (transceiver == null) {
|
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);
|
return Optional.of(trackWrapper.track);
|
||||||
}
|
}
|
||||||
final RtpTransceiver.RtpTransceiverDirection direction = transceiver.getDirection();
|
final RtpTransceiver.RtpTransceiverDirection direction = transceiver.getDirection();
|
||||||
|
|
|
@ -520,7 +520,7 @@ public class WebRTCWrapper {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException("Local audio track does not exist (yet)");
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue