chromium/third_party/webrtc/media/base/codec.cc

/*
 *  Copyright (c) 2004 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#include "media/base/codec.h"

#include <algorithm>
#include <cstddef>
#include <iterator>
#include <string>
#include <vector>

#include "absl/algorithm/container.h"
#include "absl/strings/match.h"
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_format.h"
#include "api/media_types.h"
#include "api/rtp_parameters.h"
#include "api/video_codecs/av1_profile.h"
#include "api/video_codecs/h264_profile_level_id.h"
#include "api/video_codecs/sdp_video_format.h"
#ifdef RTC_ENABLE_H265
#include "api/video_codecs/h265_profile_tier_level.h"
#endif
#include "api/video_codecs/vp9_profile.h"
#include "media/base/media_constants.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/string_encode.h"
#include "rtc_base/strings/string_builder.h"

namespace cricket {
namespace {

// TODO(bugs.webrtc.org/15847): remove code duplication of IsSameCodecSpecific
// in api/video_codecs/sdp_video_format.cc
std::string GetFmtpParameterOrDefault(const webrtc::CodecParameterMap& params,
                                      const std::string& name,
                                      const std::string& default_value) {}

std::string H264GetPacketizationModeOrDefault(
    const webrtc::CodecParameterMap& params) {}

bool H264IsSamePacketizationMode(const webrtc::CodecParameterMap& left,
                                 const webrtc::CodecParameterMap& right) {}

std::string AV1GetTierOrDefault(const webrtc::CodecParameterMap& params) {}

bool AV1IsSameTier(const webrtc::CodecParameterMap& left,
                   const webrtc::CodecParameterMap& right) {}

std::string AV1GetLevelIdxOrDefault(const webrtc::CodecParameterMap& params) {}

bool AV1IsSameLevelIdx(const webrtc::CodecParameterMap& left,
                       const webrtc::CodecParameterMap& right) {}

#ifdef RTC_ENABLE_H265
std::string GetH265TxModeOrDefault(const webrtc::CodecParameterMap& params) {
  // If TxMode is not present, a value of "SRST" must be inferred.
  // https://tools.ietf.org/html/[email protected]
  return GetFmtpParameterOrDefault(params, kH265FmtpTxMode, "SRST");
}

bool IsSameH265TxMode(const webrtc::CodecParameterMap& left,
                      const webrtc::CodecParameterMap& right) {
  return absl::EqualsIgnoreCase(GetH265TxModeOrDefault(left),
                                GetH265TxModeOrDefault(right));
}
#endif

// Some (video) codecs are actually families of codecs and rely on parameters
// to distinguish different incompatible family members.
bool IsSameCodecSpecific(const std::string& name1,
                         const webrtc::CodecParameterMap& params1,
                         const std::string& name2,
                         const webrtc::CodecParameterMap& params2) {}

}  // namespace

FeedbackParams::FeedbackParams() = default;
FeedbackParams::~FeedbackParams() = default;

bool FeedbackParam::operator==(const FeedbackParam& other) const {}

bool FeedbackParams::operator==(const FeedbackParams& other) const {}

bool FeedbackParams::Has(const FeedbackParam& param) const {}

void FeedbackParams::Add(const FeedbackParam& param) {}

void FeedbackParams::Intersect(const FeedbackParams& from) {}

bool FeedbackParams::HasDuplicateEntries() const {}

Codec::Codec(Type type, int id, const std::string& name, int clockrate)
    :{}
Codec::Codec(Type type,
             int id,
             const std::string& name,
             int clockrate,
             size_t channels)
    :{}

Codec::Codec(Type type) :{}

Codec::Codec(const webrtc::SdpAudioFormat& c)
    :{}

Codec::Codec(const webrtc::SdpVideoFormat& c)
    :{}

Codec::Codec(const Codec& c) = default;
Codec::Codec(Codec&& c) = default;
Codec::~Codec() = default;
Codec& Codec::operator=(const Codec& c) = default;
Codec& Codec::operator=(Codec&& c) = default;

bool Codec::operator==(const Codec& c) const {}

bool Codec::Matches(const Codec& codec) const {}

bool Codec::MatchesRtpCodec(const webrtc::RtpCodec& codec_capability) const {}

bool Codec::GetParam(const std::string& name, std::string* out) const {}

bool Codec::GetParam(const std::string& name, int* out) const {}

void Codec::SetParam(const std::string& name, const std::string& value) {}

void Codec::SetParam(const std::string& name, int value) {}

bool Codec::RemoveParam(const std::string& name) {}

void Codec::AddFeedbackParam(const FeedbackParam& param) {}

bool Codec::HasFeedbackParam(const FeedbackParam& param) const {}

void Codec::IntersectFeedbackParams(const Codec& other) {}

webrtc::RtpCodecParameters Codec::ToCodecParameters() const {}

bool Codec::IsMediaCodec() const {}

bool Codec::IsResiliencyCodec() const {}

Codec::ResiliencyType Codec::GetResiliencyType() const {}

bool Codec::ValidateCodecFormat() const {}

std::string Codec::ToString() const {}

Codec CreateAudioRtxCodec(int rtx_payload_type, int associated_payload_type) {}

Codec CreateVideoRtxCodec(int rtx_payload_type, int associated_payload_type) {}

const Codec* FindCodecById(const std::vector<Codec>& codecs, int payload_type) {}

bool HasLntf(const Codec& codec) {}

bool HasNack(const Codec& codec) {}

bool HasRemb(const Codec& codec) {}

bool HasRrtr(const Codec& codec) {}

bool HasTransportCc(const Codec& codec) {}

const Codec* FindMatchingVideoCodec(const std::vector<Codec>& supported_codecs,
                                    const Codec& codec) {}

std::vector<const Codec*> FindAllMatchingCodecs(
    const std::vector<Codec>& supported_codecs,
    const Codec& codec) {}

// If a decoder supports any H264 profile, it is implicitly assumed to also
// support constrained base line even though it's not explicitly listed.
void AddH264ConstrainedBaselineProfileToSupportedFormats(
    std::vector<webrtc::SdpVideoFormat>* supported_formats) {}

Codec CreateAudioCodec(int id,
                       const std::string& name,
                       int clockrate,
                       size_t channels) {}

Codec CreateAudioCodec(const webrtc::SdpAudioFormat& c) {}

Codec CreateVideoCodec(const std::string& name) {}

Codec CreateVideoCodec(int id, const std::string& name) {}

Codec CreateVideoCodec(const webrtc::SdpVideoFormat& c) {}

}  // namespace cricket