mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-15 23:01:21 +01:00
Remove more codec-related templating
BUG=webrtc:15214 Change-Id: I719de4ef2b9c98a01b14f8f292098f19baa0d925 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/321341 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Philipp Hancke <phancke@microsoft.com> Reviewed-by: Florent Castelli <orphis@webrtc.org> Cr-Commit-Position: refs/heads/main@{#40809}
This commit is contained in:
parent
7829daf245
commit
bfc2a3553d
5 changed files with 26 additions and 29 deletions
|
@ -387,11 +387,10 @@ bool HasTransportCc(const Codec& codec) {
|
|||
FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty));
|
||||
}
|
||||
|
||||
const VideoCodec* FindMatchingCodec(
|
||||
const std::vector<VideoCodec>& supported_codecs,
|
||||
const VideoCodec& codec) {
|
||||
const Codec* FindMatchingVideoCodec(const std::vector<Codec>& 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<const VideoCodec*> FindAllMatchingCodecs(
|
||||
const std::vector<VideoCodec>& supported_codecs,
|
||||
const VideoCodec& codec) {
|
||||
std::vector<const VideoCodec*> result;
|
||||
std::vector<const Codec*> FindAllMatchingCodecs(
|
||||
const std::vector<Codec>& supported_codecs,
|
||||
const Codec& codec) {
|
||||
std::vector<const Codec*> 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);
|
||||
}
|
||||
|
|
|
@ -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<VideoCodec>& supported_codecs,
|
||||
const VideoCodec& codec);
|
||||
const Codec* FindMatchingVideoCodec(const std::vector<Codec>& supported_codecs,
|
||||
const Codec& codec);
|
||||
|
||||
// Returns all codecs in `supported_codecs` that matches `codec`.
|
||||
std::vector<const VideoCodec*> FindAllMatchingCodecs(
|
||||
const std::vector<VideoCodec>& supported_codecs,
|
||||
const VideoCodec& codec);
|
||||
std::vector<const Codec*> FindAllMatchingCodecs(
|
||||
const std::vector<Codec>& supported_codecs,
|
||||
const Codec& codec);
|
||||
|
||||
RTC_EXPORT void AddH264ConstrainedBaselineProfileToSupportedFormats(
|
||||
std::vector<webrtc::SdpVideoFormat>* supported_formats);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 <class C>
|
||||
static bool AddStreamParams(const std::vector<SenderOptions>& sender_options,
|
||||
const std::string& rtcp_cname,
|
||||
UniqueRandomIdGenerator* ssrc_generator,
|
||||
StreamParamsVec* current_streams,
|
||||
MediaContentDescriptionImpl<C>* 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 <class C>
|
||||
|
||||
static bool CreateMediaContentOffer(
|
||||
const MediaDescriptionOptions& media_description_options,
|
||||
const MediaSessionOptions& session_options,
|
||||
const std::vector<C>& codecs,
|
||||
const std::vector<Codec>& codecs,
|
||||
const SecurePolicy& secure_policy,
|
||||
const CryptoParamsVec* current_cryptos,
|
||||
const std::vector<std::string>& crypto_suites,
|
||||
const RtpHeaderExtensions& rtp_extensions,
|
||||
UniqueRandomIdGenerator* ssrc_generator,
|
||||
StreamParamsVec* current_streams,
|
||||
MediaContentDescriptionImpl<C>* 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 <class C>
|
||||
static bool SetCodecsInAnswer(
|
||||
const MediaContentDescriptionImpl<C>* offer,
|
||||
const std::vector<C>& local_codecs,
|
||||
const MediaContentDescription* offer,
|
||||
const std::vector<Codec>& local_codecs,
|
||||
const MediaDescriptionOptions& media_description_options,
|
||||
const MediaSessionOptions& session_options,
|
||||
UniqueRandomIdGenerator* ssrc_generator,
|
||||
StreamParamsVec* current_streams,
|
||||
MediaContentDescriptionImpl<C>* answer,
|
||||
MediaContentDescription* answer,
|
||||
const webrtc::FieldTrialsView& field_trials) {
|
||||
std::vector<C> negotiated_codecs;
|
||||
std::vector<Codec> negotiated_codecs;
|
||||
NegotiateCodecs(local_codecs, offer->codecs(), &negotiated_codecs,
|
||||
media_description_options.codec_preferences.empty(),
|
||||
&field_trials);
|
||||
|
|
Loading…
Reference in a new issue