Use local codec parameters in the answer.

Previously when creating an answer, we used the codecs from the remote list
to get correctly mapped codec id, but the side effect is that we also used
the remote codec parameters which is wrong.

With this change, we use the local codecs with local parameters and the
|NegotiateCodecs| method will take care of the codec id mapping.

Bug: webrtc:8550
Change-Id: Ib7b2fe5f6ed3a72c58cf5df8bf2c1d00476c141c
Reviewed-on: https://webrtc-review.googlesource.com/25285
Reviewed-by: Peter Thatcher <pthatcher@webrtc.org>
Commit-Queue: Zhi Huang <zhihuang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20843}
This commit is contained in:
Zhi Huang
2017-11-22 13:20:02 -08:00
committed by Commit Bot
parent 760b2b158e
commit 6f36747fb1
2 changed files with 66 additions and 10 deletions

View File

@ -2119,15 +2119,14 @@ bool MediaSessionDescriptionFactory::AddAudioContentForAnswer(
}
}
// Add other supported audio codecs.
AudioCodec found_codec;
for (const AudioCodec& codec : supported_audio_codecs) {
if (FindMatchingCodec<AudioCodec>(supported_audio_codecs, audio_codecs,
codec, &found_codec) &&
codec, nullptr) &&
!FindMatchingCodec<AudioCodec>(supported_audio_codecs, filtered_codecs,
codec, nullptr)) {
// Use the |found_codec| from |audio_codecs| because it has the correctly
// mapped payload type.
filtered_codecs.push_back(found_codec);
// We should use the local codec with local parameters and the codec id
// would be correctly mapped in |NegotiateCodecs|.
filtered_codecs.push_back(codec);
}
}
@ -2203,15 +2202,14 @@ bool MediaSessionDescriptionFactory::AddVideoContentForAnswer(
}
}
// Add other supported video codecs.
VideoCodec found_codec;
for (const VideoCodec& codec : video_codecs_) {
if (FindMatchingCodec<VideoCodec>(video_codecs_, video_codecs, codec,
&found_codec) &&
nullptr) &&
!FindMatchingCodec<VideoCodec>(video_codecs_, filtered_codecs, codec,
nullptr)) {
// Use the |found_codec| from |video_codecs| because it has the correctly
// mapped payload type.
filtered_codecs.push_back(found_codec);
// We should use the local codec with local parameters and the codec id
// would be correctly mapped in |NegotiateCodecs|.
filtered_codecs.push_back(codec);
}
}