diff --git a/media/base/codec.cc b/media/base/codec.cc index 9ada18f956..5a67696fb0 100644 --- a/media/base/codec.cc +++ b/media/base/codec.cc @@ -387,11 +387,10 @@ bool HasTransportCc(const Codec& codec) { FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty)); } -const VideoCodec* FindMatchingCodec( - const std::vector& supported_codecs, - const VideoCodec& codec) { +const Codec* FindMatchingVideoCodec(const std::vector& supported_codecs, + const Codec& codec) { webrtc::SdpVideoFormat sdp_video_format{codec.name, codec.params}; - for (const VideoCodec& supported_codec : supported_codecs) { + for (const Codec& supported_codec : supported_codecs) { if (sdp_video_format.IsSameCodec( {supported_codec.name, supported_codec.params})) { return &supported_codec; @@ -400,12 +399,12 @@ const VideoCodec* FindMatchingCodec( return nullptr; } -std::vector FindAllMatchingCodecs( - const std::vector& supported_codecs, - const VideoCodec& codec) { - std::vector result; +std::vector FindAllMatchingCodecs( + const std::vector& supported_codecs, + const Codec& codec) { + std::vector result; webrtc::SdpVideoFormat sdp(codec.name, codec.params); - for (const VideoCodec& supported_codec : supported_codecs) { + for (const Codec& supported_codec : supported_codecs) { if (sdp.IsSameCodec({supported_codec.name, supported_codec.params})) { result.push_back(&supported_codec); } diff --git a/media/base/codec.h b/media/base/codec.h index b8ef22e4fb..53b674fe8e 100644 --- a/media/base/codec.h +++ b/media/base/codec.h @@ -217,14 +217,13 @@ bool HasTransportCc(const Codec& codec); // Returns the first codec in `supported_codecs` that matches `codec`, or // nullptr if no codec matches. -const VideoCodec* FindMatchingCodec( - const std::vector& supported_codecs, - const VideoCodec& codec); +const Codec* FindMatchingVideoCodec(const std::vector& supported_codecs, + const Codec& codec); // Returns all codecs in `supported_codecs` that matches `codec`. -std::vector FindAllMatchingCodecs( - const std::vector& supported_codecs, - const VideoCodec& codec); +std::vector FindAllMatchingCodecs( + const std::vector& supported_codecs, + const Codec& codec); RTC_EXPORT void AddH264ConstrainedBaselineProfileToSupportedFormats( std::vector* supported_formats); diff --git a/media/engine/webrtc_video_engine.cc b/media/engine/webrtc_video_engine.cc index 70bcb0735d..fad0f4fc55 100644 --- a/media/engine/webrtc_video_engine.cc +++ b/media/engine/webrtc_video_engine.cc @@ -2679,7 +2679,7 @@ bool WebRtcVideoReceiveChannel::GetChangedReceiverParameters( /*is_decoder_factory=*/true, /*include_rtx=*/true, call_->trials()); for (const VideoCodecSettings& mapped_codec : mapped_codecs) { - if (!FindMatchingCodec(local_supported_codecs, mapped_codec.codec)) { + if (!FindMatchingVideoCodec(local_supported_codecs, mapped_codec.codec)) { RTC_LOG(LS_ERROR) << "GetChangedReceiverParameters called with " "unsupported video codec: " << mapped_codec.codec.ToString(); diff --git a/media/engine/webrtc_video_engine_unittest.cc b/media/engine/webrtc_video_engine_unittest.cc index 2c44c47884..0f416aaeea 100644 --- a/media/engine/webrtc_video_engine_unittest.cc +++ b/media/engine/webrtc_video_engine_unittest.cc @@ -722,16 +722,17 @@ TEST_F(WebRtcVideoEngineTest, RtxCodecAddedForH264Codec) { // Now search for RTX codecs for them. Expect that they all have associated // RTX codecs. EXPECT_TRUE(HasRtxCodec( - codecs, FindMatchingCodec( + codecs, FindMatchingVideoCodec( codecs, cricket::CreateVideoCodec(h264_constrained_baseline)) ->id)); EXPECT_TRUE(HasRtxCodec( - codecs, FindMatchingCodec( + codecs, FindMatchingVideoCodec( codecs, cricket::CreateVideoCodec(h264_constrained_high)) ->id)); EXPECT_TRUE(HasRtxCodec( codecs, - FindMatchingCodec(codecs, cricket::CreateVideoCodec(h264_high))->id)); + FindMatchingVideoCodec(codecs, cricket::CreateVideoCodec(h264_high)) + ->id)); } #if defined(RTC_ENABLE_VP9) diff --git a/pc/media_session.cc b/pc/media_session.cc index 53c422f412..4f74870a5b 100644 --- a/pc/media_session.cc +++ b/pc/media_session.cc @@ -440,12 +440,11 @@ static void AddSimulcastToMediaDescription( // Adds a StreamParams for each SenderOptions in `sender_options` to // content_description. // `current_params` - All currently known StreamParams of any media type. -template static bool AddStreamParams(const std::vector& sender_options, const std::string& rtcp_cname, UniqueRandomIdGenerator* ssrc_generator, StreamParamsVec* current_streams, - MediaContentDescriptionImpl* content_description, + MediaContentDescription* content_description, const webrtc::FieldTrialsView& field_trials) { // SCTP streams are not negotiated using SDP/ContentDescriptions. if (IsSctpProtocol(content_description->protocol())) { @@ -712,18 +711,18 @@ static bool CreateContentOffer( } return true; } -template + static bool CreateMediaContentOffer( const MediaDescriptionOptions& media_description_options, const MediaSessionOptions& session_options, - const std::vector& codecs, + const std::vector& codecs, const SecurePolicy& secure_policy, const CryptoParamsVec* current_cryptos, const std::vector& crypto_suites, const RtpHeaderExtensions& rtp_extensions, UniqueRandomIdGenerator* ssrc_generator, StreamParamsVec* current_streams, - MediaContentDescriptionImpl* offer, + MediaContentDescription* offer, const webrtc::FieldTrialsView& field_trials) { offer->AddCodecs(codecs); if (!AddStreamParams(media_description_options.sender_options, @@ -1365,17 +1364,16 @@ static void StripCNCodecs(AudioCodecs* audio_codecs) { audio_codecs->end()); } -template static bool SetCodecsInAnswer( - const MediaContentDescriptionImpl* offer, - const std::vector& local_codecs, + const MediaContentDescription* offer, + const std::vector& local_codecs, const MediaDescriptionOptions& media_description_options, const MediaSessionOptions& session_options, UniqueRandomIdGenerator* ssrc_generator, StreamParamsVec* current_streams, - MediaContentDescriptionImpl* answer, + MediaContentDescription* answer, const webrtc::FieldTrialsView& field_trials) { - std::vector negotiated_codecs; + std::vector negotiated_codecs; NegotiateCodecs(local_codecs, offer->codecs(), &negotiated_codecs, media_description_options.codec_preferences.empty(), &field_trials);