Allow transceivers to be not found in more cases.

This fixes the case where a media section is rejected in an answer,
something that is done by SFUs, but not possible using transceiver.stop().

Bug: chromium:1134686
Change-Id: Ia33579070093ab70c4191710fd1dcb3ca377befd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/187349
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32363}
This commit is contained in:
Harald Alvestrand
2020-10-09 08:13:30 +00:00
committed by Commit Bot
parent 38e9b06151
commit 09bd9ba1f3
2 changed files with 66 additions and 8 deletions

View File

@ -2871,17 +2871,16 @@ RTCError SdpOfferAnswerHandler::UpdateTransceiversAndDataChannels(
old_remote_content =
&old_remote_description->description()->contents()[i];
}
// In the case where an m-section has completed its rejection,
// and is not being reused, we do not expect a transceiver.
if (old_local_content && old_local_content->rejected &&
old_remote_content && old_remote_content->rejected &&
new_content.rejected) {
continue;
}
auto transceiver_or_error =
AssociateTransceiver(source, new_session.GetType(), i, new_content,
old_local_content, old_remote_content);
if (!transceiver_or_error.ok()) {
// In the case where a transceiver is rejected locally, we don't
// expect to find a transceiver, but might find it in the case
// where state is still "stopping", not "stopped".
if (new_content.rejected) {
continue;
}
return transceiver_or_error.MoveError();
}
auto transceiver = transceiver_or_error.MoveValue();
@ -2946,8 +2945,9 @@ SdpOfferAnswerHandler::AssociateTransceiver(
transceiver = transceivers().FindByMLineIndex(mline_index);
}
if (!transceiver) {
// This may happen normally when media sections are rejected.
LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_PARAMETER,
"Unknown transceiver");
"Transceiver not found based on m-line index");
}
} else {
RTC_DCHECK_EQ(source, cricket::CS_REMOTE);