Unify access to SDP codec parameters
which come from the a=fmtp:<pt> lines in the SDP and were used as either std::map<std::string, std:string> with three aliases, cricket::CodecParameterMap SdpAudioFormat::Parameters SdpVideoFormat::Parameters Use webrtc::CodecParameterMap in all places. BUG=None Change-Id: If47692bde7347834c349c6539b43309d8770e67b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/330420 Reviewed-by: Florent Castelli <orphis@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Philipp Hancke <phancke@microsoft.com> Cr-Commit-Position: refs/heads/main@{#41375}
This commit is contained in:
parent
161d2c8452
commit
63d03f586b
@ -35,6 +35,7 @@ rtc_library("audio_codecs_api") {
|
||||
"..:ref_count",
|
||||
"..:scoped_refptr",
|
||||
"../../api:field_trials_view",
|
||||
"../../api:rtp_parameters",
|
||||
"../../rtc_base:buffer",
|
||||
"../../rtc_base:checks",
|
||||
"../../rtc_base:event_tracer",
|
||||
|
||||
@ -27,7 +27,7 @@ SdpAudioFormat::SdpAudioFormat(absl::string_view name,
|
||||
SdpAudioFormat::SdpAudioFormat(absl::string_view name,
|
||||
int clockrate_hz,
|
||||
size_t num_channels,
|
||||
const Parameters& param)
|
||||
const CodecParameterMap& param)
|
||||
: name(name),
|
||||
clockrate_hz(clockrate_hz),
|
||||
num_channels(num_channels),
|
||||
@ -36,7 +36,7 @@ SdpAudioFormat::SdpAudioFormat(absl::string_view name,
|
||||
SdpAudioFormat::SdpAudioFormat(absl::string_view name,
|
||||
int clockrate_hz,
|
||||
size_t num_channels,
|
||||
Parameters&& param)
|
||||
CodecParameterMap&& param)
|
||||
: name(name),
|
||||
clockrate_hz(clockrate_hz),
|
||||
num_channels(num_channels),
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/rtp_parameters.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
@ -24,19 +25,17 @@ namespace webrtc {
|
||||
|
||||
// SDP specification for a single audio codec.
|
||||
struct RTC_EXPORT SdpAudioFormat {
|
||||
using Parameters = std::map<std::string, std::string>;
|
||||
|
||||
SdpAudioFormat(const SdpAudioFormat&);
|
||||
SdpAudioFormat(SdpAudioFormat&&);
|
||||
SdpAudioFormat(absl::string_view name, int clockrate_hz, size_t num_channels);
|
||||
SdpAudioFormat(absl::string_view name,
|
||||
int clockrate_hz,
|
||||
size_t num_channels,
|
||||
const Parameters& param);
|
||||
const CodecParameterMap& param);
|
||||
SdpAudioFormat(absl::string_view name,
|
||||
int clockrate_hz,
|
||||
size_t num_channels,
|
||||
Parameters&& param);
|
||||
CodecParameterMap&& param);
|
||||
~SdpAudioFormat();
|
||||
|
||||
// Returns true if this format is compatible with `o`. In SDP terminology:
|
||||
@ -55,7 +54,7 @@ struct RTC_EXPORT SdpAudioFormat {
|
||||
std::string name;
|
||||
int clockrate_hz;
|
||||
size_t num_channels;
|
||||
Parameters parameters;
|
||||
CodecParameterMap parameters;
|
||||
};
|
||||
|
||||
// Information about how an audio format is treated by the codec implementation.
|
||||
|
||||
@ -29,6 +29,8 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
using CodecParameterMap = std::map<std::string, std::string>;
|
||||
|
||||
// These structures are intended to mirror those defined by:
|
||||
// http://draft.ortc.org/#rtcrtpdictionaries*
|
||||
// Contains everything specified as of 2017 Jan 24.
|
||||
|
||||
@ -61,7 +61,7 @@ class VideoQualityTestFixtureInterface {
|
||||
bool automatic_scaling = false;
|
||||
std::string clip_path; // "Generator" to generate frames instead.
|
||||
size_t capture_device_index = 0;
|
||||
SdpVideoFormat::Parameters sdp_params;
|
||||
CodecParameterMap sdp_params;
|
||||
double encoder_overshoot_factor = 0.0;
|
||||
} video[2];
|
||||
struct Audio {
|
||||
|
||||
@ -83,6 +83,7 @@ rtc_library("video_codecs_api") {
|
||||
"..:fec_controller_api",
|
||||
"..:scoped_refptr",
|
||||
"../../api:array_view",
|
||||
"../../api:rtp_parameters",
|
||||
"../../modules/video_coding:codec_globals_headers",
|
||||
"../../rtc_base:checks",
|
||||
"../../rtc_base:logging",
|
||||
|
||||
@ -50,7 +50,7 @@ absl::optional<AV1Profile> StringToAV1Profile(absl::string_view str) {
|
||||
}
|
||||
|
||||
absl::optional<AV1Profile> ParseSdpForAV1Profile(
|
||||
const SdpVideoFormat::Parameters& params) {
|
||||
const CodecParameterMap& params) {
|
||||
const auto profile_it = params.find(kAV1FmtpProfile);
|
||||
if (profile_it == params.end())
|
||||
return AV1Profile::kProfile0;
|
||||
@ -58,8 +58,8 @@ absl::optional<AV1Profile> ParseSdpForAV1Profile(
|
||||
return StringToAV1Profile(profile_str);
|
||||
}
|
||||
|
||||
bool AV1IsSameProfile(const SdpVideoFormat::Parameters& params1,
|
||||
const SdpVideoFormat::Parameters& params2) {
|
||||
bool AV1IsSameProfile(const CodecParameterMap& params1,
|
||||
const CodecParameterMap& params2) {
|
||||
const absl::optional<AV1Profile> profile = ParseSdpForAV1Profile(params1);
|
||||
const absl::optional<AV1Profile> other_profile =
|
||||
ParseSdpForAV1Profile(params2);
|
||||
|
||||
@ -45,12 +45,12 @@ absl::optional<AV1Profile> StringToAV1Profile(absl::string_view profile);
|
||||
// specified and an empty value if the profile key is present but contains an
|
||||
// invalid value.
|
||||
RTC_EXPORT absl::optional<AV1Profile> ParseSdpForAV1Profile(
|
||||
const SdpVideoFormat::Parameters& params);
|
||||
const CodecParameterMap& params);
|
||||
|
||||
// Returns true if the parameters have the same AV1 profile or neither contains
|
||||
// an AV1 profile, otherwise false.
|
||||
bool AV1IsSameProfile(const SdpVideoFormat::Parameters& params1,
|
||||
const SdpVideoFormat::Parameters& params2);
|
||||
bool AV1IsSameProfile(const CodecParameterMap& params1,
|
||||
const CodecParameterMap& params2);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
|
||||
@ -178,7 +178,7 @@ absl::optional<H264Level> H264SupportedLevel(int max_frame_pixel_count,
|
||||
}
|
||||
|
||||
absl::optional<H264ProfileLevelId> ParseSdpForH264ProfileLevelId(
|
||||
const SdpVideoFormat::Parameters& params) {
|
||||
const CodecParameterMap& params) {
|
||||
// TODO(magjed): The default should really be kProfileBaseline and kLevel1
|
||||
// according to the spec: https://tools.ietf.org/html/rfc6184#section-8.1. In
|
||||
// order to not break backwards compatibility with older versions of WebRTC
|
||||
@ -243,8 +243,8 @@ absl::optional<std::string> H264ProfileLevelIdToString(
|
||||
return {str};
|
||||
}
|
||||
|
||||
bool H264IsSameProfile(const SdpVideoFormat::Parameters& params1,
|
||||
const SdpVideoFormat::Parameters& params2) {
|
||||
bool H264IsSameProfile(const CodecParameterMap& params1,
|
||||
const CodecParameterMap& params2) {
|
||||
const absl::optional<H264ProfileLevelId> profile_level_id =
|
||||
ParseSdpForH264ProfileLevelId(params1);
|
||||
const absl::optional<H264ProfileLevelId> other_profile_level_id =
|
||||
|
||||
@ -67,7 +67,7 @@ absl::optional<H264ProfileLevelId> ParseH264ProfileLevelId(const char* str);
|
||||
// returned if the profile-level-id key is missing. Nothing will be returned if
|
||||
// the key is present but the string is invalid.
|
||||
RTC_EXPORT absl::optional<H264ProfileLevelId> ParseSdpForH264ProfileLevelId(
|
||||
const SdpVideoFormat::Parameters& params);
|
||||
const CodecParameterMap& params);
|
||||
|
||||
// Given that a decoder supports up to a given frame size (in pixels) at up to a
|
||||
// given number of frames per second, return the highest H.264 level where it
|
||||
@ -84,8 +84,8 @@ RTC_EXPORT absl::optional<std::string> H264ProfileLevelIdToString(
|
||||
|
||||
// Returns true if the parameters have the same H264 profile (Baseline, High,
|
||||
// etc).
|
||||
RTC_EXPORT bool H264IsSameProfile(const SdpVideoFormat::Parameters& params1,
|
||||
const SdpVideoFormat::Parameters& params2);
|
||||
RTC_EXPORT bool H264IsSameProfile(const CodecParameterMap& params1,
|
||||
const CodecParameterMap& params2);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
|
||||
@ -182,7 +182,7 @@ std::string H265LevelToString(H265Level level) {
|
||||
}
|
||||
|
||||
absl::optional<H265ProfileTierLevel> ParseSdpForH265ProfileTierLevel(
|
||||
const SdpVideoFormat::Parameters& params) {
|
||||
const CodecParameterMap& params) {
|
||||
static const H265ProfileTierLevel kDefaultProfileTierLevel(
|
||||
H265Profile::kProfileMain, H265Tier::kTier0, H265Level::kLevel3_1);
|
||||
bool profile_tier_level_specified = false;
|
||||
@ -235,8 +235,8 @@ absl::optional<H265ProfileTierLevel> ParseSdpForH265ProfileTierLevel(
|
||||
level.value());
|
||||
}
|
||||
|
||||
bool H265IsSameProfileTierLevel(const SdpVideoFormat::Parameters& params1,
|
||||
const SdpVideoFormat::Parameters& params2) {
|
||||
bool H265IsSameProfileTierLevel(const CodecParameterMap& params1,
|
||||
const CodecParameterMap& params2) {
|
||||
const absl::optional<H265ProfileTierLevel> ptl1 =
|
||||
ParseSdpForH265ProfileTierLevel(params1);
|
||||
const absl::optional<H265ProfileTierLevel> ptl2 =
|
||||
|
||||
@ -97,13 +97,12 @@ RTC_EXPORT absl::optional<H265Level> StringToH265Level(
|
||||
// Returns empty value if any of the profile/tier/level key is present but
|
||||
// contains an invalid value.
|
||||
RTC_EXPORT absl::optional<H265ProfileTierLevel> ParseSdpForH265ProfileTierLevel(
|
||||
const SdpVideoFormat::Parameters& params);
|
||||
const CodecParameterMap& params);
|
||||
|
||||
// Returns true if the parameters have the same H265 profile or neither contains
|
||||
// an H265 profile, otherwise false.
|
||||
RTC_EXPORT bool H265IsSameProfileTierLevel(
|
||||
const SdpVideoFormat::Parameters& params1,
|
||||
const SdpVideoFormat::Parameters& params2);
|
||||
RTC_EXPORT bool H265IsSameProfileTierLevel(const CodecParameterMap& params1,
|
||||
const CodecParameterMap& params2);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
|
||||
@ -28,8 +28,7 @@ namespace webrtc {
|
||||
|
||||
namespace {
|
||||
|
||||
std::string H264GetPacketizationModeOrDefault(
|
||||
const SdpVideoFormat::Parameters& params) {
|
||||
std::string H264GetPacketizationModeOrDefault(const CodecParameterMap& params) {
|
||||
constexpr char kH264FmtpPacketizationMode[] = "packetization-mode";
|
||||
const auto it = params.find(kH264FmtpPacketizationMode);
|
||||
if (it != params.end()) {
|
||||
@ -40,8 +39,8 @@ std::string H264GetPacketizationModeOrDefault(
|
||||
return "0";
|
||||
}
|
||||
|
||||
bool H264IsSamePacketizationMode(const SdpVideoFormat::Parameters& left,
|
||||
const SdpVideoFormat::Parameters& right) {
|
||||
bool H264IsSamePacketizationMode(const CodecParameterMap& left,
|
||||
const CodecParameterMap& right) {
|
||||
return H264GetPacketizationModeOrDefault(left) ==
|
||||
H264GetPacketizationModeOrDefault(right);
|
||||
}
|
||||
@ -77,12 +76,12 @@ bool IsSameCodecSpecific(const SdpVideoFormat& format1,
|
||||
SdpVideoFormat::SdpVideoFormat(const std::string& name) : name(name) {}
|
||||
|
||||
SdpVideoFormat::SdpVideoFormat(const std::string& name,
|
||||
const Parameters& parameters)
|
||||
const CodecParameterMap& parameters)
|
||||
: name(name), parameters(parameters) {}
|
||||
|
||||
SdpVideoFormat::SdpVideoFormat(
|
||||
const std::string& name,
|
||||
const Parameters& parameters,
|
||||
const CodecParameterMap& parameters,
|
||||
const absl::InlinedVector<ScalabilityMode, kScalabilityModeCount>&
|
||||
scalability_modes)
|
||||
: name(name),
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include "absl/container/inlined_vector.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/array_view.h"
|
||||
#include "api/rtp_parameters.h"
|
||||
#include "api/video_codecs/scalability_mode.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
@ -25,13 +26,11 @@ namespace webrtc {
|
||||
// SDP specification for a single video codec.
|
||||
// NOTE: This class is still under development and may change without notice.
|
||||
struct RTC_EXPORT SdpVideoFormat {
|
||||
using Parameters = std::map<std::string, std::string>;
|
||||
|
||||
explicit SdpVideoFormat(const std::string& name);
|
||||
SdpVideoFormat(const std::string& name, const Parameters& parameters);
|
||||
SdpVideoFormat(const std::string& name, const CodecParameterMap& parameters);
|
||||
SdpVideoFormat(
|
||||
const std::string& name,
|
||||
const Parameters& parameters,
|
||||
const CodecParameterMap& parameters,
|
||||
const absl::InlinedVector<ScalabilityMode, kScalabilityModeCount>&
|
||||
scalability_modes);
|
||||
SdpVideoFormat(const SdpVideoFormat&);
|
||||
@ -58,7 +57,7 @@ struct RTC_EXPORT SdpVideoFormat {
|
||||
}
|
||||
|
||||
std::string name;
|
||||
Parameters parameters;
|
||||
CodecParameterMap parameters;
|
||||
absl::InlinedVector<ScalabilityMode, kScalabilityModeCount> scalability_modes;
|
||||
};
|
||||
|
||||
|
||||
@ -145,7 +145,7 @@ TEST(H264ProfileLevelId, TestToStringInvalid) {
|
||||
|
||||
TEST(H264ProfileLevelId, TestParseSdpProfileLevelIdEmpty) {
|
||||
const absl::optional<H264ProfileLevelId> profile_level_id =
|
||||
ParseSdpForH264ProfileLevelId(SdpVideoFormat::Parameters());
|
||||
ParseSdpForH264ProfileLevelId(CodecParameterMap());
|
||||
EXPECT_TRUE(profile_level_id);
|
||||
EXPECT_EQ(H264Profile::kProfileConstrainedBaseline,
|
||||
profile_level_id->profile);
|
||||
@ -153,7 +153,7 @@ TEST(H264ProfileLevelId, TestParseSdpProfileLevelIdEmpty) {
|
||||
}
|
||||
|
||||
TEST(H264ProfileLevelId, TestParseSdpProfileLevelIdConstrainedHigh) {
|
||||
SdpVideoFormat::Parameters params;
|
||||
CodecParameterMap params;
|
||||
params["profile-level-id"] = "640c2a";
|
||||
const absl::optional<H264ProfileLevelId> profile_level_id =
|
||||
ParseSdpForH264ProfileLevelId(params);
|
||||
@ -163,7 +163,7 @@ TEST(H264ProfileLevelId, TestParseSdpProfileLevelIdConstrainedHigh) {
|
||||
}
|
||||
|
||||
TEST(H264ProfileLevelId, TestParseSdpProfileLevelIdInvalid) {
|
||||
SdpVideoFormat::Parameters params;
|
||||
CodecParameterMap params;
|
||||
params["profile-level-id"] = "foobar";
|
||||
EXPECT_FALSE(ParseSdpForH264ProfileLevelId(params));
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ TEST(H265ProfileTierLevel, TestStringToTier) {
|
||||
|
||||
TEST(H265ProfileTierLevel, TestParseSdpProfileTierLevelAllEmpty) {
|
||||
const absl::optional<H265ProfileTierLevel> profile_tier_level =
|
||||
ParseSdpForH265ProfileTierLevel(SdpVideoFormat::Parameters());
|
||||
ParseSdpForH265ProfileTierLevel(CodecParameterMap());
|
||||
EXPECT_TRUE(profile_tier_level);
|
||||
EXPECT_EQ(H265Profile::kProfileMain, profile_tier_level->profile);
|
||||
EXPECT_EQ(H265Level::kLevel3_1, profile_tier_level->level);
|
||||
@ -116,7 +116,7 @@ TEST(H265ProfileTierLevel, TestParseSdpProfileTierLevelAllEmpty) {
|
||||
}
|
||||
|
||||
TEST(H265ProfileTierLevel, TestParseSdpProfileTierLevelPartialEmpty) {
|
||||
SdpVideoFormat::Parameters params;
|
||||
CodecParameterMap params;
|
||||
params["profile-id"] = "1";
|
||||
params["tier-flag"] = "0";
|
||||
absl::optional<H265ProfileTierLevel> profile_tier_level =
|
||||
@ -144,7 +144,7 @@ TEST(H265ProfileTierLevel, TestParseSdpProfileTierLevelPartialEmpty) {
|
||||
}
|
||||
|
||||
TEST(H265ProfileTierLevel, TestParseSdpProfileTierLevelInvalid) {
|
||||
SdpVideoFormat::Parameters params;
|
||||
CodecParameterMap params;
|
||||
|
||||
// Invalid profile-tier-level combination.
|
||||
params["profile-id"] = "1";
|
||||
@ -170,7 +170,7 @@ TEST(H265ProfileTierLevel, TestParseSdpProfileTierLevelInvalid) {
|
||||
}
|
||||
|
||||
TEST(H265ProfileTierLevel, TestToStringRoundTrip) {
|
||||
SdpVideoFormat::Parameters params;
|
||||
CodecParameterMap params;
|
||||
params["profile-id"] = "1";
|
||||
params["tier-flag"] = "0";
|
||||
params["level-id"] = "93";
|
||||
@ -193,8 +193,8 @@ TEST(H265ProfileTierLevel, TestToStringRoundTrip) {
|
||||
}
|
||||
|
||||
TEST(H265ProfileTierLevel, TestProfileTierLevelCompare) {
|
||||
SdpVideoFormat::Parameters params1;
|
||||
SdpVideoFormat::Parameters params2;
|
||||
CodecParameterMap params1;
|
||||
CodecParameterMap params2;
|
||||
|
||||
// None of profile-id/tier-flag/level-id is specified,
|
||||
EXPECT_TRUE(H265IsSameProfileTierLevel(params1, params2));
|
||||
@ -235,7 +235,7 @@ TEST(H265ProfileTierLevel, TestProfileTierLevelCompare) {
|
||||
params2["tier-flag"] = "1";
|
||||
EXPECT_FALSE(H265IsSameProfileTierLevel(params1, params2));
|
||||
|
||||
// One of the SdpVideoFormat::Parameters is invalid.
|
||||
// One of the CodecParameterMap is invalid.
|
||||
params1.clear();
|
||||
params2.clear();
|
||||
params1["profile-id"] = "1";
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
namespace webrtc {
|
||||
|
||||
typedef SdpVideoFormat Sdp;
|
||||
typedef SdpVideoFormat::Parameters Params;
|
||||
typedef CodecParameterMap Params;
|
||||
|
||||
TEST(SdpVideoFormatTest, SameCodecNameNoParameters) {
|
||||
EXPECT_TRUE(Sdp("H264").IsSameCodec(Sdp("h264")));
|
||||
|
||||
@ -24,8 +24,7 @@ struct LibaomAv1EncoderTemplateAdapter {
|
||||
static std::vector<SdpVideoFormat> SupportedFormats() {
|
||||
absl::InlinedVector<ScalabilityMode, kScalabilityModeCount>
|
||||
scalability_modes = LibaomAv1EncoderSupportedScalabilityModes();
|
||||
return {
|
||||
SdpVideoFormat("AV1", SdpVideoFormat::Parameters(), scalability_modes)};
|
||||
return {SdpVideoFormat("AV1", CodecParameterMap(), scalability_modes)};
|
||||
}
|
||||
|
||||
static std::unique_ptr<VideoEncoder> CreateEncoder(
|
||||
|
||||
@ -28,8 +28,7 @@ struct LibvpxVp8EncoderTemplateAdapter {
|
||||
scalability_modes.push_back(scalability_mode);
|
||||
}
|
||||
|
||||
return {
|
||||
SdpVideoFormat("VP8", SdpVideoFormat::Parameters(), scalability_modes)};
|
||||
return {SdpVideoFormat("VP8", CodecParameterMap(), scalability_modes)};
|
||||
}
|
||||
|
||||
static std::unique_ptr<VideoEncoder> CreateEncoder(
|
||||
|
||||
@ -54,7 +54,7 @@ absl::optional<VP9Profile> StringToVP9Profile(const std::string& str) {
|
||||
}
|
||||
|
||||
absl::optional<VP9Profile> ParseSdpForVP9Profile(
|
||||
const SdpVideoFormat::Parameters& params) {
|
||||
const CodecParameterMap& params) {
|
||||
const auto profile_it = params.find(kVP9FmtpProfileId);
|
||||
if (profile_it == params.end())
|
||||
return VP9Profile::kProfile0;
|
||||
@ -62,8 +62,8 @@ absl::optional<VP9Profile> ParseSdpForVP9Profile(
|
||||
return StringToVP9Profile(profile_str);
|
||||
}
|
||||
|
||||
bool VP9IsSameProfile(const SdpVideoFormat::Parameters& params1,
|
||||
const SdpVideoFormat::Parameters& params2) {
|
||||
bool VP9IsSameProfile(const CodecParameterMap& params1,
|
||||
const CodecParameterMap& params2) {
|
||||
const absl::optional<VP9Profile> profile = ParseSdpForVP9Profile(params1);
|
||||
const absl::optional<VP9Profile> other_profile =
|
||||
ParseSdpForVP9Profile(params2);
|
||||
|
||||
@ -42,12 +42,12 @@ absl::optional<VP9Profile> StringToVP9Profile(const std::string& str);
|
||||
// profile key is missing. Nothing will be returned if the key is present but
|
||||
// the string is invalid.
|
||||
RTC_EXPORT absl::optional<VP9Profile> ParseSdpForVP9Profile(
|
||||
const SdpVideoFormat::Parameters& params);
|
||||
const CodecParameterMap& params);
|
||||
|
||||
// Returns true if the parameters have the same VP9 profile, or neither contains
|
||||
// VP9 profile.
|
||||
bool VP9IsSameProfile(const SdpVideoFormat::Parameters& params1,
|
||||
const SdpVideoFormat::Parameters& params2);
|
||||
bool VP9IsSameProfile(const CodecParameterMap& params1,
|
||||
const CodecParameterMap& params2);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
|
||||
@ -28,7 +28,8 @@
|
||||
namespace cricket {
|
||||
namespace {
|
||||
|
||||
std::string GetH264PacketizationModeOrDefault(const CodecParameterMap& params) {
|
||||
std::string GetH264PacketizationModeOrDefault(
|
||||
const webrtc::CodecParameterMap& params) {
|
||||
auto it = params.find(kH264FmtpPacketizationMode);
|
||||
if (it != params.end()) {
|
||||
return it->second;
|
||||
@ -38,14 +39,14 @@ std::string GetH264PacketizationModeOrDefault(const CodecParameterMap& params) {
|
||||
return "0";
|
||||
}
|
||||
|
||||
bool IsSameH264PacketizationMode(const CodecParameterMap& left,
|
||||
const CodecParameterMap& right) {
|
||||
bool IsSameH264PacketizationMode(const webrtc::CodecParameterMap& left,
|
||||
const webrtc::CodecParameterMap& right) {
|
||||
return GetH264PacketizationModeOrDefault(left) ==
|
||||
GetH264PacketizationModeOrDefault(right);
|
||||
}
|
||||
|
||||
#ifdef RTC_ENABLE_H265
|
||||
std::string GetH265TxModeOrDefault(const CodecParameterMap& params) {
|
||||
std::string GetH265TxModeOrDefault(const webrtc::CodecParameterMap& params) {
|
||||
auto it = params.find(kH265FmtpTxMode);
|
||||
if (it != params.end()) {
|
||||
return it->second;
|
||||
@ -55,8 +56,8 @@ std::string GetH265TxModeOrDefault(const CodecParameterMap& params) {
|
||||
return "SRST";
|
||||
}
|
||||
|
||||
bool IsSameH265TxMode(const CodecParameterMap& left,
|
||||
const CodecParameterMap& right) {
|
||||
bool IsSameH265TxMode(const webrtc::CodecParameterMap& left,
|
||||
const webrtc::CodecParameterMap& right) {
|
||||
return absl::EqualsIgnoreCase(GetH265TxModeOrDefault(left),
|
||||
GetH265TxModeOrDefault(right));
|
||||
}
|
||||
@ -65,9 +66,9 @@ bool IsSameH265TxMode(const CodecParameterMap& left,
|
||||
// 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 CodecParameterMap& params1,
|
||||
const webrtc::CodecParameterMap& params1,
|
||||
const std::string& name2,
|
||||
const CodecParameterMap& params2) {
|
||||
const webrtc::CodecParameterMap& params2) {
|
||||
// The names might not necessarily match, so check both.
|
||||
auto either_name_matches = [&](const std::string name) {
|
||||
return absl::EqualsIgnoreCase(name, name1) ||
|
||||
@ -249,7 +250,7 @@ bool Codec::MatchesRtpCodec(const webrtc::RtpCodec& codec_capability) const {
|
||||
}
|
||||
|
||||
bool Codec::GetParam(const std::string& name, std::string* out) const {
|
||||
CodecParameterMap::const_iterator iter = params.find(name);
|
||||
webrtc::CodecParameterMap::const_iterator iter = params.find(name);
|
||||
if (iter == params.end())
|
||||
return false;
|
||||
*out = iter->second;
|
||||
@ -257,7 +258,7 @@ bool Codec::GetParam(const std::string& name, std::string* out) const {
|
||||
}
|
||||
|
||||
bool Codec::GetParam(const std::string& name, int* out) const {
|
||||
CodecParameterMap::const_iterator iter = params.find(name);
|
||||
webrtc::CodecParameterMap::const_iterator iter = params.find(name);
|
||||
if (iter == params.end())
|
||||
return false;
|
||||
return rtc::FromString(iter->second, out);
|
||||
|
||||
@ -27,8 +27,6 @@
|
||||
|
||||
namespace cricket {
|
||||
|
||||
using CodecParameterMap = std::map<std::string, std::string>;
|
||||
|
||||
class FeedbackParam {
|
||||
public:
|
||||
FeedbackParam() = default;
|
||||
@ -103,7 +101,7 @@ struct RTC_EXPORT Codec {
|
||||
|
||||
// Non key-value parameters such as the telephone-event "0‐15" are
|
||||
// represented using an empty string as key, i.e. {"": "0-15"}.
|
||||
CodecParameterMap params;
|
||||
webrtc::CodecParameterMap params;
|
||||
FeedbackParams feedback_params;
|
||||
|
||||
Codec(const Codec& c);
|
||||
|
||||
@ -36,7 +36,7 @@ constexpr char kH265TierFlag[] = "tier-flag";
|
||||
constexpr char kH265LevelId[] = "level-id";
|
||||
#endif
|
||||
|
||||
bool IsH264LevelAsymmetryAllowed(const SdpVideoFormat::Parameters& params) {
|
||||
bool IsH264LevelAsymmetryAllowed(const CodecParameterMap& params) {
|
||||
const auto it = params.find(kH264LevelAsymmetryAllowed);
|
||||
return it != params.end() && strcmp(it->second.c_str(), "1") == 0;
|
||||
}
|
||||
@ -55,7 +55,7 @@ H264Level H264LevelMin(H264Level a, H264Level b) {
|
||||
}
|
||||
|
||||
absl::optional<int> ParsePositiveNumberFromParams(
|
||||
const SdpVideoFormat::Parameters& params,
|
||||
const CodecParameterMap& params,
|
||||
const char* parameter_name) {
|
||||
const auto max_frame_rate_it = params.find(parameter_name);
|
||||
if (max_frame_rate_it == params.end())
|
||||
@ -76,7 +76,7 @@ H265Level H265LevelMin(H265Level a, H265Level b) {
|
||||
|
||||
// Returns true if none of profile-id/tier-flag/level-id is specified
|
||||
// explicitly in the param.
|
||||
bool IsDefaultH265PTL(const SdpVideoFormat::Parameters& params) {
|
||||
bool IsDefaultH265PTL(const CodecParameterMap& params) {
|
||||
return !params.count(kH265ProfileId) && !params.count(kH265TierFlag) &&
|
||||
!params.count(kH265LevelId);
|
||||
}
|
||||
@ -87,9 +87,9 @@ bool IsDefaultH265PTL(const SdpVideoFormat::Parameters& params) {
|
||||
#ifdef RTC_ENABLE_H265
|
||||
// Set level according to https://tools.ietf.org/html/rfc7798#section-7.1
|
||||
void H265GenerateProfileTierLevelForAnswer(
|
||||
const SdpVideoFormat::Parameters& local_supported_params,
|
||||
const SdpVideoFormat::Parameters& remote_offered_params,
|
||||
SdpVideoFormat::Parameters* answer_params) {
|
||||
const CodecParameterMap& local_supported_params,
|
||||
const CodecParameterMap& remote_offered_params,
|
||||
CodecParameterMap* answer_params) {
|
||||
// If local and remote haven't set profile-id/tier-flag/level-id, they
|
||||
// are both using the default PTL In this case, don't set PTL in answer
|
||||
// either.
|
||||
@ -123,9 +123,9 @@ void H265GenerateProfileTierLevelForAnswer(
|
||||
|
||||
// Set level according to https://tools.ietf.org/html/rfc6184#section-8.2.2.
|
||||
void H264GenerateProfileLevelIdForAnswer(
|
||||
const SdpVideoFormat::Parameters& local_supported_params,
|
||||
const SdpVideoFormat::Parameters& remote_offered_params,
|
||||
SdpVideoFormat::Parameters* answer_params) {
|
||||
const CodecParameterMap& local_supported_params,
|
||||
const CodecParameterMap& remote_offered_params,
|
||||
CodecParameterMap* answer_params) {
|
||||
// If both local and remote haven't set profile-level-id, they are both using
|
||||
// the default profile. In this case, don't set profile-level-id in answer
|
||||
// either.
|
||||
@ -165,12 +165,12 @@ void H264GenerateProfileLevelIdForAnswer(
|
||||
}
|
||||
|
||||
absl::optional<int> ParseSdpForVPxMaxFrameRate(
|
||||
const SdpVideoFormat::Parameters& params) {
|
||||
const CodecParameterMap& params) {
|
||||
return ParsePositiveNumberFromParams(params, kVPxFmtpMaxFrameRate);
|
||||
}
|
||||
|
||||
absl::optional<int> ParseSdpForVPxMaxFrameSize(
|
||||
const SdpVideoFormat::Parameters& params) {
|
||||
const CodecParameterMap& params) {
|
||||
const absl::optional<int> i =
|
||||
ParsePositiveNumberFromParams(params, kVPxFmtpMaxFrameSize);
|
||||
return i ? absl::make_optional(i.value() * kVPxFmtpFrameSizeSubBlockPixels)
|
||||
|
||||
@ -32,9 +32,9 @@ namespace webrtc {
|
||||
// parameters that are used when negotiating are the level part of
|
||||
// profile-level-id and level-asymmetry-allowed.
|
||||
void H264GenerateProfileLevelIdForAnswer(
|
||||
const SdpVideoFormat::Parameters& local_supported_params,
|
||||
const SdpVideoFormat::Parameters& remote_offered_params,
|
||||
SdpVideoFormat::Parameters* answer_params);
|
||||
const CodecParameterMap& local_supported_params,
|
||||
const CodecParameterMap& remote_offered_params,
|
||||
CodecParameterMap* answer_params);
|
||||
|
||||
#ifdef RTC_ENABLE_H265
|
||||
// Works similarly as H264GenerateProfileLevelIdForAnswer, but generates codec
|
||||
@ -43,21 +43,19 @@ void H264GenerateProfileLevelIdForAnswer(
|
||||
// For level-id, the highest level indicated by the answer must not be higher
|
||||
// than that indicated by the offer.
|
||||
void H265GenerateProfileTierLevelForAnswer(
|
||||
const SdpVideoFormat::Parameters& local_supported_params,
|
||||
const SdpVideoFormat::Parameters& remote_offered_params,
|
||||
SdpVideoFormat::Parameters* answer_params);
|
||||
const CodecParameterMap& local_supported_params,
|
||||
const CodecParameterMap& remote_offered_params,
|
||||
CodecParameterMap* answer_params);
|
||||
#endif
|
||||
|
||||
// Parse max frame rate from SDP FMTP line. absl::nullopt is returned if the
|
||||
// field is missing or not a number.
|
||||
absl::optional<int> ParseSdpForVPxMaxFrameRate(
|
||||
const SdpVideoFormat::Parameters& params);
|
||||
absl::optional<int> ParseSdpForVPxMaxFrameRate(const CodecParameterMap& params);
|
||||
|
||||
// Parse max frame size from SDP FMTP line. absl::nullopt is returned if the
|
||||
// field is missing or not a number. Please note that the value is stored in sub
|
||||
// blocks but the returned value is in total number of pixels.
|
||||
absl::optional<int> ParseSdpForVPxMaxFrameSize(
|
||||
const SdpVideoFormat::Parameters& params);
|
||||
absl::optional<int> ParseSdpForVPxMaxFrameSize(const CodecParameterMap& params);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
|
||||
@ -27,29 +27,28 @@ const char kVPxFmtpMaxFrameSize[] = "max-fs";
|
||||
} // namespace
|
||||
|
||||
TEST(SdpVideoFormatUtilsTest, TestH264GenerateProfileLevelIdForAnswerEmpty) {
|
||||
SdpVideoFormat::Parameters answer_params;
|
||||
H264GenerateProfileLevelIdForAnswer(SdpVideoFormat::Parameters(),
|
||||
SdpVideoFormat::Parameters(),
|
||||
CodecParameterMap answer_params;
|
||||
H264GenerateProfileLevelIdForAnswer(CodecParameterMap(), CodecParameterMap(),
|
||||
&answer_params);
|
||||
EXPECT_TRUE(answer_params.empty());
|
||||
}
|
||||
|
||||
TEST(SdpVideoFormatUtilsTest,
|
||||
TestH264GenerateProfileLevelIdForAnswerLevelSymmetryCapped) {
|
||||
SdpVideoFormat::Parameters low_level;
|
||||
CodecParameterMap low_level;
|
||||
low_level["profile-level-id"] = "42e015";
|
||||
SdpVideoFormat::Parameters high_level;
|
||||
CodecParameterMap high_level;
|
||||
high_level["profile-level-id"] = "42e01f";
|
||||
|
||||
// Level asymmetry is not allowed; test that answer level is the lower of the
|
||||
// local and remote levels.
|
||||
SdpVideoFormat::Parameters answer_params;
|
||||
CodecParameterMap answer_params;
|
||||
H264GenerateProfileLevelIdForAnswer(low_level /* local_supported */,
|
||||
high_level /* remote_offered */,
|
||||
&answer_params);
|
||||
EXPECT_EQ("42e015", answer_params["profile-level-id"]);
|
||||
|
||||
SdpVideoFormat::Parameters answer_params2;
|
||||
CodecParameterMap answer_params2;
|
||||
H264GenerateProfileLevelIdForAnswer(high_level /* local_supported */,
|
||||
low_level /* remote_offered */,
|
||||
&answer_params2);
|
||||
@ -58,13 +57,13 @@ TEST(SdpVideoFormatUtilsTest,
|
||||
|
||||
TEST(SdpVideoFormatUtilsTest,
|
||||
TestH264GenerateProfileLevelIdForAnswerConstrainedBaselineLevelAsymmetry) {
|
||||
SdpVideoFormat::Parameters local_params;
|
||||
CodecParameterMap local_params;
|
||||
local_params["profile-level-id"] = "42e01f";
|
||||
local_params["level-asymmetry-allowed"] = "1";
|
||||
SdpVideoFormat::Parameters remote_params;
|
||||
CodecParameterMap remote_params;
|
||||
remote_params["profile-level-id"] = "42e015";
|
||||
remote_params["level-asymmetry-allowed"] = "1";
|
||||
SdpVideoFormat::Parameters answer_params;
|
||||
CodecParameterMap answer_params;
|
||||
H264GenerateProfileLevelIdForAnswer(local_params, remote_params,
|
||||
&answer_params);
|
||||
// When level asymmetry is allowed, we can answer a higher level than what was
|
||||
@ -76,10 +75,9 @@ TEST(SdpVideoFormatUtilsTest,
|
||||
// Answer should not include explicit PTL info if neither local nor remote set
|
||||
// any of them.
|
||||
TEST(SdpVideoFormatUtilsTest, H265GenerateProfileTierLevelEmpty) {
|
||||
SdpVideoFormat::Parameters answer_params;
|
||||
H265GenerateProfileTierLevelForAnswer(SdpVideoFormat::Parameters(),
|
||||
SdpVideoFormat::Parameters(),
|
||||
&answer_params);
|
||||
CodecParameterMap answer_params;
|
||||
H265GenerateProfileTierLevelForAnswer(CodecParameterMap(),
|
||||
CodecParameterMap(), &answer_params);
|
||||
EXPECT_TRUE(answer_params.empty());
|
||||
}
|
||||
|
||||
@ -88,15 +86,15 @@ TEST(SdpVideoFormatUtilsTest, H265GenerateProfileTierLevelNoEmpty) {
|
||||
constexpr char kLocallySupportedLevelId[] = "93";
|
||||
constexpr char kRemoteOfferedLevelId[] = "120";
|
||||
|
||||
SdpVideoFormat::Parameters local_params;
|
||||
CodecParameterMap local_params;
|
||||
local_params["profile-id"] = "1";
|
||||
local_params["tier-flag"] = "0";
|
||||
local_params["level-id"] = kLocallySupportedLevelId;
|
||||
SdpVideoFormat::Parameters remote_params;
|
||||
CodecParameterMap remote_params;
|
||||
remote_params["profile-id"] = "1";
|
||||
remote_params["tier-flag"] = "0";
|
||||
remote_params["level-id"] = kRemoteOfferedLevelId;
|
||||
SdpVideoFormat::Parameters answer_params;
|
||||
CodecParameterMap answer_params;
|
||||
H265GenerateProfileTierLevelForAnswer(local_params, remote_params,
|
||||
&answer_params);
|
||||
EXPECT_EQ(kLocallySupportedLevelId, answer_params["level-id"]);
|
||||
@ -104,7 +102,7 @@ TEST(SdpVideoFormatUtilsTest, H265GenerateProfileTierLevelNoEmpty) {
|
||||
#endif
|
||||
|
||||
TEST(SdpVideoFormatUtilsTest, MaxFrameRateIsMissingOrInvalid) {
|
||||
SdpVideoFormat::Parameters params;
|
||||
CodecParameterMap params;
|
||||
absl::optional<int> empty = ParseSdpForVPxMaxFrameRate(params);
|
||||
EXPECT_FALSE(empty);
|
||||
params[kVPxFmtpMaxFrameRate] = "-1";
|
||||
@ -116,7 +114,7 @@ TEST(SdpVideoFormatUtilsTest, MaxFrameRateIsMissingOrInvalid) {
|
||||
}
|
||||
|
||||
TEST(SdpVideoFormatUtilsTest, MaxFrameRateIsSpecified) {
|
||||
SdpVideoFormat::Parameters params;
|
||||
CodecParameterMap params;
|
||||
params[kVPxFmtpMaxFrameRate] = "30";
|
||||
EXPECT_EQ(ParseSdpForVPxMaxFrameRate(params), 30);
|
||||
params[kVPxFmtpMaxFrameRate] = "60";
|
||||
@ -124,7 +122,7 @@ TEST(SdpVideoFormatUtilsTest, MaxFrameRateIsSpecified) {
|
||||
}
|
||||
|
||||
TEST(SdpVideoFormatUtilsTest, MaxFrameSizeIsMissingOrInvalid) {
|
||||
SdpVideoFormat::Parameters params;
|
||||
CodecParameterMap params;
|
||||
absl::optional<int> empty = ParseSdpForVPxMaxFrameSize(params);
|
||||
EXPECT_FALSE(empty);
|
||||
params[kVPxFmtpMaxFrameSize] = "-1";
|
||||
@ -136,7 +134,7 @@ TEST(SdpVideoFormatUtilsTest, MaxFrameSizeIsMissingOrInvalid) {
|
||||
}
|
||||
|
||||
TEST(SdpVideoFormatUtilsTest, MaxFrameSizeIsSpecified) {
|
||||
SdpVideoFormat::Parameters params;
|
||||
CodecParameterMap params;
|
||||
params[kVPxFmtpMaxFrameSize] = "8100"; // 1920 x 1080 / (16^2)
|
||||
EXPECT_EQ(ParseSdpForVPxMaxFrameSize(params), 1920 * 1080);
|
||||
params[kVPxFmtpMaxFrameSize] = "32400"; // 3840 x 2160 / (16^2)
|
||||
|
||||
@ -586,7 +586,7 @@ class TestSimulcastEncoderAdapterFake : public ::testing::Test,
|
||||
absl::optional<int> last_encoded_image_simulcast_index_;
|
||||
std::unique_ptr<SimulcastRateAllocator> rate_allocator_;
|
||||
bool use_fallback_factory_;
|
||||
SdpVideoFormat::Parameters sdp_video_parameters_;
|
||||
CodecParameterMap sdp_video_parameters_;
|
||||
test::ScopedKeyValueConfig field_trials_;
|
||||
};
|
||||
|
||||
|
||||
@ -3781,7 +3781,7 @@ class Vp9SettingsTest : public WebRtcVideoChannelTest {
|
||||
|
||||
TEST_F(Vp9SettingsTest, VerifyVp9SpecificSettings) {
|
||||
encoder_factory_->AddSupportedVideoCodec(
|
||||
webrtc::SdpVideoFormat("VP9", webrtc::SdpVideoFormat::Parameters(),
|
||||
webrtc::SdpVideoFormat("VP9", webrtc::CodecParameterMap(),
|
||||
{ScalabilityMode::kL1T1, ScalabilityMode::kL2T1}));
|
||||
|
||||
cricket::VideoSenderParameters parameters;
|
||||
@ -8545,7 +8545,7 @@ TEST_F(WebRtcVideoChannelTest, FallbackForUnsetOrUnsupportedScalabilityMode) {
|
||||
ScalabilityMode::kL1T3};
|
||||
|
||||
encoder_factory_->AddSupportedVideoCodec(webrtc::SdpVideoFormat(
|
||||
"VP8", webrtc::SdpVideoFormat::Parameters(), kSupportedModes));
|
||||
"VP8", webrtc::CodecParameterMap(), kSupportedModes));
|
||||
|
||||
FakeVideoSendStream* stream = SetUpSimulcast(true, /*with_rtx=*/false);
|
||||
|
||||
@ -8615,9 +8615,9 @@ TEST_F(WebRtcVideoChannelTest,
|
||||
kVp9SupportedModes = {ScalabilityMode::kL3T3};
|
||||
|
||||
encoder_factory_->AddSupportedVideoCodec(webrtc::SdpVideoFormat(
|
||||
"VP8", webrtc::SdpVideoFormat::Parameters(), {ScalabilityMode::kL1T1}));
|
||||
"VP8", webrtc::CodecParameterMap(), {ScalabilityMode::kL1T1}));
|
||||
encoder_factory_->AddSupportedVideoCodec(webrtc::SdpVideoFormat(
|
||||
"VP9", webrtc::SdpVideoFormat::Parameters(), {ScalabilityMode::kL3T3}));
|
||||
"VP9", webrtc::CodecParameterMap(), {ScalabilityMode::kL3T3}));
|
||||
|
||||
cricket::VideoSenderParameters send_parameters;
|
||||
send_parameters.codecs.push_back(GetEngineCodec("VP9"));
|
||||
|
||||
@ -146,7 +146,7 @@ TEST(AudioDecoderFactoryTest, CreateOpus) {
|
||||
for (int hz : {8000, 16000, 32000, 48000}) {
|
||||
for (int channels : {0, 1, 2, 3}) {
|
||||
for (std::string stereo : {"XX", "0", "1", "2"}) {
|
||||
SdpAudioFormat::Parameters params;
|
||||
CodecParameterMap params;
|
||||
if (stereo != "XX") {
|
||||
params["stereo"] = stereo;
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ constexpr int kDefaultOpusPacSize = 960;
|
||||
constexpr int64_t kInitialTimeUs = 12345678;
|
||||
|
||||
AudioEncoderOpusConfig CreateConfigWithParameters(
|
||||
const SdpAudioFormat::Parameters& params) {
|
||||
const CodecParameterMap& params) {
|
||||
const SdpAudioFormat format("opus", 48000, 2, params);
|
||||
return *AudioEncoderOpus::SdpToConfig(format);
|
||||
}
|
||||
|
||||
@ -106,8 +106,8 @@ NetEqOpusQualityTest::NetEqOpusQualityTest()
|
||||
|
||||
// Redefine decoder type if input is stereo.
|
||||
if (channels_ > 1) {
|
||||
audio_format_ = SdpAudioFormat("opus", 48000, 2,
|
||||
SdpAudioFormat::Parameters{{"stereo", "1"}});
|
||||
audio_format_ =
|
||||
SdpAudioFormat("opus", 48000, 2, CodecParameterMap{{"stereo", "1"}});
|
||||
}
|
||||
application_ = absl::GetFlag(FLAGS_application);
|
||||
}
|
||||
|
||||
@ -469,7 +469,7 @@ void TestStereo::RegisterSendCodec(char side,
|
||||
: sampling_freq_hz;
|
||||
const std::string ptime = rtc::ToString(rtc::CheckedDivExact(
|
||||
pack_size, rtc::CheckedDivExact(sampling_freq_hz, 1000)));
|
||||
SdpAudioFormat::Parameters params = {{"ptime", ptime}};
|
||||
CodecParameterMap params = {{"ptime", ptime}};
|
||||
RTC_CHECK(channels == 1 || channels == 2);
|
||||
if (absl::EqualsIgnoreCase(codec_name, "opus")) {
|
||||
if (channels == 2) {
|
||||
|
||||
@ -167,7 +167,7 @@ SdpVideoFormat CreateSdpVideoFormat(
|
||||
H264PacketizationMode::NonInterleaved
|
||||
? "1"
|
||||
: "0";
|
||||
SdpVideoFormat::Parameters codec_params = {
|
||||
CodecParameterMap codec_params = {
|
||||
{cricket::kH264FmtpProfileLevelId,
|
||||
*H264ProfileLevelIdToString(H264ProfileLevelId(
|
||||
config.h264_codec_settings.profile, H264Level::kLevel3_1))},
|
||||
|
||||
@ -319,8 +319,7 @@ struct AudioEncoderUnicornSparklesRainbow {
|
||||
using Config = webrtc::AudioEncoderL16::Config;
|
||||
static absl::optional<Config> SdpToConfig(webrtc::SdpAudioFormat format) {
|
||||
if (absl::EqualsIgnoreCase(format.name, "UnicornSparklesRainbow")) {
|
||||
const webrtc::SdpAudioFormat::Parameters expected_params = {
|
||||
{"num_horns", "1"}};
|
||||
const webrtc::CodecParameterMap expected_params = {{"num_horns", "1"}};
|
||||
EXPECT_EQ(expected_params, format.parameters);
|
||||
format.parameters.clear();
|
||||
format.name = "L16";
|
||||
@ -356,8 +355,7 @@ struct AudioDecoderUnicornSparklesRainbow {
|
||||
using Config = webrtc::AudioDecoderL16::Config;
|
||||
static absl::optional<Config> SdpToConfig(webrtc::SdpAudioFormat format) {
|
||||
if (absl::EqualsIgnoreCase(format.name, "UnicornSparklesRainbow")) {
|
||||
const webrtc::SdpAudioFormat::Parameters expected_params = {
|
||||
{"num_horns", "1"}};
|
||||
const webrtc::CodecParameterMap expected_params = {{"num_horns", "1"}};
|
||||
EXPECT_EQ(expected_params, format.parameters);
|
||||
format.parameters.clear();
|
||||
format.name = "L16";
|
||||
|
||||
@ -1839,7 +1839,7 @@ bool IsFmtpParam(absl::string_view name) {
|
||||
return name != kCodecParamPTime && name != kCodecParamMaxPTime;
|
||||
}
|
||||
|
||||
bool WriteFmtpParameters(const cricket::CodecParameterMap& parameters,
|
||||
bool WriteFmtpParameters(const webrtc::CodecParameterMap& parameters,
|
||||
rtc::StringBuilder* os) {
|
||||
bool empty = true;
|
||||
const char* delimiter = ""; // No delimiter before first parameter.
|
||||
@ -1902,7 +1902,7 @@ bool GetMinValue(const std::vector<int>& values, int* value) {
|
||||
}
|
||||
|
||||
bool GetParameter(const std::string& name,
|
||||
const cricket::CodecParameterMap& params,
|
||||
const webrtc::CodecParameterMap& params,
|
||||
int* value) {
|
||||
std::map<std::string, std::string>::const_iterator found = params.find(name);
|
||||
if (found == params.end()) {
|
||||
@ -2876,7 +2876,7 @@ bool ParseMediaDescription(
|
||||
return true;
|
||||
}
|
||||
|
||||
void AddParameters(const cricket::CodecParameterMap& parameters,
|
||||
void AddParameters(const webrtc::CodecParameterMap& parameters,
|
||||
cricket::Codec* codec) {
|
||||
for (const auto& entry : parameters) {
|
||||
const std::string& key = entry.first;
|
||||
@ -2939,7 +2939,7 @@ void AddOrReplaceCodec(MediaContentDescription* content_desc,
|
||||
// to `parameters`.
|
||||
void UpdateCodec(MediaContentDescription* content_desc,
|
||||
int payload_type,
|
||||
const cricket::CodecParameterMap& parameters) {
|
||||
const webrtc::CodecParameterMap& parameters) {
|
||||
// Codec might already have been populated (from rtpmap).
|
||||
cricket::Codec new_codec = GetCodecWithPayloadType(
|
||||
content_desc->type(), content_desc->codecs(), payload_type);
|
||||
@ -3762,7 +3762,7 @@ bool ParseFmtpAttributes(absl::string_view line,
|
||||
}
|
||||
|
||||
// Parse out format specific parameters.
|
||||
cricket::CodecParameterMap codec_params;
|
||||
webrtc::CodecParameterMap codec_params;
|
||||
for (absl::string_view param :
|
||||
rtc::split(line_params, kSdpDelimiterSemicolonChar)) {
|
||||
std::string name;
|
||||
|
||||
@ -109,7 +109,7 @@ RTC_EXPORT bool ParseCandidate(absl::string_view message,
|
||||
// parameters are not considered to be part of the FMTP line, see the function
|
||||
// IsFmtpParam(). Returns true if the set of FMTP parameters is nonempty, false
|
||||
// otherwise.
|
||||
bool WriteFmtpParameters(const cricket::CodecParameterMap& parameters,
|
||||
bool WriteFmtpParameters(const webrtc::CodecParameterMap& parameters,
|
||||
rtc::StringBuilder* os);
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -1815,10 +1815,10 @@ class WebRtcSdpTest : public ::testing::Test {
|
||||
}
|
||||
}
|
||||
|
||||
void VerifyCodecParameter(const cricket::CodecParameterMap& params,
|
||||
void VerifyCodecParameter(const webrtc::CodecParameterMap& params,
|
||||
const std::string& name,
|
||||
int expected_value) {
|
||||
cricket::CodecParameterMap::const_iterator found = params.find(name);
|
||||
webrtc::CodecParameterMap::const_iterator found = params.find(name);
|
||||
ASSERT_TRUE(found != params.end());
|
||||
EXPECT_EQ(found->second, rtc::ToString(expected_value));
|
||||
}
|
||||
@ -2449,7 +2449,7 @@ TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithoutRtpmapButWithFmtp) {
|
||||
EXPECT_EQ("G729", g729.name);
|
||||
EXPECT_EQ(8000, g729.clockrate);
|
||||
EXPECT_EQ(18, g729.id);
|
||||
cricket::CodecParameterMap::iterator found = g729.params.find("annexb");
|
||||
webrtc::CodecParameterMap::iterator found = g729.params.find("annexb");
|
||||
ASSERT_TRUE(found != g729.params.end());
|
||||
EXPECT_EQ(found->second, "yes");
|
||||
|
||||
@ -3292,7 +3292,7 @@ TEST_F(WebRtcSdpTest, DeserializeVideoFmtp) {
|
||||
cricket::VideoCodec vp8 = vcd->codecs()[0];
|
||||
EXPECT_EQ("VP8", vp8.name);
|
||||
EXPECT_EQ(120, vp8.id);
|
||||
cricket::CodecParameterMap::iterator found =
|
||||
webrtc::CodecParameterMap::iterator found =
|
||||
vp8.params.find("x-google-min-bitrate");
|
||||
ASSERT_TRUE(found != vp8.params.end());
|
||||
EXPECT_EQ(found->second, "10");
|
||||
@ -3326,7 +3326,7 @@ TEST_F(WebRtcSdpTest, DeserializeVideoFmtpWithSprops) {
|
||||
cricket::VideoCodec h264 = vcd->codecs()[0];
|
||||
EXPECT_EQ("H264", h264.name);
|
||||
EXPECT_EQ(98, h264.id);
|
||||
cricket::CodecParameterMap::const_iterator found =
|
||||
webrtc::CodecParameterMap::const_iterator found =
|
||||
h264.params.find("profile-level-id");
|
||||
ASSERT_TRUE(found != h264.params.end());
|
||||
EXPECT_EQ(found->second, "42A01E");
|
||||
@ -3359,7 +3359,7 @@ TEST_F(WebRtcSdpTest, DeserializeVideoFmtpWithSpace) {
|
||||
cricket::VideoCodec vp8 = vcd->codecs()[0];
|
||||
EXPECT_EQ("VP8", vp8.name);
|
||||
EXPECT_EQ(120, vp8.id);
|
||||
cricket::CodecParameterMap::iterator found =
|
||||
webrtc::CodecParameterMap::iterator found =
|
||||
vp8.params.find("x-google-min-bitrate");
|
||||
ASSERT_TRUE(found != vp8.params.end());
|
||||
EXPECT_EQ(found->second, "10");
|
||||
|
||||
@ -89,7 +89,7 @@ SendAudioStream::SendAudioStream(
|
||||
AudioSendStream::Config send_config(send_transport);
|
||||
ssrc_ = sender->GetNextAudioSsrc();
|
||||
send_config.rtp.ssrc = ssrc_;
|
||||
SdpAudioFormat::Parameters sdp_params;
|
||||
CodecParameterMap sdp_params;
|
||||
if (config.source.channels == 2)
|
||||
sdp_params["stereo"] = "1";
|
||||
if (config.encoder.initial_frame_length != TimeDelta::Millis(20))
|
||||
|
||||
@ -135,7 +135,7 @@ TEST(FullStackTest, Generator_Net_Delay_0_0_Plr_0_VP9Profile2) {
|
||||
return;
|
||||
auto fixture = CreateVideoQualityTestFixture();
|
||||
|
||||
SdpVideoFormat::Parameters vp92 = {
|
||||
CodecParameterMap vp92 = {
|
||||
{kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile2)}};
|
||||
ParamsWithLogging generator;
|
||||
generator.call.send_side_bwe = true;
|
||||
|
||||
@ -353,7 +353,7 @@ RtpVideoStreamReceiver2::~RtpVideoStreamReceiver2() {
|
||||
void RtpVideoStreamReceiver2::AddReceiveCodec(
|
||||
uint8_t payload_type,
|
||||
VideoCodecType video_codec,
|
||||
const std::map<std::string, std::string>& codec_params,
|
||||
const webrtc::CodecParameterMap& codec_params,
|
||||
bool raw_payload) {
|
||||
RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
|
||||
if (codec_params.count(cricket::kH264FmtpSpsPpsIdrInKeyframe) > 0 ||
|
||||
|
||||
@ -102,7 +102,7 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender,
|
||||
|
||||
void AddReceiveCodec(uint8_t payload_type,
|
||||
VideoCodecType video_codec,
|
||||
const std::map<std::string, std::string>& codec_params,
|
||||
const webrtc::CodecParameterMap& codec_params,
|
||||
bool raw_payload);
|
||||
void RemoveReceiveCodec(uint8_t payload_type);
|
||||
|
||||
@ -393,7 +393,7 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender,
|
||||
// TODO(johan): Remove pt_codec_params_ once
|
||||
// https://bugs.chromium.org/p/webrtc/issues/detail?id=6883 is resolved.
|
||||
// Maps a payload type to a map of out-of-band supplied codec parameters.
|
||||
std::map<uint8_t, std::map<std::string, std::string>> pt_codec_params_
|
||||
std::map<uint8_t, webrtc::CodecParameterMap> pt_codec_params_
|
||||
RTC_GUARDED_BY(packet_sequence_checker_);
|
||||
int16_t last_payload_type_ RTC_GUARDED_BY(packet_sequence_checker_) = -1;
|
||||
|
||||
|
||||
@ -307,7 +307,7 @@ TEST_F(RtpVideoStreamReceiver2Test, CacheColorSpaceFromLastPacketOfKeyframe) {
|
||||
received_packet_generator.SetColorSpace(kColorSpace);
|
||||
|
||||
// Prepare the receiver for VP9.
|
||||
std::map<std::string, std::string> codec_params;
|
||||
webrtc::CodecParameterMap codec_params;
|
||||
rtp_video_stream_receiver_->AddReceiveCodec(kVp9PayloadType, kVideoCodecVP9,
|
||||
codec_params,
|
||||
/*raw_payload=*/false);
|
||||
@ -571,7 +571,7 @@ TEST_P(RtpVideoStreamReceiver2TestH264, InBandSpsPps) {
|
||||
|
||||
TEST_P(RtpVideoStreamReceiver2TestH264, OutOfBandFmtpSpsPps) {
|
||||
constexpr int kPayloadType = 99;
|
||||
std::map<std::string, std::string> codec_params;
|
||||
webrtc::CodecParameterMap codec_params;
|
||||
// Example parameter sets from https://tools.ietf.org/html/rfc3984#section-8.2
|
||||
// .
|
||||
codec_params.insert(
|
||||
@ -612,7 +612,7 @@ TEST_P(RtpVideoStreamReceiver2TestH264, OutOfBandFmtpSpsPps) {
|
||||
|
||||
TEST_P(RtpVideoStreamReceiver2TestH264, ForceSpsPpsIdrIsKeyframe) {
|
||||
constexpr int kPayloadType = 99;
|
||||
std::map<std::string, std::string> codec_params;
|
||||
webrtc::CodecParameterMap codec_params;
|
||||
if (GetParam() ==
|
||||
"") { // Forcing can be done either with field trial or codec_params.
|
||||
codec_params.insert({cricket::kH264FmtpSpsPpsIdrInKeyframe, ""});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user