Add support for JSEP offer/answer with transceivers

This change adds support to PeerConnection's CreateOffer/
CreateAnswer/SetLocalDescription/SetRemoteDescription for
Unified Plan SDP mapping to/from RtpTransceivers. This behavior
is enabled using the kUnifiedPlan SDP semantics in the
PeerConnection configuration.

Bug: webrtc:7600
Change-Id: I4b44f5d3690887d387bf9c47eac00db8ec974571
Reviewed-on: https://webrtc-review.googlesource.com/28341
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Peter Thatcher <pthatcher@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21442}
This commit is contained in:
Steve Anton
2017-12-22 16:02:54 -08:00
committed by Commit Bot
parent 24de1735b7
commit dcc3c02468
10 changed files with 1518 additions and 155 deletions

View File

@ -1309,16 +1309,16 @@ SessionDescription* MediaSessionDescriptionFactory::CreateOffer(
// Iterate through the media description options, matching with existing media
// descriptions in |current_description|.
int msection_index = 0;
size_t msection_index = 0;
for (const MediaDescriptionOptions& media_description_options :
session_options.media_description_options) {
const ContentInfo* current_content = nullptr;
if (current_description &&
msection_index <
static_cast<int>(current_description->contents().size())) {
msection_index < current_description->contents().size()) {
current_content = &current_description->contents()[msection_index];
// Media type must match.
RTC_DCHECK(IsMediaContentOfType(current_content,
// Media type must match unless this media section is being recycled.
RTC_DCHECK(current_content->rejected ||
IsMediaContentOfType(current_content,
media_description_options.type));
}
switch (media_description_options.type) {
@ -1424,7 +1424,7 @@ SessionDescription* MediaSessionDescriptionFactory::CreateAnswer(
session_options.media_description_options.size());
// Iterate through the media description options, matching with existing
// media descriptions in |current_description|.
int msection_index = 0;
size_t msection_index = 0;
for (const MediaDescriptionOptions& media_description_options :
session_options.media_description_options) {
const ContentInfo* offer_content = &offer->contents()[msection_index];
@ -1435,8 +1435,7 @@ SessionDescription* MediaSessionDescriptionFactory::CreateAnswer(
RTC_DCHECK(media_description_options.mid == offer_content->name);
const ContentInfo* current_content = nullptr;
if (current_description &&
msection_index <
static_cast<int>(current_description->contents().size())) {
msection_index < current_description->contents().size()) {
current_content = &current_description->contents()[msection_index];
}
switch (media_description_options.type) {
@ -1802,8 +1801,8 @@ bool MediaSessionDescriptionFactory::AddAudioContentForOffer(
GetAudioCodecsForOffer(media_description_options.direction);
AudioCodecs filtered_codecs;
// Add the codecs from current content if exists.
if (current_content) {
// Add the codecs from current content if it exists and is not being recycled.
if (current_content && !current_content->rejected) {
RTC_CHECK(IsMediaContentOfType(current_content, MEDIA_TYPE_AUDIO));
const AudioContentDescription* acd =
current_content->media_description()->as_audio();
@ -1877,8 +1876,8 @@ bool MediaSessionDescriptionFactory::AddVideoContentForOffer(
&crypto_suites);
VideoCodecs filtered_codecs;
// Add the codecs from current content if exists.
if (current_content) {
// Add the codecs from current content if it exists and is not being recycled.
if (current_content && !current_content->rejected) {
RTC_CHECK(IsMediaContentOfType(current_content, MEDIA_TYPE_VIDEO));
const VideoContentDescription* vcd =
current_content->media_description()->as_video();
@ -2038,8 +2037,8 @@ bool MediaSessionDescriptionFactory::AddAudioContentForAnswer(
GetAudioCodecsForAnswer(offer_rtd, answer_rtd);
AudioCodecs filtered_codecs;
// Add the codecs from current content if exists.
if (current_content) {
// Add the codecs from current content if it exists and is not being recycled.
if (current_content && !current_content->rejected) {
RTC_CHECK(IsMediaContentOfType(current_content, MEDIA_TYPE_AUDIO));
const AudioContentDescription* acd =
current_content->media_description()->as_audio();
@ -2120,8 +2119,8 @@ bool MediaSessionDescriptionFactory::AddVideoContentForAnswer(
}
VideoCodecs filtered_codecs;
// Add the codecs from current content if exists.
if (current_content) {
// Add the codecs from current content if it exists and is not being recycled.
if (current_content && !current_content->rejected) {
RTC_CHECK(IsMediaContentOfType(current_content, MEDIA_TYPE_VIDEO));
const VideoContentDescription* vcd =
current_content->media_description()->as_video();