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}
diff --git a/pc/sdp_offer_answer.cc b/pc/sdp_offer_answer.cc index 5dc5571..c6432a6 100644 --- a/pc/sdp_offer_answer.cc +++ b/pc/sdp_offer_answer.cc
@@ -2871,17 +2871,16 @@ 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 @@ 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);