fetch local description on its own executor
This commit is contained in:
parent
1b50802375
commit
f66229ff4e
2 changed files with 29 additions and 25 deletions
|
@ -2376,7 +2376,7 @@ public class JingleRtpConnection extends AbstractJingleConnection
|
|||
}
|
||||
private void restartIce() {
|
||||
this.stateHistory.clear();
|
||||
this.webRTCWrapper.restartIce();
|
||||
this.webRTCWrapper.restartIceAsync();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -60,6 +60,8 @@ public class WebRTCWrapper {
|
|||
private static final String EXTENDED_LOGGING_TAG = WebRTCWrapper.class.getSimpleName();
|
||||
|
||||
private final ExecutorService executorService = Executors.newSingleThreadExecutor();
|
||||
private final ExecutorService localDescriptionExecutorService =
|
||||
Executors.newSingleThreadExecutor();
|
||||
|
||||
private static final Set<String> HARDWARE_AEC_BLACKLIST =
|
||||
new ImmutableSet.Builder<String>()
|
||||
|
@ -285,8 +287,8 @@ public class WebRTCWrapper {
|
|||
Preconditions.checkNotNull(media);
|
||||
Preconditions.checkArgument(
|
||||
media.size() > 0, "media can not be empty when initializing peer connection");
|
||||
final boolean setUseHardwareAcousticEchoCanceler = !HARDWARE_AEC_BLACKLIST.contains(Build.MODEL);
|
||||
|
||||
final boolean setUseHardwareAcousticEchoCanceler =
|
||||
!HARDWARE_AEC_BLACKLIST.contains(Build.MODEL);
|
||||
Log.d(
|
||||
Config.LOGTAG,
|
||||
String.format(
|
||||
|
@ -445,21 +447,20 @@ public class WebRTCWrapper {
|
|||
requirePeerConnection().setConfiguration(buildConfiguration(iceServers));
|
||||
}
|
||||
|
||||
void restartIce() {
|
||||
executorService.execute(
|
||||
() -> {
|
||||
final PeerConnection peerConnection;
|
||||
try {
|
||||
peerConnection = requirePeerConnection();
|
||||
} catch (final PeerConnectionNotInitialized e) {
|
||||
Log.w(
|
||||
EXTENDED_LOGGING_TAG,
|
||||
"PeerConnection vanished before we could execute restart");
|
||||
return;
|
||||
}
|
||||
setIsReadyToReceiveIceCandidates(false);
|
||||
peerConnection.restartIce();
|
||||
});
|
||||
void restartIceAsync() {
|
||||
this.execute(this::restartIce);
|
||||
}
|
||||
|
||||
private void restartIce() {
|
||||
final PeerConnection peerConnection;
|
||||
try {
|
||||
peerConnection = requirePeerConnection();
|
||||
} catch (final PeerConnectionNotInitialized e) {
|
||||
Log.w(EXTENDED_LOGGING_TAG, "PeerConnection vanished before we could execute restart");
|
||||
return;
|
||||
}
|
||||
setIsReadyToReceiveIceCandidates(false);
|
||||
peerConnection.restartIce();
|
||||
}
|
||||
|
||||
public void setIsReadyToReceiveIceCandidates(final boolean ready) {
|
||||
|
@ -632,12 +633,15 @@ public class WebRTCWrapper {
|
|||
}
|
||||
|
||||
private ListenableFuture<SessionDescription> getLocalDescriptionFuture() {
|
||||
return Futures.submit(() -> {
|
||||
final SessionDescription description = requirePeerConnection().getLocalDescription();
|
||||
Log.d(EXTENDED_LOGGING_TAG, "local description:");
|
||||
logDescription(description);
|
||||
return description;
|
||||
},executorService);
|
||||
return Futures.submit(
|
||||
() -> {
|
||||
final SessionDescription description =
|
||||
requirePeerConnection().getLocalDescription();
|
||||
Log.d(EXTENDED_LOGGING_TAG, "local description:");
|
||||
logDescription(description);
|
||||
return description;
|
||||
},
|
||||
localDescriptionExecutorService);
|
||||
}
|
||||
|
||||
|
||||
|
@ -790,7 +794,7 @@ public class WebRTCWrapper {
|
|||
}
|
||||
|
||||
void execute(final Runnable command) {
|
||||
executorService.execute(command);
|
||||
this.executorService.execute(command);
|
||||
}
|
||||
|
||||
public void switchSpeakerPhonePreference(AppRTCAudioManager.SpeakerPhonePreference preference) {
|
||||
|
|
Loading…
Add table
Reference in a new issue