From 6b381c7456a995e4d866c30d308e5fd7a7670286 Mon Sep 17 00:00:00 2001 From: Taylor Brandstetter Date: Mon, 24 Aug 2020 13:28:47 -0700 Subject: [PATCH] Call SetVideoCodecSwitchingEnabled on every video media channel. It was only being called for the first video media channel; with unified plan SDP mode, it's possible to have multiple video media channels, one for each video m= section. Bug: webrtc:10795 Change-Id: I57fda9383d0f8803df1937ac5103d9ae354c0748 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/182404 Reviewed-by: Per Kjellander Commit-Queue: Taylor Cr-Commit-Position: refs/heads/master@{#32010} --- pc/peer_connection.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pc/peer_connection.cc b/pc/peer_connection.cc index 3665a82e03..8407d75f0c 100644 --- a/pc/peer_connection.cc +++ b/pc/peer_connection.cc @@ -4077,9 +4077,14 @@ RTCError PeerConnection::SetConfiguration( } if (modified_config.allow_codec_switching.has_value()) { - cricket::VideoMediaChannel* video_channel = video_media_channel(); - if (video_channel) { - video_channel->SetVideoCodecSwitchingEnabled( + for (const auto& transceiver : transceivers_) { + if (transceiver->media_type() != cricket::MEDIA_TYPE_VIDEO || + !transceiver->internal()->channel()) { + continue; + } + auto* video_channel = static_cast( + transceiver->internal()->channel()); + video_channel->media_channel()->SetVideoCodecSwitchingEnabled( *modified_config.allow_codec_switching); } }