From 7fa8d4651629505fa9ae4f8477fec41a96ff7552 Mon Sep 17 00:00:00 2001 From: Tomas Gunnarsson Date: Fri, 16 Apr 2021 14:28:26 +0200 Subject: [PATCH] Slight code clarification in RemoveStoppedTransceivers. There's no change in functionality, which was verified by adding an 'else' catch-all clause in the loop with an RTC_NOTREACHED() statement. See patchset #3. This is mostly a cosmetic change that modifies the loop such that it's guaranteed that Remove() is always called for transceivers whose state is "stopped" and there's just one place where Remove() is called. Bug: none Change-Id: Iffe237bb2f08e5e6ef316a6b76c4b183df671f3b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215232 Reviewed-by: Harald Alvestrand Commit-Queue: Harald Alvestrand Cr-Commit-Position: refs/heads/master@{#33765} --- pc/sdp_offer_answer.cc | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pc/sdp_offer_answer.cc b/pc/sdp_offer_answer.cc index 66a51b7559..cd477f110f 100644 --- a/pc/sdp_offer_answer.cc +++ b/pc/sdp_offer_answer.cc @@ -4275,20 +4275,16 @@ void SdpOfferAnswerHandler::RemoveStoppedTransceivers() { if ((local_content && local_content->rejected) || (remote_content && remote_content->rejected)) { RTC_LOG(LS_INFO) << "Dissociating transceiver" - << " since the media section is being recycled."; + " since the media section is being recycled."; transceiver->internal()->set_mid(absl::nullopt); transceiver->internal()->set_mline_index(absl::nullopt); - transceivers()->Remove(transceiver); - continue; - } - if (!local_content && !remote_content) { + } else if (!local_content && !remote_content) { // TODO(bugs.webrtc.org/11973): Consider if this should be removed already // See https://github.com/w3c/webrtc-pc/issues/2576 RTC_LOG(LS_INFO) << "Dropping stopped transceiver that was never associated"; - transceivers()->Remove(transceiver); - continue; } + transceivers()->Remove(transceiver); } }