rename "sdp" to description in a few places
renames the RTCSessionDescription object from "ѕdp" to "desc" in a few places. The term SDP should generally refer to the blob of text described in RFC 4566 while the RTCSessionDescription specified in https://w3c.github.io/webrtc-pc/#rtcsessiondescription-class contains both a type and a sdp. BUG=None Change-Id: Iacf332d02b03134e49c2b4147dc5725affa89741 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183882 Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Tommi <tommi@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32080}
This commit is contained in:
parent
3dc4780d8e
commit
dd68063976
@ -786,7 +786,7 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoteDescription(final SessionDescription sdp) {
|
||||
public void onRemoteDescription(final SessionDescription desc) {
|
||||
final long delta = System.currentTimeMillis() - callStartedTimeMs;
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
@ -795,8 +795,8 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
|
||||
Log.e(TAG, "Received remote SDP for non-initilized peer connection.");
|
||||
return;
|
||||
}
|
||||
logAndToast("Received remote " + sdp.type + ", delay=" + delta + "ms");
|
||||
peerConnectionClient.setRemoteDescription(sdp);
|
||||
logAndToast("Received remote " + desc.type + ", delay=" + delta + "ms");
|
||||
peerConnectionClient.setRemoteDescription(desc);
|
||||
if (!signalingParameters.initiator) {
|
||||
logAndToast("Creating ANSWER...");
|
||||
// Create answer. Answer SDP will be sent to offering client in
|
||||
@ -856,17 +856,17 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
|
||||
// All callbacks are invoked from peer connection client looper thread and
|
||||
// are routed to UI thread.
|
||||
@Override
|
||||
public void onLocalDescription(final SessionDescription sdp) {
|
||||
public void onLocalDescription(final SessionDescription desc) {
|
||||
final long delta = System.currentTimeMillis() - callStartedTimeMs;
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (appRtcClient != null) {
|
||||
logAndToast("Sending " + sdp.type + ", delay=" + delta + "ms");
|
||||
logAndToast("Sending " + desc.type + ", delay=" + delta + "ms");
|
||||
if (signalingParameters.initiator) {
|
||||
appRtcClient.sendOfferSdp(sdp);
|
||||
appRtcClient.sendOfferSdp(desc);
|
||||
} else {
|
||||
appRtcClient.sendAnswerSdp(sdp);
|
||||
appRtcClient.sendAnswerSdp(desc);
|
||||
}
|
||||
}
|
||||
if (peerConnectionParameters.videoMaxBitrate > 0) {
|
||||
|
||||
@ -152,8 +152,7 @@ public class PeerConnectionClient {
|
||||
@Nullable
|
||||
private List<IceCandidate> queuedRemoteCandidates;
|
||||
private boolean isInitiator;
|
||||
@Nullable
|
||||
private SessionDescription localSdp; // either offer or answer SDP
|
||||
@Nullable private SessionDescription localDescription; // either offer or answer description
|
||||
@Nullable
|
||||
private VideoCapturer videoCapturer;
|
||||
// enableVideo is set to true if video should be rendered and sent.
|
||||
@ -843,25 +842,24 @@ public class PeerConnectionClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void setRemoteDescription(final SessionDescription sdp) {
|
||||
public void setRemoteDescription(final SessionDescription desc) {
|
||||
executor.execute(() -> {
|
||||
if (peerConnection == null || isError) {
|
||||
return;
|
||||
}
|
||||
String sdpDescription = sdp.description;
|
||||
String sdp = desc.description;
|
||||
if (preferIsac) {
|
||||
sdpDescription = preferCodec(sdpDescription, AUDIO_CODEC_ISAC, true);
|
||||
sdp = preferCodec(sdp, AUDIO_CODEC_ISAC, true);
|
||||
}
|
||||
if (isVideoCallEnabled()) {
|
||||
sdpDescription =
|
||||
preferCodec(sdpDescription, getSdpVideoCodecName(peerConnectionParameters), false);
|
||||
sdp = preferCodec(sdp, getSdpVideoCodecName(peerConnectionParameters), false);
|
||||
}
|
||||
if (peerConnectionParameters.audioStartBitrate > 0) {
|
||||
sdpDescription = setStartBitrate(
|
||||
AUDIO_CODEC_OPUS, false, sdpDescription, peerConnectionParameters.audioStartBitrate);
|
||||
sdp = setStartBitrate(
|
||||
AUDIO_CODEC_OPUS, false, sdp, peerConnectionParameters.audioStartBitrate);
|
||||
}
|
||||
Log.d(TAG, "Set remote SDP.");
|
||||
SessionDescription sdpRemote = new SessionDescription(sdp.type, sdpDescription);
|
||||
SessionDescription sdpRemote = new SessionDescription(desc.type, sdp);
|
||||
peerConnection.setRemoteDescription(sdpObserver, sdpRemote);
|
||||
});
|
||||
}
|
||||
@ -1002,8 +1000,8 @@ public class PeerConnectionClient {
|
||||
|
||||
@SuppressWarnings("StringSplitter")
|
||||
private static String setStartBitrate(
|
||||
String codec, boolean isVideoCodec, String sdpDescription, int bitrateKbps) {
|
||||
String[] lines = sdpDescription.split("\r\n");
|
||||
String codec, boolean isVideoCodec, String sdp, int bitrateKbps) {
|
||||
String[] lines = sdp.split("\r\n");
|
||||
int rtpmapLineIndex = -1;
|
||||
boolean sdpFormatUpdated = false;
|
||||
String codecRtpMap = null;
|
||||
@ -1021,7 +1019,7 @@ public class PeerConnectionClient {
|
||||
}
|
||||
if (codecRtpMap == null) {
|
||||
Log.w(TAG, "No rtpmap for " + codec + " codec");
|
||||
return sdpDescription;
|
||||
return sdp;
|
||||
}
|
||||
Log.d(TAG, "Found " + codec + " rtpmap " + codecRtpMap + " at " + lines[rtpmapLineIndex]);
|
||||
|
||||
@ -1112,12 +1110,12 @@ public class PeerConnectionClient {
|
||||
return joinString(newLineParts, " ", false /* delimiterAtEnd */);
|
||||
}
|
||||
|
||||
private static String preferCodec(String sdpDescription, String codec, boolean isAudio) {
|
||||
final String[] lines = sdpDescription.split("\r\n");
|
||||
private static String preferCodec(String sdp, String codec, boolean isAudio) {
|
||||
final String[] lines = sdp.split("\r\n");
|
||||
final int mLineIndex = findMediaDescriptionLine(isAudio, lines);
|
||||
if (mLineIndex == -1) {
|
||||
Log.w(TAG, "No mediaDescription line, so can't prefer " + codec);
|
||||
return sdpDescription;
|
||||
return sdp;
|
||||
}
|
||||
// A list with all the payload types with name |codec|. The payload types are integers in the
|
||||
// range 96-127, but they are stored as strings here.
|
||||
@ -1132,12 +1130,12 @@ public class PeerConnectionClient {
|
||||
}
|
||||
if (codecPayloadTypes.isEmpty()) {
|
||||
Log.w(TAG, "No payload types with name " + codec);
|
||||
return sdpDescription;
|
||||
return sdp;
|
||||
}
|
||||
|
||||
final String newMLine = movePayloadTypesToFront(codecPayloadTypes, lines[mLineIndex]);
|
||||
if (newMLine == null) {
|
||||
return sdpDescription;
|
||||
return sdp;
|
||||
}
|
||||
Log.d(TAG, "Change media description from: " + lines[mLineIndex] + " to " + newMLine);
|
||||
lines[mLineIndex] = newMLine;
|
||||
@ -1301,25 +1299,24 @@ public class PeerConnectionClient {
|
||||
// as well as adding remote ICE candidates once the answer SDP is set.
|
||||
private class SDPObserver implements SdpObserver {
|
||||
@Override
|
||||
public void onCreateSuccess(final SessionDescription origSdp) {
|
||||
if (localSdp != null) {
|
||||
public void onCreateSuccess(final SessionDescription desc) {
|
||||
if (localDescription != null) {
|
||||
reportError("Multiple SDP create.");
|
||||
return;
|
||||
}
|
||||
String sdpDescription = origSdp.description;
|
||||
String sdp = desc.description;
|
||||
if (preferIsac) {
|
||||
sdpDescription = preferCodec(sdpDescription, AUDIO_CODEC_ISAC, true);
|
||||
sdp = preferCodec(sdp, AUDIO_CODEC_ISAC, true);
|
||||
}
|
||||
if (isVideoCallEnabled()) {
|
||||
sdpDescription =
|
||||
preferCodec(sdpDescription, getSdpVideoCodecName(peerConnectionParameters), false);
|
||||
sdp = preferCodec(sdp, getSdpVideoCodecName(peerConnectionParameters), false);
|
||||
}
|
||||
final SessionDescription sdp = new SessionDescription(origSdp.type, sdpDescription);
|
||||
localSdp = sdp;
|
||||
final SessionDescription newDesc = new SessionDescription(desc.type, sdp);
|
||||
localDescription = newDesc;
|
||||
executor.execute(() -> {
|
||||
if (peerConnection != null && !isError) {
|
||||
Log.d(TAG, "Set local SDP from " + sdp.type);
|
||||
peerConnection.setLocalDescription(sdpObserver, sdp);
|
||||
Log.d(TAG, "Set local SDP from " + desc.type);
|
||||
peerConnection.setLocalDescription(sdpObserver, newDesc);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -1336,7 +1333,7 @@ public class PeerConnectionClient {
|
||||
if (peerConnection.getRemoteDescription() == null) {
|
||||
// We've just set our local SDP so time to send it.
|
||||
Log.d(TAG, "Local SDP set succesfully");
|
||||
events.onLocalDescription(localSdp);
|
||||
events.onLocalDescription(localDescription);
|
||||
} else {
|
||||
// We've just set remote description, so drain remote
|
||||
// and send local ICE candidates.
|
||||
@ -1350,7 +1347,7 @@ public class PeerConnectionClient {
|
||||
// We've just set our local SDP so time to send it, drain
|
||||
// remote and send local ICE candidates.
|
||||
Log.d(TAG, "Local SDP set succesfully");
|
||||
events.onLocalDescription(localSdp);
|
||||
events.onLocalDescription(localDescription);
|
||||
drainCandidates();
|
||||
} else {
|
||||
// We've just set remote SDP - do nothing for now -
|
||||
|
||||
@ -77,9 +77,9 @@ public class PeerConnectionClientTest implements PeerConnectionEvents {
|
||||
private ExecutorService signalingExecutor;
|
||||
private boolean isClosed;
|
||||
private boolean isIceConnected;
|
||||
private SessionDescription localSdp;
|
||||
private SessionDescription localDesc;
|
||||
private List<IceCandidate> iceCandidates = new ArrayList<>();
|
||||
private final Object localSdpEvent = new Object();
|
||||
private final Object localDescEvent = new Object();
|
||||
private final Object iceCandidateEvent = new Object();
|
||||
private final Object iceConnectedEvent = new Object();
|
||||
private final Object closeEvent = new Object();
|
||||
@ -133,11 +133,11 @@ public class PeerConnectionClientTest implements PeerConnectionEvents {
|
||||
|
||||
// Peer connection events implementation.
|
||||
@Override
|
||||
public void onLocalDescription(SessionDescription sdp) {
|
||||
Log.d(TAG, "LocalSDP type: " + sdp.type);
|
||||
synchronized (localSdpEvent) {
|
||||
localSdp = sdp;
|
||||
localSdpEvent.notifyAll();
|
||||
public void onLocalDescription(SessionDescription desc) {
|
||||
Log.d(TAG, "Local description type: " + desc.type);
|
||||
synchronized (localDescEvent) {
|
||||
localDesc = desc;
|
||||
localDescEvent.notifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,15 +211,15 @@ public class PeerConnectionClientTest implements PeerConnectionEvents {
|
||||
public void onPeerConnectionStatsReady(StatsReport[] reports) {}
|
||||
|
||||
// Helper wait functions.
|
||||
private boolean waitForLocalSDP(int timeoutMs) throws InterruptedException {
|
||||
synchronized (localSdpEvent) {
|
||||
private boolean waitForLocalDescription(int timeoutMs) throws InterruptedException {
|
||||
synchronized (localDescEvent) {
|
||||
final long endTimeMs = System.currentTimeMillis() + timeoutMs;
|
||||
while (localSdp == null) {
|
||||
while (localDesc == null) {
|
||||
final long waitTimeMs = endTimeMs - System.currentTimeMillis();
|
||||
if (waitTimeMs < 0) {
|
||||
return false;
|
||||
}
|
||||
localSdpEvent.wait(waitTimeMs);
|
||||
localDescEvent.wait(waitTimeMs);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -369,8 +369,8 @@ public class PeerConnectionClientTest implements PeerConnectionEvents {
|
||||
createParametersForVideoCall(VIDEO_CODEC_VP8),
|
||||
createCameraCapturer(false /* captureToTexture */));
|
||||
|
||||
// Wait for local SDP and ice candidates set events.
|
||||
assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT));
|
||||
// Wait for local description and ice candidates set events.
|
||||
assertTrue("Local description was not set.", waitForLocalDescription(WAIT_TIMEOUT));
|
||||
assertTrue("ICE candidates were not generated.", waitForIceCandidates(WAIT_TIMEOUT));
|
||||
|
||||
// Check that local video frames were rendered.
|
||||
@ -397,11 +397,11 @@ public class PeerConnectionClientTest implements PeerConnectionEvents {
|
||||
}
|
||||
pcClient = createPeerConnectionClient(localRenderer, remoteRenderer, parameters, videoCapturer);
|
||||
|
||||
// Wait for local SDP, rename it to answer and set as remote SDP.
|
||||
assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT));
|
||||
SessionDescription remoteSdp = new SessionDescription(
|
||||
SessionDescription.Type.fromCanonicalForm("answer"), localSdp.description);
|
||||
pcClient.setRemoteDescription(remoteSdp);
|
||||
// Wait for local description, change type to answer and set as remote description.
|
||||
assertTrue("Local description was not set.", waitForLocalDescription(WAIT_TIMEOUT));
|
||||
SessionDescription remoteDescription = new SessionDescription(
|
||||
SessionDescription.Type.fromCanonicalForm("answer"), localDesc.description);
|
||||
pcClient.setRemoteDescription(remoteDescription);
|
||||
|
||||
// Wait for ICE connection.
|
||||
assertTrue("ICE connection failure.", waitForIceConnected(ICE_CONNECTION_WAIT_TIMEOUT));
|
||||
@ -520,11 +520,11 @@ public class PeerConnectionClientTest implements PeerConnectionEvents {
|
||||
createParametersForVideoCall(VIDEO_CODEC_VP8),
|
||||
createCameraCapturer(false /* captureToTexture */));
|
||||
|
||||
// Wait for local SDP, rename it to answer and set as remote SDP.
|
||||
assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT));
|
||||
SessionDescription remoteSdp = new SessionDescription(
|
||||
SessionDescription.Type.fromCanonicalForm("answer"), localSdp.description);
|
||||
pcClient.setRemoteDescription(remoteSdp);
|
||||
// Wait for local description, set type to answer and set as remote description.
|
||||
assertTrue("Local description was not set.", waitForLocalDescription(WAIT_TIMEOUT));
|
||||
SessionDescription remoteDescription = new SessionDescription(
|
||||
SessionDescription.Type.fromCanonicalForm("answer"), localDesc.description);
|
||||
pcClient.setRemoteDescription(remoteDescription);
|
||||
|
||||
// Wait for ICE connection.
|
||||
assertTrue("ICE connection failure.", waitForIceConnected(ICE_CONNECTION_WAIT_TIMEOUT));
|
||||
@ -568,11 +568,11 @@ public class PeerConnectionClientTest implements PeerConnectionEvents {
|
||||
createParametersForVideoCall(VIDEO_CODEC_VP8),
|
||||
createCameraCapturer(false /* captureToTexture */));
|
||||
|
||||
// Wait for local SDP, rename it to answer and set as remote SDP.
|
||||
assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT));
|
||||
SessionDescription remoteSdp = new SessionDescription(
|
||||
SessionDescription.Type.fromCanonicalForm("answer"), localSdp.description);
|
||||
pcClient.setRemoteDescription(remoteSdp);
|
||||
// Wait for local description, set type to answer and set as remote description.
|
||||
assertTrue("Local description was not set.", waitForLocalDescription(WAIT_TIMEOUT));
|
||||
SessionDescription remoteDescription = new SessionDescription(
|
||||
SessionDescription.Type.fromCanonicalForm("answer"), localDesc.description);
|
||||
pcClient.setRemoteDescription(remoteDescription);
|
||||
|
||||
// Wait for ICE connection.
|
||||
assertTrue("ICE connection failure.", waitForIceConnected(ICE_CONNECTION_WAIT_TIMEOUT));
|
||||
@ -617,11 +617,11 @@ public class PeerConnectionClientTest implements PeerConnectionEvents {
|
||||
createParametersForVideoCall(VIDEO_CODEC_VP8),
|
||||
createCameraCapturer(false /* captureToTexture */));
|
||||
|
||||
// Wait for local SDP, rename it to answer and set as remote SDP.
|
||||
assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT));
|
||||
SessionDescription remoteSdp = new SessionDescription(
|
||||
SessionDescription.Type.fromCanonicalForm("answer"), localSdp.description);
|
||||
pcClient.setRemoteDescription(remoteSdp);
|
||||
// Wait for local description, set type to answer and set as remote description.
|
||||
assertTrue("Local description was not set.", waitForLocalDescription(WAIT_TIMEOUT));
|
||||
SessionDescription remoteDescription = new SessionDescription(
|
||||
SessionDescription.Type.fromCanonicalForm("answer"), localDesc.description);
|
||||
pcClient.setRemoteDescription(remoteDescription);
|
||||
|
||||
// Wait for ICE connection.
|
||||
assertTrue("ICE connection failure.", waitForIceConnected(ICE_CONNECTION_WAIT_TIMEOUT));
|
||||
|
||||
@ -336,10 +336,10 @@ bool SimplePeerConnection::SetRemoteDescription(const char* type,
|
||||
return false;
|
||||
|
||||
std::string remote_desc(sdp);
|
||||
std::string sdp_type(type);
|
||||
std::string desc_type(type);
|
||||
webrtc::SdpParseError error;
|
||||
webrtc::SessionDescriptionInterface* session_description(
|
||||
webrtc::CreateSessionDescription(sdp_type, remote_desc, &error));
|
||||
webrtc::CreateSessionDescription(desc_type, remote_desc, &error));
|
||||
if (!session_description) {
|
||||
RTC_LOG(WARNING) << "Can't parse received session description message. "
|
||||
"SdpParseError was: "
|
||||
|
||||
@ -7666,7 +7666,7 @@ void PeerConnection::GenerateNegotiationNeededEvent() {
|
||||
Observer()->OnNegotiationNeededEvent(negotiation_needed_event_id_);
|
||||
}
|
||||
|
||||
RTCError PeerConnection::Rollback(SdpType sdp_type) {
|
||||
RTCError PeerConnection::Rollback(SdpType desc_type) {
|
||||
auto state = signaling_state();
|
||||
if (state != PeerConnectionInterface::kHaveLocalOffer &&
|
||||
state != PeerConnectionInterface::kHaveRemoteOffer) {
|
||||
@ -7749,7 +7749,7 @@ RTCError PeerConnection::Rollback(SdpType sdp_type) {
|
||||
|
||||
// The assumption is that in case of implicit rollback UpdateNegotiationNeeded
|
||||
// gets called in SetRemoteDescription.
|
||||
if (sdp_type == SdpType::kRollback) {
|
||||
if (desc_type == SdpType::kRollback) {
|
||||
UpdateNegotiationNeeded();
|
||||
if (is_negotiation_needed_) {
|
||||
// Legacy version.
|
||||
|
||||
@ -1143,8 +1143,8 @@ class PeerConnection : public PeerConnectionInternal,
|
||||
void OnOperationsChainEmpty();
|
||||
void GenerateNegotiationNeededEvent();
|
||||
|
||||
// | sdp_type | is the type of the SDP that caused the rollback.
|
||||
RTCError Rollback(SdpType sdp_type);
|
||||
// | desc_type | is the type of the description that caused the rollback.
|
||||
RTCError Rollback(SdpType desc_type);
|
||||
|
||||
// Storing the factory as a scoped reference pointer ensures that the memory
|
||||
// in the PeerConnectionFactoryImpl remains available as long as the
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user