The bug introduces the wrong value of channels for video codecs when calling getRtpSenderCapabilities() or getRtpReceiverCapabilities(). The default value for channels should be -1.
void FlutterPeerConnection::RtpTransceiverSetCodecPreferences()
auto codecNumChannels = findInt(codecMap, "channels");
if (codecNumChannels != -1)
codecCapability->set_channels(codecNumChannels);
RTCError VerifyCodecPreferences(const std::vector<RtpCodecCapability>& codecs,
const std::vector<T>& send_codecs,
const std::vector<T>& recv_codecs) {
// If the intersection between codecs and
// RTCRtpSender.getCapabilities(kind).codecs or the intersection between
// codecs and RTCRtpReceiver.getCapabilities(kind).codecs only contains RTX,
// RED or FEC codecs or is an empty set, throw InvalidModificationError.
// This ensures that we always have something to offer, regardless of
// transceiver.direction.
if (!absl::c_any_of(codecs, [&recv_codecs](const RtpCodecCapability& codec) {
return codec.name != cricket::kRtxCodecName &&
codec.name != cricket::kRedCodecName &&
codec.name != cricket::kFlexfecCodecName &&
absl::c_any_of(recv_codecs, [&codec](const T& recv_codec) {
return recv_codec.MatchesCapability(codec);
});
})) {
return RTCError(RTCErrorType::INVALID_MODIFICATION,
"Invalid codec preferences: Missing codec from recv "
"codec capabilities.");
}
The bug introduces the wrong value of
channels
for video codecs when callinggetRtpSenderCapabilities()
orgetRtpReceiverCapabilities()
. The default value forchannels
should be -1.The bug then prevents
setCodecPreferences()
from being applied since thechannels
does not match the original one. https://github.com/flutter-webrtc/flutter-webrtc/blob/main/common/cpp/src/flutter_peerconnection.cc#L796