mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
Deprecate cricket::VideoCodec and cricket::AudioCodec
These are aliases for cricket::Codec. Also remove internal usage Bug: b/42225532 Change-Id: I220b95260dc942368cb6280432a058159eec8700 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/349321 Commit-Queue: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Florent Castelli <orphis@webrtc.org> Cr-Commit-Position: refs/heads/main@{#42194}
This commit is contained in:
parent
64437e8cc0
commit
d78e30e00b
30 changed files with 546 additions and 588 deletions
|
@ -200,11 +200,12 @@ struct RTC_EXPORT Codec {
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO(webrtc:15214): Compatibility names, to be migrated away and removed.
|
// TODO(webrtc:15214): Compatibility names, to be migrated away and removed.
|
||||||
using VideoCodec = Codec;
|
using VideoCodec [[deprecated]] = Codec;
|
||||||
using AudioCodec = Codec;
|
using AudioCodec [[deprecated]] = Codec;
|
||||||
|
|
||||||
using VideoCodecs = std::vector<Codec>;
|
using VideoCodecs [[deprecated]] = std::vector<Codec>;
|
||||||
using AudioCodecs = std::vector<Codec>;
|
using AudioCodecs [[deprecated]] = std::vector<Codec>;
|
||||||
|
using Codecs = std::vector<Codec>;
|
||||||
|
|
||||||
Codec CreateAudioCodec(int id,
|
Codec CreateAudioCodec(int id,
|
||||||
const std::string& name,
|
const std::string& name,
|
||||||
|
|
|
@ -18,13 +18,11 @@
|
||||||
#include "modules/video_coding/codecs/h264/include/h264.h"
|
#include "modules/video_coding/codecs/h264/include/h264.h"
|
||||||
#include "rtc_base/gunit.h"
|
#include "rtc_base/gunit.h"
|
||||||
|
|
||||||
using cricket::AudioCodec;
|
|
||||||
using cricket::Codec;
|
using cricket::Codec;
|
||||||
using cricket::FeedbackParam;
|
using cricket::FeedbackParam;
|
||||||
using cricket::kCodecParamAssociatedPayloadType;
|
using cricket::kCodecParamAssociatedPayloadType;
|
||||||
using cricket::kCodecParamMaxBitrate;
|
using cricket::kCodecParamMaxBitrate;
|
||||||
using cricket::kCodecParamMinBitrate;
|
using cricket::kCodecParamMinBitrate;
|
||||||
using cricket::VideoCodec;
|
|
||||||
|
|
||||||
class TestCodec : public Codec {
|
class TestCodec : public Codec {
|
||||||
public:
|
public:
|
||||||
|
@ -69,27 +67,27 @@ TEST(CodecTest, TestCodecOperators) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CodecTest, TestAudioCodecOperators) {
|
TEST(CodecTest, TestAudioCodecOperators) {
|
||||||
AudioCodec c0 = cricket::CreateAudioCodec(96, "A", 44100, 2);
|
Codec c0 = cricket::CreateAudioCodec(96, "A", 44100, 2);
|
||||||
AudioCodec c1 = cricket::CreateAudioCodec(95, "A", 44100, 2);
|
Codec c1 = cricket::CreateAudioCodec(95, "A", 44100, 2);
|
||||||
AudioCodec c2 = cricket::CreateAudioCodec(96, "x", 44100, 2);
|
Codec c2 = cricket::CreateAudioCodec(96, "x", 44100, 2);
|
||||||
AudioCodec c3 = cricket::CreateAudioCodec(96, "A", 48000, 2);
|
Codec c3 = cricket::CreateAudioCodec(96, "A", 48000, 2);
|
||||||
AudioCodec c4 = cricket::CreateAudioCodec(96, "A", 44100, 2);
|
Codec c4 = cricket::CreateAudioCodec(96, "A", 44100, 2);
|
||||||
c4.bitrate = 10000;
|
c4.bitrate = 10000;
|
||||||
AudioCodec c5 = cricket::CreateAudioCodec(96, "A", 44100, 1);
|
Codec c5 = cricket::CreateAudioCodec(96, "A", 44100, 1);
|
||||||
EXPECT_NE(c0, c1);
|
EXPECT_NE(c0, c1);
|
||||||
EXPECT_NE(c0, c2);
|
EXPECT_NE(c0, c2);
|
||||||
EXPECT_NE(c0, c3);
|
EXPECT_NE(c0, c3);
|
||||||
EXPECT_NE(c0, c4);
|
EXPECT_NE(c0, c4);
|
||||||
EXPECT_NE(c0, c5);
|
EXPECT_NE(c0, c5);
|
||||||
|
|
||||||
AudioCodec c8 = cricket::CreateAudioCodec(0, "", 0, 0);
|
Codec c8 = cricket::CreateAudioCodec(0, "", 0, 0);
|
||||||
AudioCodec c9 = c0;
|
Codec c9 = c0;
|
||||||
EXPECT_EQ(c9, c0);
|
EXPECT_EQ(c9, c0);
|
||||||
|
|
||||||
AudioCodec c10(c0);
|
Codec c10(c0);
|
||||||
AudioCodec c11(c0);
|
Codec c11(c0);
|
||||||
AudioCodec c12(c0);
|
Codec c12(c0);
|
||||||
AudioCodec c13(c0);
|
Codec c13(c0);
|
||||||
c10.params["x"] = "abc";
|
c10.params["x"] = "abc";
|
||||||
c11.params["x"] = "def";
|
c11.params["x"] = "def";
|
||||||
c12.params["y"] = "abc";
|
c12.params["y"] = "abc";
|
||||||
|
@ -103,9 +101,9 @@ TEST(CodecTest, TestAudioCodecOperators) {
|
||||||
EXPECT_EQ(c13, c10);
|
EXPECT_EQ(c13, c10);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CodecTest, TestAudioCodecMatches) {
|
TEST(CodecTest, TestCodecMatches) {
|
||||||
// Test a codec with a static payload type.
|
// Test a codec with a static payload type.
|
||||||
AudioCodec c0 = cricket::CreateAudioCodec(34, "A", 44100, 1);
|
Codec c0 = cricket::CreateAudioCodec(34, "A", 44100, 1);
|
||||||
EXPECT_TRUE(c0.Matches(cricket::CreateAudioCodec(34, "", 44100, 1)));
|
EXPECT_TRUE(c0.Matches(cricket::CreateAudioCodec(34, "", 44100, 1)));
|
||||||
EXPECT_TRUE(c0.Matches(cricket::CreateAudioCodec(34, "", 44100, 0)));
|
EXPECT_TRUE(c0.Matches(cricket::CreateAudioCodec(34, "", 44100, 0)));
|
||||||
EXPECT_TRUE(c0.Matches(cricket::CreateAudioCodec(34, "", 44100, 0)));
|
EXPECT_TRUE(c0.Matches(cricket::CreateAudioCodec(34, "", 44100, 0)));
|
||||||
|
@ -118,7 +116,7 @@ TEST(CodecTest, TestAudioCodecMatches) {
|
||||||
EXPECT_FALSE(c0.Matches(cricket::CreateAudioCodec(95, "", 55100, 2)));
|
EXPECT_FALSE(c0.Matches(cricket::CreateAudioCodec(95, "", 55100, 2)));
|
||||||
|
|
||||||
// Test a codec with a dynamic payload type.
|
// Test a codec with a dynamic payload type.
|
||||||
AudioCodec c1 = cricket::CreateAudioCodec(96, "A", 44100, 1);
|
Codec c1 = cricket::CreateAudioCodec(96, "A", 44100, 1);
|
||||||
EXPECT_TRUE(c1.Matches(cricket::CreateAudioCodec(96, "A", 0, 0)));
|
EXPECT_TRUE(c1.Matches(cricket::CreateAudioCodec(96, "A", 0, 0)));
|
||||||
EXPECT_TRUE(c1.Matches(cricket::CreateAudioCodec(97, "A", 0, 0)));
|
EXPECT_TRUE(c1.Matches(cricket::CreateAudioCodec(97, "A", 0, 0)));
|
||||||
EXPECT_TRUE(c1.Matches(cricket::CreateAudioCodec(96, "a", 0, 0)));
|
EXPECT_TRUE(c1.Matches(cricket::CreateAudioCodec(96, "a", 0, 0)));
|
||||||
|
@ -132,7 +130,7 @@ TEST(CodecTest, TestAudioCodecMatches) {
|
||||||
EXPECT_FALSE(c1.Matches(cricket::CreateAudioCodec(96, "A", 55100, 1)));
|
EXPECT_FALSE(c1.Matches(cricket::CreateAudioCodec(96, "A", 55100, 1)));
|
||||||
|
|
||||||
// Test a codec with a dynamic payload type, and auto bitrate.
|
// Test a codec with a dynamic payload type, and auto bitrate.
|
||||||
AudioCodec c2 = cricket::CreateAudioCodec(97, "A", 16000, 1);
|
Codec c2 = cricket::CreateAudioCodec(97, "A", 16000, 1);
|
||||||
// Use default bitrate.
|
// Use default bitrate.
|
||||||
EXPECT_TRUE(c2.Matches(cricket::CreateAudioCodec(97, "A", 16000, 1)));
|
EXPECT_TRUE(c2.Matches(cricket::CreateAudioCodec(97, "A", 16000, 1)));
|
||||||
EXPECT_TRUE(c2.Matches(cricket::CreateAudioCodec(97, "A", 16000, 0)));
|
EXPECT_TRUE(c2.Matches(cricket::CreateAudioCodec(97, "A", 16000, 0)));
|
||||||
|
@ -142,16 +140,16 @@ TEST(CodecTest, TestAudioCodecMatches) {
|
||||||
EXPECT_TRUE(c2.Matches(cricket::CreateAudioCodec(97, "A", 16000, 1)));
|
EXPECT_TRUE(c2.Matches(cricket::CreateAudioCodec(97, "A", 16000, 1)));
|
||||||
|
|
||||||
// Stereo doesn't match channels = 0.
|
// Stereo doesn't match channels = 0.
|
||||||
AudioCodec c3 = cricket::CreateAudioCodec(96, "A", 44100, 2);
|
Codec c3 = cricket::CreateAudioCodec(96, "A", 44100, 2);
|
||||||
EXPECT_TRUE(c3.Matches(cricket::CreateAudioCodec(96, "A", 44100, 2)));
|
EXPECT_TRUE(c3.Matches(cricket::CreateAudioCodec(96, "A", 44100, 2)));
|
||||||
EXPECT_FALSE(c3.Matches(cricket::CreateAudioCodec(96, "A", 44100, 1)));
|
EXPECT_FALSE(c3.Matches(cricket::CreateAudioCodec(96, "A", 44100, 1)));
|
||||||
EXPECT_FALSE(c3.Matches(cricket::CreateAudioCodec(96, "A", 44100, 0)));
|
EXPECT_FALSE(c3.Matches(cricket::CreateAudioCodec(96, "A", 44100, 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CodecTest, TestOpusAudioCodecWithDifferentParameters) {
|
TEST(CodecTest, TestOpusAudioCodecWithDifferentParameters) {
|
||||||
AudioCodec opus_with_fec = cricket::CreateAudioCodec(96, "opus", 48000, 2);
|
Codec opus_with_fec = cricket::CreateAudioCodec(96, "opus", 48000, 2);
|
||||||
opus_with_fec.params["useinbandfec"] = "1";
|
opus_with_fec.params["useinbandfec"] = "1";
|
||||||
AudioCodec opus_without_fec = cricket::CreateAudioCodec(96, "opus", 48000, 2);
|
Codec opus_without_fec = cricket::CreateAudioCodec(96, "opus", 48000, 2);
|
||||||
|
|
||||||
EXPECT_TRUE(opus_with_fec != opus_without_fec);
|
EXPECT_TRUE(opus_with_fec != opus_without_fec);
|
||||||
// Matches does not compare parameters for audio.
|
// Matches does not compare parameters for audio.
|
||||||
|
@ -165,21 +163,21 @@ TEST(CodecTest, TestOpusAudioCodecWithDifferentParameters) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CodecTest, TestVideoCodecOperators) {
|
TEST(CodecTest, TestVideoCodecOperators) {
|
||||||
VideoCodec c0 = cricket::CreateVideoCodec(96, "V");
|
Codec c0 = cricket::CreateVideoCodec(96, "V");
|
||||||
VideoCodec c1 = cricket::CreateVideoCodec(95, "V");
|
Codec c1 = cricket::CreateVideoCodec(95, "V");
|
||||||
VideoCodec c2 = cricket::CreateVideoCodec(96, "x");
|
Codec c2 = cricket::CreateVideoCodec(96, "x");
|
||||||
|
|
||||||
EXPECT_TRUE(c0 != c1);
|
EXPECT_TRUE(c0 != c1);
|
||||||
EXPECT_TRUE(c0 != c2);
|
EXPECT_TRUE(c0 != c2);
|
||||||
|
|
||||||
VideoCodec c8 = cricket::CreateVideoCodec(0, "");
|
Codec c8 = cricket::CreateVideoCodec(0, "");
|
||||||
VideoCodec c9 = c0;
|
Codec c9 = c0;
|
||||||
EXPECT_TRUE(c9 == c0);
|
EXPECT_TRUE(c9 == c0);
|
||||||
|
|
||||||
VideoCodec c10(c0);
|
Codec c10(c0);
|
||||||
VideoCodec c11(c0);
|
Codec c11(c0);
|
||||||
VideoCodec c12(c0);
|
Codec c12(c0);
|
||||||
VideoCodec c13(c0);
|
Codec c13(c0);
|
||||||
c10.params["x"] = "abc";
|
c10.params["x"] = "abc";
|
||||||
c11.params["x"] = "def";
|
c11.params["x"] = "def";
|
||||||
c12.params["y"] = "abc";
|
c12.params["y"] = "abc";
|
||||||
|
@ -194,9 +192,9 @@ TEST(CodecTest, TestVideoCodecOperators) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CodecTest, TestVideoCodecEqualsWithDifferentPacketization) {
|
TEST(CodecTest, TestVideoCodecEqualsWithDifferentPacketization) {
|
||||||
VideoCodec c0 = cricket::CreateVideoCodec(100, cricket::kVp8CodecName);
|
Codec c0 = cricket::CreateVideoCodec(100, cricket::kVp8CodecName);
|
||||||
VideoCodec c1 = cricket::CreateVideoCodec(100, cricket::kVp8CodecName);
|
Codec c1 = cricket::CreateVideoCodec(100, cricket::kVp8CodecName);
|
||||||
VideoCodec c2 = cricket::CreateVideoCodec(100, cricket::kVp8CodecName);
|
Codec c2 = cricket::CreateVideoCodec(100, cricket::kVp8CodecName);
|
||||||
c2.packetization = "raw";
|
c2.packetization = "raw";
|
||||||
|
|
||||||
EXPECT_EQ(c0, c1);
|
EXPECT_EQ(c0, c1);
|
||||||
|
@ -207,13 +205,13 @@ TEST(CodecTest, TestVideoCodecEqualsWithDifferentPacketization) {
|
||||||
|
|
||||||
TEST(CodecTest, TestVideoCodecMatches) {
|
TEST(CodecTest, TestVideoCodecMatches) {
|
||||||
// Test a codec with a static payload type.
|
// Test a codec with a static payload type.
|
||||||
VideoCodec c0 = cricket::CreateVideoCodec(34, "V");
|
Codec c0 = cricket::CreateVideoCodec(34, "V");
|
||||||
EXPECT_TRUE(c0.Matches(cricket::CreateVideoCodec(34, "")));
|
EXPECT_TRUE(c0.Matches(cricket::CreateVideoCodec(34, "")));
|
||||||
EXPECT_FALSE(c0.Matches(cricket::CreateVideoCodec(96, "")));
|
EXPECT_FALSE(c0.Matches(cricket::CreateVideoCodec(96, "")));
|
||||||
EXPECT_FALSE(c0.Matches(cricket::CreateVideoCodec(96, "V")));
|
EXPECT_FALSE(c0.Matches(cricket::CreateVideoCodec(96, "V")));
|
||||||
|
|
||||||
// Test a codec with a dynamic payload type.
|
// Test a codec with a dynamic payload type.
|
||||||
VideoCodec c1 = cricket::CreateVideoCodec(96, "V");
|
Codec c1 = cricket::CreateVideoCodec(96, "V");
|
||||||
EXPECT_TRUE(c1.Matches(cricket::CreateVideoCodec(96, "V")));
|
EXPECT_TRUE(c1.Matches(cricket::CreateVideoCodec(96, "V")));
|
||||||
EXPECT_TRUE(c1.Matches(cricket::CreateVideoCodec(97, "V")));
|
EXPECT_TRUE(c1.Matches(cricket::CreateVideoCodec(97, "V")));
|
||||||
EXPECT_TRUE(c1.Matches(cricket::CreateVideoCodec(96, "v")));
|
EXPECT_TRUE(c1.Matches(cricket::CreateVideoCodec(96, "v")));
|
||||||
|
@ -227,8 +225,8 @@ TEST(CodecTest, TestVideoCodecMatches) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CodecTest, TestVideoCodecMatchesWithDifferentPacketization) {
|
TEST(CodecTest, TestVideoCodecMatchesWithDifferentPacketization) {
|
||||||
VideoCodec c0 = cricket::CreateVideoCodec(100, cricket::kVp8CodecName);
|
Codec c0 = cricket::CreateVideoCodec(100, cricket::kVp8CodecName);
|
||||||
VideoCodec c1 = cricket::CreateVideoCodec(101, cricket::kVp8CodecName);
|
Codec c1 = cricket::CreateVideoCodec(101, cricket::kVp8CodecName);
|
||||||
c1.packetization = "raw";
|
c1.packetization = "raw";
|
||||||
|
|
||||||
EXPECT_TRUE(c0.Matches(c1));
|
EXPECT_TRUE(c0.Matches(c1));
|
||||||
|
@ -241,13 +239,12 @@ TEST(CodecTest, TestAV1CodecMatches) {
|
||||||
const char kProfile1[] = "1";
|
const char kProfile1[] = "1";
|
||||||
const char kProfile2[] = "2";
|
const char kProfile2[] = "2";
|
||||||
|
|
||||||
VideoCodec c_no_profile =
|
Codec c_no_profile = cricket::CreateVideoCodec(95, cricket::kAv1CodecName);
|
||||||
cricket::CreateVideoCodec(95, cricket::kAv1CodecName);
|
Codec c_profile0 = cricket::CreateVideoCodec(95, cricket::kAv1CodecName);
|
||||||
VideoCodec c_profile0 = cricket::CreateVideoCodec(95, cricket::kAv1CodecName);
|
|
||||||
c_profile0.params[cricket::kAv1FmtpProfile] = kProfile0;
|
c_profile0.params[cricket::kAv1FmtpProfile] = kProfile0;
|
||||||
VideoCodec c_profile1 = cricket::CreateVideoCodec(95, cricket::kAv1CodecName);
|
Codec c_profile1 = cricket::CreateVideoCodec(95, cricket::kAv1CodecName);
|
||||||
c_profile1.params[cricket::kAv1FmtpProfile] = kProfile1;
|
c_profile1.params[cricket::kAv1FmtpProfile] = kProfile1;
|
||||||
VideoCodec c_profile2 = cricket::CreateVideoCodec(95, cricket::kAv1CodecName);
|
Codec c_profile2 = cricket::CreateVideoCodec(95, cricket::kAv1CodecName);
|
||||||
c_profile2.params[cricket::kAv1FmtpProfile] = kProfile2;
|
c_profile2.params[cricket::kAv1FmtpProfile] = kProfile2;
|
||||||
|
|
||||||
// An AV1 entry with no profile specified should be treated as profile-0.
|
// An AV1 entry with no profile specified should be treated as profile-0.
|
||||||
|
@ -255,23 +252,21 @@ TEST(CodecTest, TestAV1CodecMatches) {
|
||||||
|
|
||||||
{
|
{
|
||||||
// Two AV1 entries without a profile specified are treated as duplicates.
|
// Two AV1 entries without a profile specified are treated as duplicates.
|
||||||
VideoCodec c_no_profile_eq =
|
Codec c_no_profile_eq =
|
||||||
cricket::CreateVideoCodec(95, cricket::kAv1CodecName);
|
cricket::CreateVideoCodec(95, cricket::kAv1CodecName);
|
||||||
EXPECT_TRUE(c_no_profile.Matches(c_no_profile_eq));
|
EXPECT_TRUE(c_no_profile.Matches(c_no_profile_eq));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// Two AV1 entries with profile 0 specified are treated as duplicates.
|
// Two AV1 entries with profile 0 specified are treated as duplicates.
|
||||||
VideoCodec c_profile0_eq =
|
Codec c_profile0_eq = cricket::CreateVideoCodec(95, cricket::kAv1CodecName);
|
||||||
cricket::CreateVideoCodec(95, cricket::kAv1CodecName);
|
|
||||||
c_profile0_eq.params[cricket::kAv1FmtpProfile] = kProfile0;
|
c_profile0_eq.params[cricket::kAv1FmtpProfile] = kProfile0;
|
||||||
EXPECT_TRUE(c_profile0.Matches(c_profile0_eq));
|
EXPECT_TRUE(c_profile0.Matches(c_profile0_eq));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// Two AV1 entries with profile 1 specified are treated as duplicates.
|
// Two AV1 entries with profile 1 specified are treated as duplicates.
|
||||||
VideoCodec c_profile1_eq =
|
Codec c_profile1_eq = cricket::CreateVideoCodec(95, cricket::kAv1CodecName);
|
||||||
cricket::CreateVideoCodec(95, cricket::kAv1CodecName);
|
|
||||||
c_profile1_eq.params[cricket::kAv1FmtpProfile] = kProfile1;
|
c_profile1_eq.params[cricket::kAv1FmtpProfile] = kProfile1;
|
||||||
EXPECT_TRUE(c_profile1.Matches(c_profile1_eq));
|
EXPECT_TRUE(c_profile1.Matches(c_profile1_eq));
|
||||||
}
|
}
|
||||||
|
@ -290,30 +285,27 @@ TEST(CodecTest, TestVP9CodecMatches) {
|
||||||
const char kProfile0[] = "0";
|
const char kProfile0[] = "0";
|
||||||
const char kProfile2[] = "2";
|
const char kProfile2[] = "2";
|
||||||
|
|
||||||
VideoCodec c_no_profile =
|
Codec c_no_profile = cricket::CreateVideoCodec(95, cricket::kVp9CodecName);
|
||||||
cricket::CreateVideoCodec(95, cricket::kVp9CodecName);
|
Codec c_profile0 = cricket::CreateVideoCodec(95, cricket::kVp9CodecName);
|
||||||
VideoCodec c_profile0 = cricket::CreateVideoCodec(95, cricket::kVp9CodecName);
|
|
||||||
c_profile0.params[webrtc::kVP9FmtpProfileId] = kProfile0;
|
c_profile0.params[webrtc::kVP9FmtpProfileId] = kProfile0;
|
||||||
|
|
||||||
EXPECT_TRUE(c_profile0.Matches(c_no_profile));
|
EXPECT_TRUE(c_profile0.Matches(c_no_profile));
|
||||||
|
|
||||||
{
|
{
|
||||||
VideoCodec c_profile0_eq =
|
Codec c_profile0_eq = cricket::CreateVideoCodec(95, cricket::kVp9CodecName);
|
||||||
cricket::CreateVideoCodec(95, cricket::kVp9CodecName);
|
|
||||||
c_profile0_eq.params[webrtc::kVP9FmtpProfileId] = kProfile0;
|
c_profile0_eq.params[webrtc::kVP9FmtpProfileId] = kProfile0;
|
||||||
EXPECT_TRUE(c_profile0.Matches(c_profile0_eq));
|
EXPECT_TRUE(c_profile0.Matches(c_profile0_eq));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
VideoCodec c_profile2 =
|
Codec c_profile2 = cricket::CreateVideoCodec(95, cricket::kVp9CodecName);
|
||||||
cricket::CreateVideoCodec(95, cricket::kVp9CodecName);
|
|
||||||
c_profile2.params[webrtc::kVP9FmtpProfileId] = kProfile2;
|
c_profile2.params[webrtc::kVP9FmtpProfileId] = kProfile2;
|
||||||
EXPECT_FALSE(c_profile0.Matches(c_profile2));
|
EXPECT_FALSE(c_profile0.Matches(c_profile2));
|
||||||
EXPECT_FALSE(c_no_profile.Matches(c_profile2));
|
EXPECT_FALSE(c_no_profile.Matches(c_profile2));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
VideoCodec c_no_profile_eq =
|
Codec c_no_profile_eq =
|
||||||
cricket::CreateVideoCodec(95, cricket::kVp9CodecName);
|
cricket::CreateVideoCodec(95, cricket::kVp9CodecName);
|
||||||
EXPECT_TRUE(c_no_profile.Matches(c_no_profile_eq));
|
EXPECT_TRUE(c_no_profile.Matches(c_no_profile_eq));
|
||||||
}
|
}
|
||||||
|
@ -326,12 +318,12 @@ TEST(CodecTest, TestH264CodecMatches) {
|
||||||
const char kProfileLevelId2[] = "42a01e";
|
const char kProfileLevelId2[] = "42a01e";
|
||||||
const char kProfileLevelId3[] = "42e01e";
|
const char kProfileLevelId3[] = "42e01e";
|
||||||
|
|
||||||
VideoCodec pli_1_pm_0 = cricket::CreateVideoCodec(95, "H264");
|
Codec pli_1_pm_0 = cricket::CreateVideoCodec(95, "H264");
|
||||||
pli_1_pm_0.params[cricket::kH264FmtpProfileLevelId] = kProfileLevelId1;
|
pli_1_pm_0.params[cricket::kH264FmtpProfileLevelId] = kProfileLevelId1;
|
||||||
pli_1_pm_0.params[cricket::kH264FmtpPacketizationMode] = "0";
|
pli_1_pm_0.params[cricket::kH264FmtpPacketizationMode] = "0";
|
||||||
|
|
||||||
{
|
{
|
||||||
VideoCodec pli_1_pm_blank = cricket::CreateVideoCodec(95, "H264");
|
Codec pli_1_pm_blank = cricket::CreateVideoCodec(95, "H264");
|
||||||
pli_1_pm_blank.params[cricket::kH264FmtpProfileLevelId] = kProfileLevelId1;
|
pli_1_pm_blank.params[cricket::kH264FmtpProfileLevelId] = kProfileLevelId1;
|
||||||
pli_1_pm_blank.params.erase(
|
pli_1_pm_blank.params.erase(
|
||||||
pli_1_pm_blank.params.find(cricket::kH264FmtpPacketizationMode));
|
pli_1_pm_blank.params.find(cricket::kH264FmtpPacketizationMode));
|
||||||
|
@ -345,7 +337,7 @@ TEST(CodecTest, TestH264CodecMatches) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
VideoCodec pli_1_pm_1 = cricket::CreateVideoCodec(95, "H264");
|
Codec pli_1_pm_1 = cricket::CreateVideoCodec(95, "H264");
|
||||||
pli_1_pm_1.params[cricket::kH264FmtpProfileLevelId] = kProfileLevelId1;
|
pli_1_pm_1.params[cricket::kH264FmtpProfileLevelId] = kProfileLevelId1;
|
||||||
pli_1_pm_1.params[cricket::kH264FmtpPacketizationMode] = "1";
|
pli_1_pm_1.params[cricket::kH264FmtpPacketizationMode] = "1";
|
||||||
|
|
||||||
|
@ -356,7 +348,7 @@ TEST(CodecTest, TestH264CodecMatches) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
VideoCodec pli_2_pm_0 = cricket::CreateVideoCodec(95, "H264");
|
Codec pli_2_pm_0 = cricket::CreateVideoCodec(95, "H264");
|
||||||
pli_2_pm_0.params[cricket::kH264FmtpProfileLevelId] = kProfileLevelId2;
|
pli_2_pm_0.params[cricket::kH264FmtpProfileLevelId] = kProfileLevelId2;
|
||||||
pli_2_pm_0.params[cricket::kH264FmtpPacketizationMode] = "0";
|
pli_2_pm_0.params[cricket::kH264FmtpPacketizationMode] = "0";
|
||||||
|
|
||||||
|
@ -367,7 +359,7 @@ TEST(CodecTest, TestH264CodecMatches) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
VideoCodec pli_3_pm_0_asym = cricket::CreateVideoCodec(95, "H264");
|
Codec pli_3_pm_0_asym = cricket::CreateVideoCodec(95, "H264");
|
||||||
pli_3_pm_0_asym.params[cricket::kH264FmtpProfileLevelId] = kProfileLevelId3;
|
pli_3_pm_0_asym.params[cricket::kH264FmtpProfileLevelId] = kProfileLevelId3;
|
||||||
pli_3_pm_0_asym.params[cricket::kH264FmtpPacketizationMode] = "0";
|
pli_3_pm_0_asym.params[cricket::kH264FmtpPacketizationMode] = "0";
|
||||||
|
|
||||||
|
@ -391,12 +383,10 @@ TEST(CodecTest, TestH265CodecMatches) {
|
||||||
constexpr char kLevel4[] = "120";
|
constexpr char kLevel4[] = "120";
|
||||||
constexpr char kTxMrst[] = "MRST";
|
constexpr char kTxMrst[] = "MRST";
|
||||||
|
|
||||||
VideoCodec c_ptl_blank =
|
Codec c_ptl_blank = cricket::CreateVideoCodec(95, cricket::kH265CodecName);
|
||||||
cricket::CreateVideoCodec(95, cricket::kH265CodecName);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
VideoCodec c_profile_1 =
|
Codec c_profile_1 = cricket::CreateVideoCodec(95, cricket::kH265CodecName);
|
||||||
cricket::CreateVideoCodec(95, cricket::kH265CodecName);
|
|
||||||
c_profile_1.params[cricket::kH265FmtpProfileId] = kProfile1;
|
c_profile_1.params[cricket::kH265FmtpProfileId] = kProfile1;
|
||||||
|
|
||||||
// Matches since profile-id unspecified defaults to "1".
|
// Matches since profile-id unspecified defaults to "1".
|
||||||
|
@ -404,7 +394,7 @@ TEST(CodecTest, TestH265CodecMatches) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
VideoCodec c_tier_flag_1 =
|
Codec c_tier_flag_1 =
|
||||||
cricket::CreateVideoCodec(95, cricket::kH265CodecName);
|
cricket::CreateVideoCodec(95, cricket::kH265CodecName);
|
||||||
c_tier_flag_1.params[cricket::kH265FmtpTierFlag] = kTier1;
|
c_tier_flag_1.params[cricket::kH265FmtpTierFlag] = kTier1;
|
||||||
|
|
||||||
|
@ -413,7 +403,7 @@ TEST(CodecTest, TestH265CodecMatches) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
VideoCodec c_level_id_3_1 =
|
Codec c_level_id_3_1 =
|
||||||
cricket::CreateVideoCodec(95, cricket::kH265CodecName);
|
cricket::CreateVideoCodec(95, cricket::kH265CodecName);
|
||||||
c_level_id_3_1.params[cricket::kH265FmtpLevelId] = kLevel3_1;
|
c_level_id_3_1.params[cricket::kH265FmtpLevelId] = kLevel3_1;
|
||||||
|
|
||||||
|
@ -422,8 +412,7 @@ TEST(CodecTest, TestH265CodecMatches) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
VideoCodec c_level_id_4 =
|
Codec c_level_id_4 = cricket::CreateVideoCodec(95, cricket::kH265CodecName);
|
||||||
cricket::CreateVideoCodec(95, cricket::kH265CodecName);
|
|
||||||
c_level_id_4.params[cricket::kH265FmtpLevelId] = kLevel4;
|
c_level_id_4.params[cricket::kH265FmtpLevelId] = kLevel4;
|
||||||
|
|
||||||
// Does not match since different level-ids are specified.
|
// Does not match since different level-ids are specified.
|
||||||
|
@ -431,7 +420,7 @@ TEST(CodecTest, TestH265CodecMatches) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
VideoCodec c_tx_mode_mrst =
|
Codec c_tx_mode_mrst =
|
||||||
cricket::CreateVideoCodec(95, cricket::kH265CodecName);
|
cricket::CreateVideoCodec(95, cricket::kH265CodecName);
|
||||||
c_tx_mode_mrst.params[cricket::kH265FmtpTxMode] = kTxMrst;
|
c_tx_mode_mrst.params[cricket::kH265FmtpTxMode] = kTxMrst;
|
||||||
|
|
||||||
|
@ -444,7 +433,7 @@ TEST(CodecTest, TestH265CodecMatches) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TEST(CodecTest, TestSetParamGetParamAndRemoveParam) {
|
TEST(CodecTest, TestSetParamGetParamAndRemoveParam) {
|
||||||
AudioCodec codec = cricket::CreateAudioCodec(0, "foo", 22222, 2);
|
Codec codec = cricket::CreateAudioCodec(0, "foo", 22222, 2);
|
||||||
codec.SetParam("a", "1");
|
codec.SetParam("a", "1");
|
||||||
codec.SetParam("b", "x");
|
codec.SetParam("b", "x");
|
||||||
|
|
||||||
|
@ -485,11 +474,11 @@ TEST(CodecTest, TestIntersectFeedbackParams) {
|
||||||
|
|
||||||
TEST(CodecTest, TestGetCodecType) {
|
TEST(CodecTest, TestGetCodecType) {
|
||||||
// Codec type comparison should be case insensitive on names.
|
// Codec type comparison should be case insensitive on names.
|
||||||
const VideoCodec codec = cricket::CreateVideoCodec(96, "V");
|
const Codec codec = cricket::CreateVideoCodec(96, "V");
|
||||||
const VideoCodec rtx_codec = cricket::CreateVideoCodec(96, "rTx");
|
const Codec rtx_codec = cricket::CreateVideoCodec(96, "rTx");
|
||||||
const VideoCodec ulpfec_codec = cricket::CreateVideoCodec(96, "ulpFeC");
|
const Codec ulpfec_codec = cricket::CreateVideoCodec(96, "ulpFeC");
|
||||||
const VideoCodec flexfec_codec = cricket::CreateVideoCodec(96, "FlExFeC-03");
|
const Codec flexfec_codec = cricket::CreateVideoCodec(96, "FlExFeC-03");
|
||||||
const VideoCodec red_codec = cricket::CreateVideoCodec(96, "ReD");
|
const Codec red_codec = cricket::CreateVideoCodec(96, "ReD");
|
||||||
EXPECT_TRUE(codec.IsMediaCodec());
|
EXPECT_TRUE(codec.IsMediaCodec());
|
||||||
EXPECT_EQ(codec.GetResiliencyType(), Codec::ResiliencyType::kNone);
|
EXPECT_EQ(codec.GetResiliencyType(), Codec::ResiliencyType::kNone);
|
||||||
EXPECT_EQ(rtx_codec.GetResiliencyType(), Codec::ResiliencyType::kRtx);
|
EXPECT_EQ(rtx_codec.GetResiliencyType(), Codec::ResiliencyType::kRtx);
|
||||||
|
@ -499,7 +488,7 @@ TEST(CodecTest, TestGetCodecType) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CodecTest, TestCreateRtxCodec) {
|
TEST(CodecTest, TestCreateRtxCodec) {
|
||||||
const VideoCodec rtx_codec = cricket::CreateVideoRtxCodec(96, 120);
|
const Codec rtx_codec = cricket::CreateVideoRtxCodec(96, 120);
|
||||||
EXPECT_EQ(96, rtx_codec.id);
|
EXPECT_EQ(96, rtx_codec.id);
|
||||||
EXPECT_EQ(rtx_codec.GetResiliencyType(), Codec::ResiliencyType::kRtx);
|
EXPECT_EQ(rtx_codec.GetResiliencyType(), Codec::ResiliencyType::kRtx);
|
||||||
int associated_payload_type;
|
int associated_payload_type;
|
||||||
|
@ -509,8 +498,8 @@ TEST(CodecTest, TestCreateRtxCodec) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CodecTest, TestMatchesRtpCodecRtx) {
|
TEST(CodecTest, TestMatchesRtpCodecRtx) {
|
||||||
const VideoCodec rtx_codec_1 = cricket::CreateVideoRtxCodec(96, 120);
|
const Codec rtx_codec_1 = cricket::CreateVideoRtxCodec(96, 120);
|
||||||
const VideoCodec rtx_codec_2 = cricket::CreateVideoRtxCodec(96, 121);
|
const Codec rtx_codec_2 = cricket::CreateVideoRtxCodec(96, 121);
|
||||||
EXPECT_TRUE(rtx_codec_1.Matches(rtx_codec_2));
|
EXPECT_TRUE(rtx_codec_1.Matches(rtx_codec_2));
|
||||||
// MatchesRtpCodec ignores the different associated payload type (apt) for
|
// MatchesRtpCodec ignores the different associated payload type (apt) for
|
||||||
// RTX.
|
// RTX.
|
||||||
|
@ -518,48 +507,48 @@ TEST(CodecTest, TestMatchesRtpCodecRtx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CodecTest, TestValidateCodecFormat) {
|
TEST(CodecTest, TestValidateCodecFormat) {
|
||||||
const VideoCodec codec = cricket::CreateVideoCodec(96, "V");
|
const Codec codec = cricket::CreateVideoCodec(96, "V");
|
||||||
ASSERT_TRUE(codec.ValidateCodecFormat());
|
ASSERT_TRUE(codec.ValidateCodecFormat());
|
||||||
|
|
||||||
// Accept 0-127 as payload types.
|
// Accept 0-127 as payload types.
|
||||||
VideoCodec low_payload_type = codec;
|
Codec low_payload_type = codec;
|
||||||
low_payload_type.id = 0;
|
low_payload_type.id = 0;
|
||||||
VideoCodec high_payload_type = codec;
|
Codec high_payload_type = codec;
|
||||||
high_payload_type.id = 127;
|
high_payload_type.id = 127;
|
||||||
ASSERT_TRUE(low_payload_type.ValidateCodecFormat());
|
ASSERT_TRUE(low_payload_type.ValidateCodecFormat());
|
||||||
EXPECT_TRUE(high_payload_type.ValidateCodecFormat());
|
EXPECT_TRUE(high_payload_type.ValidateCodecFormat());
|
||||||
|
|
||||||
// Reject negative payloads.
|
// Reject negative payloads.
|
||||||
VideoCodec negative_payload_type = codec;
|
Codec negative_payload_type = codec;
|
||||||
negative_payload_type.id = -1;
|
negative_payload_type.id = -1;
|
||||||
EXPECT_FALSE(negative_payload_type.ValidateCodecFormat());
|
EXPECT_FALSE(negative_payload_type.ValidateCodecFormat());
|
||||||
|
|
||||||
// Reject too-high payloads.
|
// Reject too-high payloads.
|
||||||
VideoCodec too_high_payload_type = codec;
|
Codec too_high_payload_type = codec;
|
||||||
too_high_payload_type.id = 128;
|
too_high_payload_type.id = 128;
|
||||||
EXPECT_FALSE(too_high_payload_type.ValidateCodecFormat());
|
EXPECT_FALSE(too_high_payload_type.ValidateCodecFormat());
|
||||||
|
|
||||||
// Reject codecs with min bitrate > max bitrate.
|
// Reject codecs with min bitrate > max bitrate.
|
||||||
VideoCodec incorrect_bitrates = codec;
|
Codec incorrect_bitrates = codec;
|
||||||
incorrect_bitrates.params[kCodecParamMinBitrate] = "100";
|
incorrect_bitrates.params[kCodecParamMinBitrate] = "100";
|
||||||
incorrect_bitrates.params[kCodecParamMaxBitrate] = "80";
|
incorrect_bitrates.params[kCodecParamMaxBitrate] = "80";
|
||||||
EXPECT_FALSE(incorrect_bitrates.ValidateCodecFormat());
|
EXPECT_FALSE(incorrect_bitrates.ValidateCodecFormat());
|
||||||
|
|
||||||
// Accept min bitrate == max bitrate.
|
// Accept min bitrate == max bitrate.
|
||||||
VideoCodec equal_bitrates = codec;
|
Codec equal_bitrates = codec;
|
||||||
equal_bitrates.params[kCodecParamMinBitrate] = "100";
|
equal_bitrates.params[kCodecParamMinBitrate] = "100";
|
||||||
equal_bitrates.params[kCodecParamMaxBitrate] = "100";
|
equal_bitrates.params[kCodecParamMaxBitrate] = "100";
|
||||||
EXPECT_TRUE(equal_bitrates.ValidateCodecFormat());
|
EXPECT_TRUE(equal_bitrates.ValidateCodecFormat());
|
||||||
|
|
||||||
// Accept min bitrate < max bitrate.
|
// Accept min bitrate < max bitrate.
|
||||||
VideoCodec different_bitrates = codec;
|
Codec different_bitrates = codec;
|
||||||
different_bitrates.params[kCodecParamMinBitrate] = "99";
|
different_bitrates.params[kCodecParamMinBitrate] = "99";
|
||||||
different_bitrates.params[kCodecParamMaxBitrate] = "100";
|
different_bitrates.params[kCodecParamMaxBitrate] = "100";
|
||||||
EXPECT_TRUE(different_bitrates.ValidateCodecFormat());
|
EXPECT_TRUE(different_bitrates.ValidateCodecFormat());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CodecTest, TestToCodecParameters) {
|
TEST(CodecTest, TestToCodecParameters) {
|
||||||
VideoCodec v = cricket::CreateVideoCodec(96, "V");
|
Codec v = cricket::CreateVideoCodec(96, "V");
|
||||||
v.SetParam("p1", "v1");
|
v.SetParam("p1", "v1");
|
||||||
webrtc::RtpCodecParameters codec_params_1 = v.ToCodecParameters();
|
webrtc::RtpCodecParameters codec_params_1 = v.ToCodecParameters();
|
||||||
EXPECT_EQ(96, codec_params_1.payload_type);
|
EXPECT_EQ(96, codec_params_1.payload_type);
|
||||||
|
@ -571,7 +560,7 @@ TEST(CodecTest, TestToCodecParameters) {
|
||||||
EXPECT_EQ("p1", codec_params_1.parameters.begin()->first);
|
EXPECT_EQ("p1", codec_params_1.parameters.begin()->first);
|
||||||
EXPECT_EQ("v1", codec_params_1.parameters.begin()->second);
|
EXPECT_EQ("v1", codec_params_1.parameters.begin()->second);
|
||||||
|
|
||||||
AudioCodec a = cricket::CreateAudioCodec(97, "A", 44100, 2);
|
Codec a = cricket::CreateAudioCodec(97, "A", 44100, 2);
|
||||||
a.SetParam("p1", "a1");
|
a.SetParam("p1", "a1");
|
||||||
webrtc::RtpCodecParameters codec_params_2 = a.ToCodecParameters();
|
webrtc::RtpCodecParameters codec_params_2 = a.ToCodecParameters();
|
||||||
EXPECT_EQ(97, codec_params_2.payload_type);
|
EXPECT_EQ(97, codec_params_2.payload_type);
|
||||||
|
|
|
@ -62,8 +62,7 @@ FakeVoiceMediaReceiveChannel::FakeVoiceMediaReceiveChannel(
|
||||||
SetOptions(options);
|
SetOptions(options);
|
||||||
}
|
}
|
||||||
FakeVoiceMediaReceiveChannel::~FakeVoiceMediaReceiveChannel() = default;
|
FakeVoiceMediaReceiveChannel::~FakeVoiceMediaReceiveChannel() = default;
|
||||||
const std::vector<AudioCodec>& FakeVoiceMediaReceiveChannel::recv_codecs()
|
const std::vector<Codec>& FakeVoiceMediaReceiveChannel::recv_codecs() const {
|
||||||
const {
|
|
||||||
return recv_codecs_;
|
return recv_codecs_;
|
||||||
}
|
}
|
||||||
const std::vector<FakeVoiceMediaReceiveChannel::DtmfInfo>&
|
const std::vector<FakeVoiceMediaReceiveChannel::DtmfInfo>&
|
||||||
|
@ -160,7 +159,7 @@ std::vector<webrtc::RtpSource> FakeVoiceMediaReceiveChannel::GetSources(
|
||||||
return std::vector<webrtc::RtpSource>();
|
return std::vector<webrtc::RtpSource>();
|
||||||
}
|
}
|
||||||
bool FakeVoiceMediaReceiveChannel::SetRecvCodecs(
|
bool FakeVoiceMediaReceiveChannel::SetRecvCodecs(
|
||||||
const std::vector<AudioCodec>& codecs) {
|
const std::vector<Codec>& codecs) {
|
||||||
if (fail_set_recv_codecs()) {
|
if (fail_set_recv_codecs()) {
|
||||||
// Fake the failure in SetRecvCodecs.
|
// Fake the failure in SetRecvCodecs.
|
||||||
return false;
|
return false;
|
||||||
|
@ -216,7 +215,7 @@ FakeVoiceMediaSendChannel::FakeVoiceMediaSendChannel(
|
||||||
SetOptions(options);
|
SetOptions(options);
|
||||||
}
|
}
|
||||||
FakeVoiceMediaSendChannel::~FakeVoiceMediaSendChannel() = default;
|
FakeVoiceMediaSendChannel::~FakeVoiceMediaSendChannel() = default;
|
||||||
const std::vector<AudioCodec>& FakeVoiceMediaSendChannel::send_codecs() const {
|
const std::vector<Codec>& FakeVoiceMediaSendChannel::send_codecs() const {
|
||||||
return send_codecs_;
|
return send_codecs_;
|
||||||
}
|
}
|
||||||
absl::optional<Codec> FakeVoiceMediaSendChannel::GetSendCodec() const {
|
absl::optional<Codec> FakeVoiceMediaSendChannel::GetSendCodec() const {
|
||||||
|
@ -267,7 +266,7 @@ bool FakeVoiceMediaSendChannel::HasSource(uint32_t ssrc) const {
|
||||||
return local_sinks_.find(ssrc) != local_sinks_.end();
|
return local_sinks_.find(ssrc) != local_sinks_.end();
|
||||||
}
|
}
|
||||||
bool FakeVoiceMediaSendChannel::CanInsertDtmf() {
|
bool FakeVoiceMediaSendChannel::CanInsertDtmf() {
|
||||||
for (std::vector<AudioCodec>::const_iterator it = send_codecs_.begin();
|
for (std::vector<Codec>::const_iterator it = send_codecs_.begin();
|
||||||
it != send_codecs_.end(); ++it) {
|
it != send_codecs_.end(); ++it) {
|
||||||
// Find the DTMF telephone event "codec".
|
// Find the DTMF telephone event "codec".
|
||||||
if (absl::EqualsIgnoreCase(it->name, "telephone-event")) {
|
if (absl::EqualsIgnoreCase(it->name, "telephone-event")) {
|
||||||
|
@ -292,7 +291,7 @@ bool FakeVoiceMediaSendChannel::GetStats(VoiceMediaSendInfo* info) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool FakeVoiceMediaSendChannel::SetSendCodecs(
|
bool FakeVoiceMediaSendChannel::SetSendCodecs(
|
||||||
const std::vector<AudioCodec>& codecs) {
|
const std::vector<Codec>& codecs) {
|
||||||
if (fail_set_send_codecs()) {
|
if (fail_set_send_codecs()) {
|
||||||
// Fake the failure in SetSendCodecs.
|
// Fake the failure in SetSendCodecs.
|
||||||
return false;
|
return false;
|
||||||
|
@ -343,10 +342,10 @@ FakeVideoMediaSendChannel::FakeVideoMediaSendChannel(
|
||||||
SetOptions(options);
|
SetOptions(options);
|
||||||
}
|
}
|
||||||
FakeVideoMediaSendChannel::~FakeVideoMediaSendChannel() = default;
|
FakeVideoMediaSendChannel::~FakeVideoMediaSendChannel() = default;
|
||||||
const std::vector<VideoCodec>& FakeVideoMediaSendChannel::send_codecs() const {
|
const std::vector<Codec>& FakeVideoMediaSendChannel::send_codecs() const {
|
||||||
return send_codecs_;
|
return send_codecs_;
|
||||||
}
|
}
|
||||||
const std::vector<VideoCodec>& FakeVideoMediaSendChannel::codecs() const {
|
const std::vector<Codec>& FakeVideoMediaSendChannel::codecs() const {
|
||||||
return send_codecs();
|
return send_codecs();
|
||||||
}
|
}
|
||||||
const VideoOptions& FakeVideoMediaSendChannel::options() const {
|
const VideoOptions& FakeVideoMediaSendChannel::options() const {
|
||||||
|
@ -393,7 +392,7 @@ bool FakeVideoMediaSendChannel::GetStats(VideoMediaSendInfo* info) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool FakeVideoMediaSendChannel::SetSendCodecs(
|
bool FakeVideoMediaSendChannel::SetSendCodecs(
|
||||||
const std::vector<VideoCodec>& codecs) {
|
const std::vector<Codec>& codecs) {
|
||||||
if (fail_set_send_codecs()) {
|
if (fail_set_send_codecs()) {
|
||||||
// Fake the failure in SetSendCodecs.
|
// Fake the failure in SetSendCodecs.
|
||||||
return false;
|
return false;
|
||||||
|
@ -424,8 +423,7 @@ FakeVideoMediaReceiveChannel::FakeVideoMediaReceiveChannel(
|
||||||
SetOptions(options);
|
SetOptions(options);
|
||||||
}
|
}
|
||||||
FakeVideoMediaReceiveChannel::~FakeVideoMediaReceiveChannel() = default;
|
FakeVideoMediaReceiveChannel::~FakeVideoMediaReceiveChannel() = default;
|
||||||
const std::vector<VideoCodec>& FakeVideoMediaReceiveChannel::recv_codecs()
|
const std::vector<Codec>& FakeVideoMediaReceiveChannel::recv_codecs() const {
|
||||||
const {
|
|
||||||
return recv_codecs_;
|
return recv_codecs_;
|
||||||
}
|
}
|
||||||
bool FakeVideoMediaReceiveChannel::rendering() const {
|
bool FakeVideoMediaReceiveChannel::rendering() const {
|
||||||
|
@ -503,7 +501,7 @@ absl::optional<int> FakeVideoMediaReceiveChannel::GetBaseMinimumPlayoutDelayMs(
|
||||||
return absl::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
bool FakeVideoMediaReceiveChannel::SetRecvCodecs(
|
bool FakeVideoMediaReceiveChannel::SetRecvCodecs(
|
||||||
const std::vector<VideoCodec>& codecs) {
|
const std::vector<Codec>& codecs) {
|
||||||
if (fail_set_recv_codecs()) {
|
if (fail_set_recv_codecs()) {
|
||||||
// Fake the failure in SetRecvCodecs.
|
// Fake the failure in SetRecvCodecs.
|
||||||
return false;
|
return false;
|
||||||
|
@ -566,20 +564,20 @@ FakeVoiceEngine::CreateReceiveChannel(
|
||||||
call->network_thread());
|
call->network_thread());
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
const std::vector<AudioCodec>& FakeVoiceEngine::send_codecs() const {
|
const std::vector<Codec>& FakeVoiceEngine::send_codecs() const {
|
||||||
return send_codecs_;
|
return send_codecs_;
|
||||||
}
|
}
|
||||||
const std::vector<AudioCodec>& FakeVoiceEngine::recv_codecs() const {
|
const std::vector<Codec>& FakeVoiceEngine::recv_codecs() const {
|
||||||
return recv_codecs_;
|
return recv_codecs_;
|
||||||
}
|
}
|
||||||
void FakeVoiceEngine::SetCodecs(const std::vector<AudioCodec>& codecs) {
|
void FakeVoiceEngine::SetCodecs(const std::vector<Codec>& codecs) {
|
||||||
send_codecs_ = codecs;
|
send_codecs_ = codecs;
|
||||||
recv_codecs_ = codecs;
|
recv_codecs_ = codecs;
|
||||||
}
|
}
|
||||||
void FakeVoiceEngine::SetRecvCodecs(const std::vector<AudioCodec>& codecs) {
|
void FakeVoiceEngine::SetRecvCodecs(const std::vector<Codec>& codecs) {
|
||||||
recv_codecs_ = codecs;
|
recv_codecs_ = codecs;
|
||||||
}
|
}
|
||||||
void FakeVoiceEngine::SetSendCodecs(const std::vector<AudioCodec>& codecs) {
|
void FakeVoiceEngine::SetSendCodecs(const std::vector<Codec>& codecs) {
|
||||||
send_codecs_ = codecs;
|
send_codecs_ = codecs;
|
||||||
}
|
}
|
||||||
int FakeVoiceEngine::GetInputLevel() {
|
int FakeVoiceEngine::GetInputLevel() {
|
||||||
|
@ -647,19 +645,19 @@ FakeVideoEngine::CreateReceiveChannel(
|
||||||
call->network_thread());
|
call->network_thread());
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
std::vector<VideoCodec> FakeVideoEngine::send_codecs(bool use_rtx) const {
|
std::vector<Codec> FakeVideoEngine::send_codecs(bool use_rtx) const {
|
||||||
return send_codecs_;
|
return send_codecs_;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<VideoCodec> FakeVideoEngine::recv_codecs(bool use_rtx) const {
|
std::vector<Codec> FakeVideoEngine::recv_codecs(bool use_rtx) const {
|
||||||
return recv_codecs_;
|
return recv_codecs_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FakeVideoEngine::SetSendCodecs(const std::vector<VideoCodec>& codecs) {
|
void FakeVideoEngine::SetSendCodecs(const std::vector<Codec>& codecs) {
|
||||||
send_codecs_ = codecs;
|
send_codecs_ = codecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FakeVideoEngine::SetRecvCodecs(const std::vector<VideoCodec>& codecs) {
|
void FakeVideoEngine::SetRecvCodecs(const std::vector<Codec>& codecs) {
|
||||||
recv_codecs_ = codecs;
|
recv_codecs_ = codecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -682,18 +680,16 @@ FakeMediaEngine::FakeMediaEngine()
|
||||||
voice_(static_cast<FakeVoiceEngine*>(&voice())),
|
voice_(static_cast<FakeVoiceEngine*>(&voice())),
|
||||||
video_(static_cast<FakeVideoEngine*>(&video())) {}
|
video_(static_cast<FakeVideoEngine*>(&video())) {}
|
||||||
FakeMediaEngine::~FakeMediaEngine() {}
|
FakeMediaEngine::~FakeMediaEngine() {}
|
||||||
void FakeMediaEngine::SetAudioCodecs(const std::vector<AudioCodec>& codecs) {
|
void FakeMediaEngine::SetAudioCodecs(const std::vector<Codec>& codecs) {
|
||||||
voice_->SetCodecs(codecs);
|
voice_->SetCodecs(codecs);
|
||||||
}
|
}
|
||||||
void FakeMediaEngine::SetAudioRecvCodecs(
|
void FakeMediaEngine::SetAudioRecvCodecs(const std::vector<Codec>& codecs) {
|
||||||
const std::vector<AudioCodec>& codecs) {
|
|
||||||
voice_->SetRecvCodecs(codecs);
|
voice_->SetRecvCodecs(codecs);
|
||||||
}
|
}
|
||||||
void FakeMediaEngine::SetAudioSendCodecs(
|
void FakeMediaEngine::SetAudioSendCodecs(const std::vector<Codec>& codecs) {
|
||||||
const std::vector<AudioCodec>& codecs) {
|
|
||||||
voice_->SetSendCodecs(codecs);
|
voice_->SetSendCodecs(codecs);
|
||||||
}
|
}
|
||||||
void FakeMediaEngine::SetVideoCodecs(const std::vector<VideoCodec>& codecs) {
|
void FakeMediaEngine::SetVideoCodecs(const std::vector<Codec>& codecs) {
|
||||||
video_->SetSendCodecs(codecs);
|
video_->SetSendCodecs(codecs);
|
||||||
video_->SetRecvCodecs(codecs);
|
video_->SetRecvCodecs(codecs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -452,7 +452,7 @@ class FakeVoiceMediaReceiveChannel
|
||||||
virtual ~FakeVoiceMediaReceiveChannel();
|
virtual ~FakeVoiceMediaReceiveChannel();
|
||||||
|
|
||||||
// Test methods
|
// Test methods
|
||||||
const std::vector<AudioCodec>& recv_codecs() const;
|
const std::vector<Codec>& recv_codecs() const;
|
||||||
const std::vector<DtmfInfo>& dtmf_info_queue() const;
|
const std::vector<DtmfInfo>& dtmf_info_queue() const;
|
||||||
const AudioOptions& options() const;
|
const AudioOptions& options() const;
|
||||||
int max_bps() const;
|
int max_bps() const;
|
||||||
|
@ -516,11 +516,11 @@ class FakeVoiceMediaReceiveChannel
|
||||||
AudioSource* source_;
|
AudioSource* source_;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool SetRecvCodecs(const std::vector<AudioCodec>& codecs);
|
bool SetRecvCodecs(const std::vector<Codec>& codecs);
|
||||||
bool SetMaxSendBandwidth(int bps);
|
bool SetMaxSendBandwidth(int bps);
|
||||||
bool SetOptions(const AudioOptions& options);
|
bool SetOptions(const AudioOptions& options);
|
||||||
|
|
||||||
std::vector<AudioCodec> recv_codecs_;
|
std::vector<Codec> recv_codecs_;
|
||||||
std::map<uint32_t, double> output_scalings_;
|
std::map<uint32_t, double> output_scalings_;
|
||||||
std::map<uint32_t, int> output_delays_;
|
std::map<uint32_t, int> output_delays_;
|
||||||
std::vector<DtmfInfo> dtmf_info_queue_;
|
std::vector<DtmfInfo> dtmf_info_queue_;
|
||||||
|
@ -543,7 +543,7 @@ class FakeVoiceMediaSendChannel
|
||||||
webrtc::TaskQueueBase* network_thread);
|
webrtc::TaskQueueBase* network_thread);
|
||||||
~FakeVoiceMediaSendChannel() override;
|
~FakeVoiceMediaSendChannel() override;
|
||||||
|
|
||||||
const std::vector<AudioCodec>& send_codecs() const;
|
const std::vector<Codec>& send_codecs() const;
|
||||||
const std::vector<DtmfInfo>& dtmf_info_queue() const;
|
const std::vector<DtmfInfo>& dtmf_info_queue() const;
|
||||||
const AudioOptions& options() const;
|
const AudioOptions& options() const;
|
||||||
int max_bps() const;
|
int max_bps() const;
|
||||||
|
@ -599,12 +599,12 @@ class FakeVoiceMediaSendChannel
|
||||||
AudioSource* source_;
|
AudioSource* source_;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool SetSendCodecs(const std::vector<AudioCodec>& codecs);
|
bool SetSendCodecs(const std::vector<Codec>& codecs);
|
||||||
bool SetMaxSendBandwidth(int bps);
|
bool SetMaxSendBandwidth(int bps);
|
||||||
bool SetOptions(const AudioOptions& options);
|
bool SetOptions(const AudioOptions& options);
|
||||||
bool SetLocalSource(uint32_t ssrc, AudioSource* source);
|
bool SetLocalSource(uint32_t ssrc, AudioSource* source);
|
||||||
|
|
||||||
std::vector<AudioCodec> send_codecs_;
|
std::vector<Codec> send_codecs_;
|
||||||
std::map<uint32_t, double> output_scalings_;
|
std::map<uint32_t, double> output_scalings_;
|
||||||
std::map<uint32_t, int> output_delays_;
|
std::map<uint32_t, int> output_delays_;
|
||||||
std::vector<DtmfInfo> dtmf_info_queue_;
|
std::vector<DtmfInfo> dtmf_info_queue_;
|
||||||
|
@ -637,8 +637,8 @@ class FakeVideoMediaReceiveChannel
|
||||||
return cricket::MEDIA_TYPE_VIDEO;
|
return cricket::MEDIA_TYPE_VIDEO;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<VideoCodec>& recv_codecs() const;
|
const std::vector<Codec>& recv_codecs() const;
|
||||||
const std::vector<VideoCodec>& send_codecs() const;
|
const std::vector<Codec>& send_codecs() const;
|
||||||
bool rendering() const;
|
bool rendering() const;
|
||||||
const VideoOptions& options() const;
|
const VideoOptions& options() const;
|
||||||
const std::map<uint32_t, rtc::VideoSinkInterface<webrtc::VideoFrame>*>&
|
const std::map<uint32_t, rtc::VideoSinkInterface<webrtc::VideoFrame>*>&
|
||||||
|
@ -682,12 +682,12 @@ class FakeVideoMediaReceiveChannel
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool SetRecvCodecs(const std::vector<VideoCodec>& codecs);
|
bool SetRecvCodecs(const std::vector<Codec>& codecs);
|
||||||
bool SetSendCodecs(const std::vector<VideoCodec>& codecs);
|
bool SetSendCodecs(const std::vector<Codec>& codecs);
|
||||||
bool SetOptions(const VideoOptions& options);
|
bool SetOptions(const VideoOptions& options);
|
||||||
bool SetMaxSendBandwidth(int bps);
|
bool SetMaxSendBandwidth(int bps);
|
||||||
|
|
||||||
std::vector<VideoCodec> recv_codecs_;
|
std::vector<Codec> recv_codecs_;
|
||||||
std::map<uint32_t, rtc::VideoSinkInterface<webrtc::VideoFrame>*> sinks_;
|
std::map<uint32_t, rtc::VideoSinkInterface<webrtc::VideoFrame>*> sinks_;
|
||||||
std::map<uint32_t, rtc::VideoSourceInterface<webrtc::VideoFrame>*> sources_;
|
std::map<uint32_t, rtc::VideoSourceInterface<webrtc::VideoFrame>*> sources_;
|
||||||
std::map<uint32_t, int> output_delays_;
|
std::map<uint32_t, int> output_delays_;
|
||||||
|
@ -711,8 +711,8 @@ class FakeVideoMediaSendChannel
|
||||||
return cricket::MEDIA_TYPE_VIDEO;
|
return cricket::MEDIA_TYPE_VIDEO;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<VideoCodec>& send_codecs() const;
|
const std::vector<Codec>& send_codecs() const;
|
||||||
const std::vector<VideoCodec>& codecs() const;
|
const std::vector<Codec>& codecs() const;
|
||||||
const VideoOptions& options() const;
|
const VideoOptions& options() const;
|
||||||
const std::map<uint32_t, rtc::VideoSinkInterface<webrtc::VideoFrame>*>&
|
const std::map<uint32_t, rtc::VideoSinkInterface<webrtc::VideoFrame>*>&
|
||||||
sinks() const;
|
sinks() const;
|
||||||
|
@ -749,11 +749,11 @@ class FakeVideoMediaSendChannel
|
||||||
bool GetStats(VideoMediaSendInfo* info) override;
|
bool GetStats(VideoMediaSendInfo* info) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool SetSendCodecs(const std::vector<VideoCodec>& codecs);
|
bool SetSendCodecs(const std::vector<Codec>& codecs);
|
||||||
bool SetOptions(const VideoOptions& options);
|
bool SetOptions(const VideoOptions& options);
|
||||||
bool SetMaxSendBandwidth(int bps);
|
bool SetMaxSendBandwidth(int bps);
|
||||||
|
|
||||||
std::vector<VideoCodec> send_codecs_;
|
std::vector<Codec> send_codecs_;
|
||||||
std::map<uint32_t, rtc::VideoSourceInterface<webrtc::VideoFrame>*> sources_;
|
std::map<uint32_t, rtc::VideoSourceInterface<webrtc::VideoFrame>*> sources_;
|
||||||
VideoOptions options_;
|
VideoOptions options_;
|
||||||
int max_bps_;
|
int max_bps_;
|
||||||
|
@ -780,11 +780,11 @@ class FakeVoiceEngine : public VoiceEngineInterface {
|
||||||
|
|
||||||
// TODO(ossu): For proper testing, These should either individually settable
|
// TODO(ossu): For proper testing, These should either individually settable
|
||||||
// or the voice engine should reference mockable factories.
|
// or the voice engine should reference mockable factories.
|
||||||
const std::vector<AudioCodec>& send_codecs() const override;
|
const std::vector<Codec>& send_codecs() const override;
|
||||||
const std::vector<AudioCodec>& recv_codecs() const override;
|
const std::vector<Codec>& recv_codecs() const override;
|
||||||
void SetCodecs(const std::vector<AudioCodec>& codecs);
|
void SetCodecs(const std::vector<Codec>& codecs);
|
||||||
void SetRecvCodecs(const std::vector<AudioCodec>& codecs);
|
void SetRecvCodecs(const std::vector<Codec>& codecs);
|
||||||
void SetSendCodecs(const std::vector<AudioCodec>& codecs);
|
void SetSendCodecs(const std::vector<Codec>& codecs);
|
||||||
int GetInputLevel();
|
int GetInputLevel();
|
||||||
bool StartAecDump(webrtc::FileWrapper file, int64_t max_size_bytes) override;
|
bool StartAecDump(webrtc::FileWrapper file, int64_t max_size_bytes) override;
|
||||||
void StopAecDump() override;
|
void StopAecDump() override;
|
||||||
|
@ -796,8 +796,8 @@ class FakeVoiceEngine : public VoiceEngineInterface {
|
||||||
std::vector<webrtc::RtpHeaderExtensionCapability> header_extensions);
|
std::vector<webrtc::RtpHeaderExtensionCapability> header_extensions);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<AudioCodec> recv_codecs_;
|
std::vector<Codec> recv_codecs_;
|
||||||
std::vector<AudioCodec> send_codecs_;
|
std::vector<Codec> send_codecs_;
|
||||||
bool fail_create_channel_;
|
bool fail_create_channel_;
|
||||||
std::vector<webrtc::RtpHeaderExtensionCapability> header_extensions_;
|
std::vector<webrtc::RtpHeaderExtensionCapability> header_extensions_;
|
||||||
|
|
||||||
|
@ -823,16 +823,12 @@ class FakeVideoEngine : public VideoEngineInterface {
|
||||||
FakeVideoMediaSendChannel* GetSendChannel(size_t index);
|
FakeVideoMediaSendChannel* GetSendChannel(size_t index);
|
||||||
FakeVideoMediaReceiveChannel* GetReceiveChannel(size_t index);
|
FakeVideoMediaReceiveChannel* GetReceiveChannel(size_t index);
|
||||||
|
|
||||||
std::vector<VideoCodec> send_codecs() const override {
|
std::vector<Codec> send_codecs() const override { return send_codecs(true); }
|
||||||
return send_codecs(true);
|
std::vector<Codec> recv_codecs() const override { return recv_codecs(true); }
|
||||||
}
|
std::vector<Codec> send_codecs(bool include_rtx) const override;
|
||||||
std::vector<VideoCodec> recv_codecs() const override {
|
std::vector<Codec> recv_codecs(bool include_rtx) const override;
|
||||||
return recv_codecs(true);
|
void SetSendCodecs(const std::vector<Codec>& codecs);
|
||||||
}
|
void SetRecvCodecs(const std::vector<Codec>& codecs);
|
||||||
std::vector<VideoCodec> send_codecs(bool include_rtx) const override;
|
|
||||||
std::vector<VideoCodec> recv_codecs(bool include_rtx) const override;
|
|
||||||
void SetSendCodecs(const std::vector<VideoCodec>& codecs);
|
|
||||||
void SetRecvCodecs(const std::vector<VideoCodec>& codecs);
|
|
||||||
bool SetCapture(bool capture);
|
bool SetCapture(bool capture);
|
||||||
std::vector<webrtc::RtpHeaderExtensionCapability> GetRtpHeaderExtensions()
|
std::vector<webrtc::RtpHeaderExtensionCapability> GetRtpHeaderExtensions()
|
||||||
const override;
|
const override;
|
||||||
|
@ -840,8 +836,8 @@ class FakeVideoEngine : public VideoEngineInterface {
|
||||||
std::vector<webrtc::RtpHeaderExtensionCapability> header_extensions);
|
std::vector<webrtc::RtpHeaderExtensionCapability> header_extensions);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<VideoCodec> send_codecs_;
|
std::vector<Codec> send_codecs_;
|
||||||
std::vector<VideoCodec> recv_codecs_;
|
std::vector<Codec> recv_codecs_;
|
||||||
bool capture_;
|
bool capture_;
|
||||||
VideoOptions options_;
|
VideoOptions options_;
|
||||||
bool fail_create_channel_;
|
bool fail_create_channel_;
|
||||||
|
@ -856,10 +852,10 @@ class FakeMediaEngine : public CompositeMediaEngine {
|
||||||
|
|
||||||
~FakeMediaEngine() override;
|
~FakeMediaEngine() override;
|
||||||
|
|
||||||
void SetAudioCodecs(const std::vector<AudioCodec>& codecs);
|
void SetAudioCodecs(const std::vector<Codec>& codecs);
|
||||||
void SetAudioRecvCodecs(const std::vector<AudioCodec>& codecs);
|
void SetAudioRecvCodecs(const std::vector<Codec>& codecs);
|
||||||
void SetAudioSendCodecs(const std::vector<AudioCodec>& codecs);
|
void SetAudioSendCodecs(const std::vector<Codec>& codecs);
|
||||||
void SetVideoCodecs(const std::vector<VideoCodec>& codecs);
|
void SetVideoCodecs(const std::vector<Codec>& codecs);
|
||||||
|
|
||||||
void set_fail_create_channel(bool fail);
|
void set_fail_create_channel(bool fail);
|
||||||
|
|
||||||
|
|
|
@ -118,8 +118,8 @@ class VoiceEngineInterface : public RtpHeaderExtensionQueryInterface {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const std::vector<AudioCodec>& send_codecs() const = 0;
|
virtual const std::vector<Codec>& send_codecs() const = 0;
|
||||||
virtual const std::vector<AudioCodec>& recv_codecs() const = 0;
|
virtual const std::vector<Codec>& recv_codecs() const = 0;
|
||||||
|
|
||||||
// Starts AEC dump using existing file, a maximum file size in bytes can be
|
// Starts AEC dump using existing file, a maximum file size in bytes can be
|
||||||
// specified. Logging is stopped just before the size limit is exceeded.
|
// specified. Logging is stopped just before the size limit is exceeded.
|
||||||
|
@ -164,16 +164,16 @@ class VideoEngineInterface : public RtpHeaderExtensionQueryInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve list of supported codecs.
|
// Retrieve list of supported codecs.
|
||||||
virtual std::vector<VideoCodec> send_codecs() const = 0;
|
virtual std::vector<Codec> send_codecs() const = 0;
|
||||||
virtual std::vector<VideoCodec> recv_codecs() const = 0;
|
virtual std::vector<Codec> recv_codecs() const = 0;
|
||||||
// As above, but if include_rtx is false, don't include RTX codecs.
|
// As above, but if include_rtx is false, don't include RTX codecs.
|
||||||
// TODO(bugs.webrtc.org/13931): Remove default implementation once
|
// TODO(bugs.webrtc.org/13931): Remove default implementation once
|
||||||
// upstream subclasses have converted.
|
// upstream subclasses have converted.
|
||||||
virtual std::vector<VideoCodec> send_codecs(bool include_rtx) const {
|
virtual std::vector<Codec> send_codecs(bool include_rtx) const {
|
||||||
RTC_DCHECK(include_rtx);
|
RTC_DCHECK(include_rtx);
|
||||||
return send_codecs();
|
return send_codecs();
|
||||||
}
|
}
|
||||||
virtual std::vector<VideoCodec> recv_codecs(bool include_rtx) const {
|
virtual std::vector<Codec> recv_codecs(bool include_rtx) const {
|
||||||
RTC_DCHECK(include_rtx);
|
RTC_DCHECK(include_rtx);
|
||||||
return recv_codecs();
|
return recv_codecs();
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,8 +70,8 @@ class MostlyMockVoiceEngineInterface : public VoiceEngineInterface {
|
||||||
GetAudioState,
|
GetAudioState,
|
||||||
(),
|
(),
|
||||||
(const, override));
|
(const, override));
|
||||||
MOCK_METHOD(std::vector<AudioCodec>&, send_codecs, (), (const, override));
|
MOCK_METHOD(std::vector<Codec>&, send_codecs, (), (const, override));
|
||||||
MOCK_METHOD(std::vector<AudioCodec>&, recv_codecs, (), (const, override));
|
MOCK_METHOD(std::vector<Codec>&, recv_codecs, (), (const, override));
|
||||||
MOCK_METHOD(bool,
|
MOCK_METHOD(bool,
|
||||||
StartAecDump,
|
StartAecDump,
|
||||||
(webrtc::FileWrapper file, int64_t max_size_bytes),
|
(webrtc::FileWrapper file, int64_t max_size_bytes),
|
||||||
|
|
|
@ -120,8 +120,8 @@ void FakeWebRtcVideoDecoderFactory::DecoderDestroyed(
|
||||||
|
|
||||||
void FakeWebRtcVideoDecoderFactory::AddSupportedVideoCodecType(
|
void FakeWebRtcVideoDecoderFactory::AddSupportedVideoCodecType(
|
||||||
const std::string& name) {
|
const std::string& name) {
|
||||||
// This is to match the default H264 params of cricket::VideoCodec.
|
// This is to match the default H264 params of cricket::Codec.
|
||||||
cricket::VideoCodec video_codec = cricket::CreateVideoCodec(name);
|
cricket::Codec video_codec = cricket::CreateVideoCodec(name);
|
||||||
supported_codec_formats_.push_back(
|
supported_codec_formats_.push_back(
|
||||||
webrtc::SdpVideoFormat(video_codec.name, video_codec.params));
|
webrtc::SdpVideoFormat(video_codec.name, video_codec.params));
|
||||||
}
|
}
|
||||||
|
@ -287,8 +287,8 @@ void FakeWebRtcVideoEncoderFactory::AddSupportedVideoCodec(
|
||||||
void FakeWebRtcVideoEncoderFactory::AddSupportedVideoCodecType(
|
void FakeWebRtcVideoEncoderFactory::AddSupportedVideoCodecType(
|
||||||
const std::string& name,
|
const std::string& name,
|
||||||
const std::vector<webrtc::ScalabilityMode>& scalability_modes) {
|
const std::vector<webrtc::ScalabilityMode>& scalability_modes) {
|
||||||
// This is to match the default H264 params of cricket::VideoCodec.
|
// This is to match the default H264 params of cricket::Codec.
|
||||||
cricket::VideoCodec video_codec = cricket::CreateVideoCodec(name);
|
cricket::Codec video_codec = cricket::CreateVideoCodec(name);
|
||||||
formats_.push_back(webrtc::SdpVideoFormat(
|
formats_.push_back(webrtc::SdpVideoFormat(
|
||||||
video_codec.name, video_codec.params,
|
video_codec.name, video_codec.params,
|
||||||
{scalability_modes.begin(), scalability_modes.end()}));
|
{scalability_modes.begin(), scalability_modes.end()}));
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
namespace cricket {
|
namespace cricket {
|
||||||
|
|
||||||
webrtc::SdpAudioFormat AudioCodecToSdpAudioFormat(const AudioCodec& ac) {
|
webrtc::SdpAudioFormat AudioCodecToSdpAudioFormat(const Codec& ac) {
|
||||||
return webrtc::SdpAudioFormat(ac.name, ac.clockrate, ac.channels, ac.params);
|
return webrtc::SdpAudioFormat(ac.name, ac.clockrate, ac.channels, ac.params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ absl::optional<int> PayloadTypeMapper::FindMappingFor(
|
||||||
return absl::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::optional<AudioCodec> PayloadTypeMapper::ToAudioCodec(
|
absl::optional<Codec> PayloadTypeMapper::ToAudioCodec(
|
||||||
const webrtc::SdpAudioFormat& format) {
|
const webrtc::SdpAudioFormat& format) {
|
||||||
// TODO(ossu): We can safely set bitrate to zero here, since that field is
|
// TODO(ossu): We can safely set bitrate to zero here, since that field is
|
||||||
// not presented in the SDP. It is used to ferry around some target bitrate
|
// not presented in the SDP. It is used to ferry around some target bitrate
|
||||||
|
@ -131,7 +131,7 @@ absl::optional<AudioCodec> PayloadTypeMapper::ToAudioCodec(
|
||||||
// ACM or NetEq.
|
// ACM or NetEq.
|
||||||
auto opt_payload_type = GetMappingFor(format);
|
auto opt_payload_type = GetMappingFor(format);
|
||||||
if (opt_payload_type) {
|
if (opt_payload_type) {
|
||||||
AudioCodec codec =
|
Codec codec =
|
||||||
cricket::CreateAudioCodec(*opt_payload_type, format.name,
|
cricket::CreateAudioCodec(*opt_payload_type, format.name,
|
||||||
format.clockrate_hz, format.num_channels);
|
format.clockrate_hz, format.num_channels);
|
||||||
codec.params = format.parameters;
|
codec.params = format.parameters;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
namespace cricket {
|
namespace cricket {
|
||||||
|
|
||||||
webrtc::SdpAudioFormat AudioCodecToSdpAudioFormat(const AudioCodec& ac);
|
webrtc::SdpAudioFormat AudioCodecToSdpAudioFormat(const Codec& ac);
|
||||||
|
|
||||||
class PayloadTypeMapper {
|
class PayloadTypeMapper {
|
||||||
public:
|
public:
|
||||||
|
@ -39,7 +39,7 @@ class PayloadTypeMapper {
|
||||||
|
|
||||||
// Like GetMappingFor, but fills in an AudioCodec structure with the necessary
|
// Like GetMappingFor, but fills in an AudioCodec structure with the necessary
|
||||||
// information instead.
|
// information instead.
|
||||||
absl::optional<AudioCodec> ToAudioCodec(const webrtc::SdpAudioFormat& format);
|
absl::optional<Codec> ToAudioCodec(const webrtc::SdpAudioFormat& format);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct SdpAudioFormatOrdering {
|
struct SdpAudioFormatOrdering {
|
||||||
|
|
|
@ -126,7 +126,7 @@ TEST_F(PayloadTypeMapperTest, ToAudioCodec) {
|
||||||
|
|
||||||
if (opt_payload_type && opt_audio_codec) {
|
if (opt_payload_type && opt_audio_codec) {
|
||||||
int payload_type = *opt_payload_type;
|
int payload_type = *opt_payload_type;
|
||||||
const AudioCodec& codec = *opt_audio_codec;
|
const Codec& codec = *opt_audio_codec;
|
||||||
|
|
||||||
EXPECT_EQ(codec.id, payload_type);
|
EXPECT_EQ(codec.id, payload_type);
|
||||||
EXPECT_EQ(codec.name, format.name);
|
EXPECT_EQ(codec.name, format.name);
|
||||||
|
|
|
@ -111,7 +111,7 @@ bool IsDisabled(const webrtc::FieldTrialsView& trials, absl::string_view name) {
|
||||||
return absl::StartsWith(trials.Lookup(name), "Disabled");
|
return absl::StartsWith(trials.Lookup(name), "Disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddDefaultFeedbackParams(VideoCodec* codec,
|
void AddDefaultFeedbackParams(Codec* codec,
|
||||||
const webrtc::FieldTrialsView& trials) {
|
const webrtc::FieldTrialsView& trials) {
|
||||||
// Don't add any feedback params for RED and ULPFEC.
|
// Don't add any feedback params for RED and ULPFEC.
|
||||||
if (codec->name == kRedCodecName || codec->name == kUlpfecCodecName)
|
if (codec->name == kRedCodecName || codec->name == kUlpfecCodecName)
|
||||||
|
@ -133,7 +133,7 @@ void AddDefaultFeedbackParams(VideoCodec* codec,
|
||||||
|
|
||||||
// Helper function to determine whether a codec should use the [35, 63] range.
|
// Helper function to determine whether a codec should use the [35, 63] range.
|
||||||
// Should be used when adding new codecs (or variants).
|
// Should be used when adding new codecs (or variants).
|
||||||
bool IsCodecValidForLowerRange(const VideoCodec& codec) {
|
bool IsCodecValidForLowerRange(const Codec& codec) {
|
||||||
if (absl::EqualsIgnoreCase(codec.name, kFlexfecCodecName) ||
|
if (absl::EqualsIgnoreCase(codec.name, kFlexfecCodecName) ||
|
||||||
absl::EqualsIgnoreCase(codec.name, kAv1CodecName) ||
|
absl::EqualsIgnoreCase(codec.name, kAv1CodecName) ||
|
||||||
absl::EqualsIgnoreCase(codec.name, kAv1xCodecName)) {
|
absl::EqualsIgnoreCase(codec.name, kAv1xCodecName)) {
|
||||||
|
@ -174,7 +174,7 @@ bool IsCodecValidForLowerRange(const VideoCodec& codec) {
|
||||||
// TODO(kron): Perhaps it is better to move the implicit knowledge to the place
|
// TODO(kron): Perhaps it is better to move the implicit knowledge to the place
|
||||||
// where codecs are negotiated.
|
// where codecs are negotiated.
|
||||||
template <class T>
|
template <class T>
|
||||||
std::vector<VideoCodec> GetPayloadTypesAndDefaultCodecs(
|
std::vector<Codec> GetPayloadTypesAndDefaultCodecs(
|
||||||
const T* factory,
|
const T* factory,
|
||||||
bool is_decoder_factory,
|
bool is_decoder_factory,
|
||||||
bool include_rtx,
|
bool include_rtx,
|
||||||
|
@ -190,7 +190,7 @@ std::vector<VideoCodec> GetPayloadTypesAndDefaultCodecs(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (supported_formats.empty())
|
if (supported_formats.empty())
|
||||||
return std::vector<VideoCodec>();
|
return std::vector<Codec>();
|
||||||
|
|
||||||
supported_formats.push_back(webrtc::SdpVideoFormat(kRedCodecName));
|
supported_formats.push_back(webrtc::SdpVideoFormat(kRedCodecName));
|
||||||
supported_formats.push_back(webrtc::SdpVideoFormat(kUlpfecCodecName));
|
supported_formats.push_back(webrtc::SdpVideoFormat(kUlpfecCodecName));
|
||||||
|
@ -217,9 +217,9 @@ std::vector<VideoCodec> GetPayloadTypesAndDefaultCodecs(
|
||||||
int payload_type_upper = kFirstDynamicPayloadTypeUpperRange;
|
int payload_type_upper = kFirstDynamicPayloadTypeUpperRange;
|
||||||
int payload_type_lower = kFirstDynamicPayloadTypeLowerRange;
|
int payload_type_lower = kFirstDynamicPayloadTypeLowerRange;
|
||||||
|
|
||||||
std::vector<VideoCodec> output_codecs;
|
std::vector<Codec> output_codecs;
|
||||||
for (const webrtc::SdpVideoFormat& format : supported_formats) {
|
for (const webrtc::SdpVideoFormat& format : supported_formats) {
|
||||||
VideoCodec codec = cricket::CreateVideoCodec(format);
|
Codec codec = cricket::CreateVideoCodec(format);
|
||||||
bool isFecCodec = absl::EqualsIgnoreCase(codec.name, kUlpfecCodecName) ||
|
bool isFecCodec = absl::EqualsIgnoreCase(codec.name, kUlpfecCodecName) ||
|
||||||
absl::EqualsIgnoreCase(codec.name, kFlexfecCodecName);
|
absl::EqualsIgnoreCase(codec.name, kFlexfecCodecName);
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ std::vector<VideoCodec> GetPayloadTypesAndDefaultCodecs(
|
||||||
return output_codecs;
|
return output_codecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string CodecVectorToString(const std::vector<VideoCodec>& codecs) {
|
static std::string CodecVectorToString(const std::vector<Codec>& codecs) {
|
||||||
rtc::StringBuilder out;
|
rtc::StringBuilder out;
|
||||||
out << "{";
|
out << "{";
|
||||||
for (size_t i = 0; i < codecs.size(); ++i) {
|
for (size_t i = 0; i < codecs.size(); ++i) {
|
||||||
|
@ -283,7 +283,7 @@ static std::string CodecVectorToString(const std::vector<VideoCodec>& codecs) {
|
||||||
return out.Release();
|
return out.Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ValidateCodecFormats(const std::vector<VideoCodec>& codecs) {
|
static bool ValidateCodecFormats(const std::vector<Codec>& codecs) {
|
||||||
bool has_video = false;
|
bool has_video = false;
|
||||||
for (size_t i = 0; i < codecs.size(); ++i) {
|
for (size_t i = 0; i < codecs.size(); ++i) {
|
||||||
if (!codecs[i].ValidateCodecFormat()) {
|
if (!codecs[i].ValidateCodecFormat()) {
|
||||||
|
@ -497,7 +497,7 @@ bool IsActiveFromEncodings(
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsScalabilityModeSupportedByCodec(
|
bool IsScalabilityModeSupportedByCodec(
|
||||||
const VideoCodec& codec,
|
const Codec& codec,
|
||||||
const std::string& scalability_mode,
|
const std::string& scalability_mode,
|
||||||
const webrtc::VideoSendStream::Config& config) {
|
const webrtc::VideoSendStream::Config& config) {
|
||||||
return config.encoder_settings.encoder_factory
|
return config.encoder_settings.encoder_factory
|
||||||
|
@ -509,7 +509,7 @@ bool IsScalabilityModeSupportedByCodec(
|
||||||
// Fallback to default value if the scalability mode is unset or unsupported by
|
// Fallback to default value if the scalability mode is unset or unsupported by
|
||||||
// the codec.
|
// the codec.
|
||||||
void FallbackToDefaultScalabilityModeIfNotSupported(
|
void FallbackToDefaultScalabilityModeIfNotSupported(
|
||||||
const VideoCodec& codec,
|
const Codec& codec,
|
||||||
const webrtc::VideoSendStream::Config& config,
|
const webrtc::VideoSendStream::Config& config,
|
||||||
std::vector<webrtc::RtpEncodingParameters>& encodings) {
|
std::vector<webrtc::RtpEncodingParameters>& encodings) {
|
||||||
if (!absl::c_any_of(encodings,
|
if (!absl::c_any_of(encodings,
|
||||||
|
@ -545,8 +545,7 @@ void FallbackToDefaultScalabilityModeIfNotSupported(
|
||||||
// "codecs". Note that VideoCodecSettings correspond to concrete codecs like
|
// "codecs". Note that VideoCodecSettings correspond to concrete codecs like
|
||||||
// VP8, VP9, H264 while VideoCodecs correspond also to "virtual" codecs like
|
// VP8, VP9, H264 while VideoCodecs correspond also to "virtual" codecs like
|
||||||
// RTX, ULPFEC, FLEXFEC.
|
// RTX, ULPFEC, FLEXFEC.
|
||||||
std::vector<VideoCodecSettings> MapCodecs(
|
std::vector<VideoCodecSettings> MapCodecs(const std::vector<Codec>& codecs) {
|
||||||
const std::vector<VideoCodec>& codecs) {
|
|
||||||
if (codecs.empty()) {
|
if (codecs.empty()) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -560,7 +559,7 @@ std::vector<VideoCodecSettings> MapCodecs(
|
||||||
webrtc::UlpfecConfig ulpfec_config;
|
webrtc::UlpfecConfig ulpfec_config;
|
||||||
absl::optional<int> flexfec_payload_type;
|
absl::optional<int> flexfec_payload_type;
|
||||||
|
|
||||||
for (const VideoCodec& in_codec : codecs) {
|
for (const Codec& in_codec : codecs) {
|
||||||
const int payload_type = in_codec.id;
|
const int payload_type = in_codec.id;
|
||||||
|
|
||||||
if (payload_codec_type.find(payload_type) != payload_codec_type.end()) {
|
if (payload_codec_type.find(payload_type) != payload_codec_type.end()) {
|
||||||
|
@ -796,13 +795,13 @@ WebRtcVideoEngine::CreateReceiveChannel(
|
||||||
call, config, options, crypto_options, decoder_factory_.get());
|
call, config, options, crypto_options, decoder_factory_.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<VideoCodec> WebRtcVideoEngine::send_codecs(bool include_rtx) const {
|
std::vector<Codec> WebRtcVideoEngine::send_codecs(bool include_rtx) const {
|
||||||
return GetPayloadTypesAndDefaultCodecs(encoder_factory_.get(),
|
return GetPayloadTypesAndDefaultCodecs(encoder_factory_.get(),
|
||||||
/*is_decoder_factory=*/false,
|
/*is_decoder_factory=*/false,
|
||||||
include_rtx, trials_);
|
include_rtx, trials_);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<VideoCodec> WebRtcVideoEngine::recv_codecs(bool include_rtx) const {
|
std::vector<Codec> WebRtcVideoEngine::recv_codecs(bool include_rtx) const {
|
||||||
return GetPayloadTypesAndDefaultCodecs(decoder_factory_.get(),
|
return GetPayloadTypesAndDefaultCodecs(decoder_factory_.get(),
|
||||||
/*is_decoder_factory=*/true,
|
/*is_decoder_factory=*/true,
|
||||||
include_rtx, trials_);
|
include_rtx, trials_);
|
||||||
|
@ -902,7 +901,7 @@ WebRtcVideoSendChannel::~WebRtcVideoSendChannel() {
|
||||||
|
|
||||||
rtc::scoped_refptr<webrtc::VideoEncoderConfig::EncoderSpecificSettings>
|
rtc::scoped_refptr<webrtc::VideoEncoderConfig::EncoderSpecificSettings>
|
||||||
WebRtcVideoSendChannel::WebRtcVideoSendStream::ConfigureVideoEncoderSettings(
|
WebRtcVideoSendChannel::WebRtcVideoSendStream::ConfigureVideoEncoderSettings(
|
||||||
const VideoCodec& codec) {
|
const Codec& codec) {
|
||||||
RTC_DCHECK_RUN_ON(&thread_checker_);
|
RTC_DCHECK_RUN_ON(&thread_checker_);
|
||||||
bool is_screencast = parameters_.options.is_screencast.value_or(false);
|
bool is_screencast = parameters_.options.is_screencast.value_or(false);
|
||||||
// No automatic resizing when using simulcast or screencast, or when
|
// No automatic resizing when using simulcast or screencast, or when
|
||||||
|
@ -1298,7 +1297,7 @@ webrtc::RtpParameters WebRtcVideoSendChannel::GetRtpSendParameters(
|
||||||
webrtc::RtpParameters rtp_params = it->second->GetRtpParameters();
|
webrtc::RtpParameters rtp_params = it->second->GetRtpParameters();
|
||||||
// Need to add the common list of codecs to the send stream-specific
|
// Need to add the common list of codecs to the send stream-specific
|
||||||
// RTP parameters.
|
// RTP parameters.
|
||||||
for (const VideoCodec& codec : send_params_.codecs) {
|
for (const Codec& codec : send_params_.codecs) {
|
||||||
if (send_codec() && send_codec()->codec.id == codec.id) {
|
if (send_codec() && send_codec()->codec.id == codec.id) {
|
||||||
// Put the current send codec to the front of the codecs list.
|
// Put the current send codec to the front of the codecs list.
|
||||||
RTC_DCHECK_EQ(codec.name, send_codec()->codec.name);
|
RTC_DCHECK_EQ(codec.name, send_codec()->codec.name);
|
||||||
|
@ -2092,7 +2091,7 @@ void WebRtcVideoSendChannel::WebRtcVideoSendStream::UpdateSendState() {
|
||||||
|
|
||||||
webrtc::VideoEncoderConfig
|
webrtc::VideoEncoderConfig
|
||||||
WebRtcVideoSendChannel::WebRtcVideoSendStream::CreateVideoEncoderConfig(
|
WebRtcVideoSendChannel::WebRtcVideoSendStream::CreateVideoEncoderConfig(
|
||||||
const VideoCodec& codec) const {
|
const Codec& codec) const {
|
||||||
RTC_DCHECK_RUN_ON(&thread_checker_);
|
RTC_DCHECK_RUN_ON(&thread_checker_);
|
||||||
webrtc::VideoEncoderConfig encoder_config;
|
webrtc::VideoEncoderConfig encoder_config;
|
||||||
encoder_config.codec_type = webrtc::PayloadStringToCodecType(codec.name);
|
encoder_config.codec_type = webrtc::PayloadStringToCodecType(codec.name);
|
||||||
|
@ -2644,7 +2643,7 @@ webrtc::RtpParameters WebRtcVideoReceiveChannel::GetRtpReceiverParameters(
|
||||||
rtp_params.header_extensions = recv_rtp_extensions_;
|
rtp_params.header_extensions = recv_rtp_extensions_;
|
||||||
|
|
||||||
// Add codecs, which any stream is prepared to receive.
|
// Add codecs, which any stream is prepared to receive.
|
||||||
for (const VideoCodec& codec : recv_params_.codecs) {
|
for (const Codec& codec : recv_params_.codecs) {
|
||||||
rtp_params.codecs.push_back(codec.ToCodecParameters());
|
rtp_params.codecs.push_back(codec.ToCodecParameters());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2664,7 +2663,7 @@ WebRtcVideoReceiveChannel::GetDefaultRtpReceiveParameters() const {
|
||||||
rtp_params.encodings.emplace_back();
|
rtp_params.encodings.emplace_back();
|
||||||
|
|
||||||
// Add codecs, which any stream is prepared to receive.
|
// Add codecs, which any stream is prepared to receive.
|
||||||
for (const VideoCodec& codec : recv_params_.codecs) {
|
for (const Codec& codec : recv_params_.codecs) {
|
||||||
rtp_params.codecs.push_back(codec.ToCodecParameters());
|
rtp_params.codecs.push_back(codec.ToCodecParameters());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2690,7 +2689,7 @@ bool WebRtcVideoReceiveChannel::GetChangedReceiverParameters(
|
||||||
|
|
||||||
// Verify that every mapped codec is supported locally.
|
// Verify that every mapped codec is supported locally.
|
||||||
if (params.is_stream_active) {
|
if (params.is_stream_active) {
|
||||||
const std::vector<VideoCodec> local_supported_codecs =
|
const std::vector<Codec> local_supported_codecs =
|
||||||
GetPayloadTypesAndDefaultCodecs(decoder_factory_,
|
GetPayloadTypesAndDefaultCodecs(decoder_factory_,
|
||||||
/*is_decoder_factory=*/true,
|
/*is_decoder_factory=*/true,
|
||||||
/*include_rtx=*/true, call_->trials());
|
/*include_rtx=*/true, call_->trials());
|
||||||
|
@ -3041,7 +3040,7 @@ void WebRtcVideoReceiveChannel::FillReceiveCodecStats(
|
||||||
VideoMediaReceiveInfo* video_media_info) {
|
VideoMediaReceiveInfo* video_media_info) {
|
||||||
for (const auto& receiver : video_media_info->receivers) {
|
for (const auto& receiver : video_media_info->receivers) {
|
||||||
auto codec =
|
auto codec =
|
||||||
absl::c_find_if(recv_params_.codecs, [&receiver](const VideoCodec& c) {
|
absl::c_find_if(recv_params_.codecs, [&receiver](const Codec& c) {
|
||||||
return receiver.codec_payload_type &&
|
return receiver.codec_payload_type &&
|
||||||
*receiver.codec_payload_type == c.id;
|
*receiver.codec_payload_type == c.id;
|
||||||
});
|
});
|
||||||
|
@ -3911,7 +3910,7 @@ void WebRtcVideoReceiveChannel::SetDepacketizerToDecoderFrameTransformer(
|
||||||
|
|
||||||
// ------------------------- VideoCodecSettings --------------------
|
// ------------------------- VideoCodecSettings --------------------
|
||||||
|
|
||||||
VideoCodecSettings::VideoCodecSettings(const VideoCodec& codec)
|
VideoCodecSettings::VideoCodecSettings(const Codec& codec)
|
||||||
: codec(codec), flexfec_payload_type(-1), rtx_payload_type(-1) {}
|
: codec(codec), flexfec_payload_type(-1), rtx_payload_type(-1) {}
|
||||||
|
|
||||||
bool VideoCodecSettings::operator==(const VideoCodecSettings& other) const {
|
bool VideoCodecSettings::operator==(const VideoCodecSettings& other) const {
|
||||||
|
|
|
@ -116,14 +116,10 @@ class WebRtcVideoEngine : public VideoEngineInterface {
|
||||||
const VideoOptions& options,
|
const VideoOptions& options,
|
||||||
const webrtc::CryptoOptions& crypto_options) override;
|
const webrtc::CryptoOptions& crypto_options) override;
|
||||||
|
|
||||||
std::vector<VideoCodec> send_codecs() const override {
|
std::vector<Codec> send_codecs() const override { return send_codecs(true); }
|
||||||
return send_codecs(true);
|
std::vector<Codec> recv_codecs() const override { return recv_codecs(true); }
|
||||||
}
|
std::vector<Codec> send_codecs(bool include_rtx) const override;
|
||||||
std::vector<VideoCodec> recv_codecs() const override {
|
std::vector<Codec> recv_codecs(bool include_rtx) const override;
|
||||||
return recv_codecs(true);
|
|
||||||
}
|
|
||||||
std::vector<VideoCodec> send_codecs(bool include_rtx) const override;
|
|
||||||
std::vector<VideoCodec> recv_codecs(bool include_rtx) const override;
|
|
||||||
std::vector<webrtc::RtpHeaderExtensionCapability> GetRtpHeaderExtensions()
|
std::vector<webrtc::RtpHeaderExtensionCapability> GetRtpHeaderExtensions()
|
||||||
const override;
|
const override;
|
||||||
|
|
||||||
|
@ -136,7 +132,7 @@ class WebRtcVideoEngine : public VideoEngineInterface {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct VideoCodecSettings {
|
struct VideoCodecSettings {
|
||||||
explicit VideoCodecSettings(const VideoCodec& codec);
|
explicit VideoCodecSettings(const Codec& codec);
|
||||||
|
|
||||||
// Checks if all members of |*this| are equal to the corresponding members
|
// Checks if all members of |*this| are equal to the corresponding members
|
||||||
// of `other`.
|
// of `other`.
|
||||||
|
@ -148,7 +144,7 @@ struct VideoCodecSettings {
|
||||||
static bool EqualsDisregardingFlexfec(const VideoCodecSettings& a,
|
static bool EqualsDisregardingFlexfec(const VideoCodecSettings& a,
|
||||||
const VideoCodecSettings& b);
|
const VideoCodecSettings& b);
|
||||||
|
|
||||||
VideoCodec codec;
|
Codec codec;
|
||||||
webrtc::UlpfecConfig ulpfec;
|
webrtc::UlpfecConfig ulpfec;
|
||||||
int flexfec_payload_type; // -1 if absent.
|
int flexfec_payload_type; // -1 if absent.
|
||||||
int rtx_payload_type; // -1 if absent.
|
int rtx_payload_type; // -1 if absent.
|
||||||
|
@ -391,11 +387,11 @@ class WebRtcVideoSendChannel : public MediaChannelUtil,
|
||||||
};
|
};
|
||||||
|
|
||||||
rtc::scoped_refptr<webrtc::VideoEncoderConfig::EncoderSpecificSettings>
|
rtc::scoped_refptr<webrtc::VideoEncoderConfig::EncoderSpecificSettings>
|
||||||
ConfigureVideoEncoderSettings(const VideoCodec& codec);
|
ConfigureVideoEncoderSettings(const Codec& codec);
|
||||||
void SetCodec(const VideoCodecSettings& codec);
|
void SetCodec(const VideoCodecSettings& codec);
|
||||||
void RecreateWebRtcStream();
|
void RecreateWebRtcStream();
|
||||||
webrtc::VideoEncoderConfig CreateVideoEncoderConfig(
|
webrtc::VideoEncoderConfig CreateVideoEncoderConfig(
|
||||||
const VideoCodec& codec) const;
|
const Codec& codec) const;
|
||||||
void ReconfigureEncoder(webrtc::SetParametersCallback callback);
|
void ReconfigureEncoder(webrtc::SetParametersCallback callback);
|
||||||
|
|
||||||
// Calls Start or Stop according to whether or not `sending_` is true.
|
// Calls Start or Stop according to whether or not `sending_` is true.
|
||||||
|
|
|
@ -137,12 +137,12 @@ constexpr size_t kNumSimulcastStreams = 3;
|
||||||
static const char kUnsupportedExtensionName[] =
|
static const char kUnsupportedExtensionName[] =
|
||||||
"urn:ietf:params:rtp-hdrext:unsupported";
|
"urn:ietf:params:rtp-hdrext:unsupported";
|
||||||
|
|
||||||
cricket::VideoCodec RemoveFeedbackParams(cricket::VideoCodec&& codec) {
|
cricket::Codec RemoveFeedbackParams(cricket::Codec&& codec) {
|
||||||
codec.feedback_params = cricket::FeedbackParams();
|
codec.feedback_params = cricket::FeedbackParams();
|
||||||
return std::move(codec);
|
return std::move(codec);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VerifyCodecHasDefaultFeedbackParams(const cricket::VideoCodec& codec,
|
void VerifyCodecHasDefaultFeedbackParams(const cricket::Codec& codec,
|
||||||
bool lntf_expected) {
|
bool lntf_expected) {
|
||||||
EXPECT_EQ(lntf_expected,
|
EXPECT_EQ(lntf_expected,
|
||||||
codec.HasFeedbackParam(cricket::FeedbackParam(
|
codec.HasFeedbackParam(cricket::FeedbackParam(
|
||||||
|
@ -161,9 +161,8 @@ void VerifyCodecHasDefaultFeedbackParams(const cricket::VideoCodec& codec,
|
||||||
|
|
||||||
// Return true if any codec in `codecs` is an RTX codec with associated
|
// Return true if any codec in `codecs` is an RTX codec with associated
|
||||||
// payload type `payload_type`.
|
// payload type `payload_type`.
|
||||||
bool HasRtxCodec(const std::vector<cricket::VideoCodec>& codecs,
|
bool HasRtxCodec(const std::vector<cricket::Codec>& codecs, int payload_type) {
|
||||||
int payload_type) {
|
for (const cricket::Codec& codec : codecs) {
|
||||||
for (const cricket::VideoCodec& codec : codecs) {
|
|
||||||
int associated_payload_type;
|
int associated_payload_type;
|
||||||
if (absl::EqualsIgnoreCase(codec.name.c_str(), "rtx") &&
|
if (absl::EqualsIgnoreCase(codec.name.c_str(), "rtx") &&
|
||||||
codec.GetParam(cricket::kCodecParamAssociatedPayloadType,
|
codec.GetParam(cricket::kCodecParamAssociatedPayloadType,
|
||||||
|
@ -177,8 +176,8 @@ bool HasRtxCodec(const std::vector<cricket::VideoCodec>& codecs,
|
||||||
|
|
||||||
// Return true if any codec in `codecs` is an RTX codec, independent of
|
// Return true if any codec in `codecs` is an RTX codec, independent of
|
||||||
// payload type.
|
// payload type.
|
||||||
bool HasAnyRtxCodec(const std::vector<cricket::VideoCodec>& codecs) {
|
bool HasAnyRtxCodec(const std::vector<cricket::Codec>& codecs) {
|
||||||
for (const cricket::VideoCodec& codec : codecs) {
|
for (const cricket::Codec& codec : codecs) {
|
||||||
if (absl::EqualsIgnoreCase(codec.name.c_str(), "rtx")) {
|
if (absl::EqualsIgnoreCase(codec.name.c_str(), "rtx")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -381,7 +380,7 @@ class WebRtcVideoEngineTest : public ::testing::Test {
|
||||||
|
|
||||||
// Find the codec in the engine with the given name. The codec must be
|
// Find the codec in the engine with the given name. The codec must be
|
||||||
// present.
|
// present.
|
||||||
cricket::VideoCodec GetEngineCodec(const std::string& name) const;
|
cricket::Codec GetEngineCodec(const std::string& name) const;
|
||||||
void AddSupportedVideoCodecType(
|
void AddSupportedVideoCodecType(
|
||||||
const std::string& name,
|
const std::string& name,
|
||||||
const std::vector<webrtc::ScalabilityMode>& scalability_modes = {});
|
const std::vector<webrtc::ScalabilityMode>& scalability_modes = {});
|
||||||
|
@ -391,7 +390,7 @@ class WebRtcVideoEngineTest : public ::testing::Test {
|
||||||
std::unique_ptr<VideoMediaReceiveChannelInterface>
|
std::unique_ptr<VideoMediaReceiveChannelInterface>
|
||||||
SetRecvParamsWithAllSupportedCodecs();
|
SetRecvParamsWithAllSupportedCodecs();
|
||||||
std::unique_ptr<VideoMediaReceiveChannelInterface>
|
std::unique_ptr<VideoMediaReceiveChannelInterface>
|
||||||
SetRecvParamsWithSupportedCodecs(const std::vector<VideoCodec>& codecs);
|
SetRecvParamsWithSupportedCodecs(const std::vector<Codec>& codecs);
|
||||||
|
|
||||||
void ExpectRtpCapabilitySupport(const char* uri, bool supported) const;
|
void ExpectRtpCapabilitySupport(const char* uri, bool supported) const;
|
||||||
|
|
||||||
|
@ -406,7 +405,7 @@ class WebRtcVideoEngineTest : public ::testing::Test {
|
||||||
std::unique_ptr<webrtc::VideoBitrateAllocatorFactory>
|
std::unique_ptr<webrtc::VideoBitrateAllocatorFactory>
|
||||||
video_bitrate_allocator_factory_;
|
video_bitrate_allocator_factory_;
|
||||||
WebRtcVideoEngine engine_;
|
WebRtcVideoEngine engine_;
|
||||||
absl::optional<VideoCodec> default_codec_;
|
absl::optional<Codec> default_codec_;
|
||||||
std::map<int, int> default_apt_rtx_types_;
|
std::map<int, int> default_apt_rtx_types_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -414,7 +413,7 @@ TEST_F(WebRtcVideoEngineTest, DefaultRtxCodecHasAssociatedPayloadTypeSet) {
|
||||||
encoder_factory_->AddSupportedVideoCodecType("VP8");
|
encoder_factory_->AddSupportedVideoCodecType("VP8");
|
||||||
AssignDefaultCodec();
|
AssignDefaultCodec();
|
||||||
|
|
||||||
std::vector<VideoCodec> engine_codecs = engine_.send_codecs();
|
std::vector<Codec> engine_codecs = engine_.send_codecs();
|
||||||
for (size_t i = 0; i < engine_codecs.size(); ++i) {
|
for (size_t i = 0; i < engine_codecs.size(); ++i) {
|
||||||
if (engine_codecs[i].name != kRtxCodecName)
|
if (engine_codecs[i].name != kRtxCodecName)
|
||||||
continue;
|
continue;
|
||||||
|
@ -717,7 +716,7 @@ TEST_F(WebRtcVideoEngineTest, RtxCodecAddedForH264Codec) {
|
||||||
encoder_factory_->AddSupportedVideoCodec(h264_high);
|
encoder_factory_->AddSupportedVideoCodec(h264_high);
|
||||||
|
|
||||||
// First figure out what payload types the test codecs got assigned.
|
// First figure out what payload types the test codecs got assigned.
|
||||||
const std::vector<cricket::VideoCodec> codecs = engine_.send_codecs();
|
const std::vector<cricket::Codec> codecs = engine_.send_codecs();
|
||||||
// Now search for RTX codecs for them. Expect that they all have associated
|
// Now search for RTX codecs for them. Expect that they all have associated
|
||||||
// RTX codecs.
|
// RTX codecs.
|
||||||
EXPECT_TRUE(HasRtxCodec(
|
EXPECT_TRUE(HasRtxCodec(
|
||||||
|
@ -799,9 +798,9 @@ TEST_F(WebRtcVideoEngineTest, PropagatesInputFrameTimestamp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebRtcVideoEngineTest::AssignDefaultAptRtxTypes() {
|
void WebRtcVideoEngineTest::AssignDefaultAptRtxTypes() {
|
||||||
std::vector<VideoCodec> engine_codecs = engine_.send_codecs();
|
std::vector<Codec> engine_codecs = engine_.send_codecs();
|
||||||
RTC_DCHECK(!engine_codecs.empty());
|
RTC_DCHECK(!engine_codecs.empty());
|
||||||
for (const cricket::VideoCodec& codec : engine_codecs) {
|
for (const cricket::Codec& codec : engine_codecs) {
|
||||||
if (codec.name == "rtx") {
|
if (codec.name == "rtx") {
|
||||||
int associated_payload_type;
|
int associated_payload_type;
|
||||||
if (codec.GetParam(kCodecParamAssociatedPayloadType,
|
if (codec.GetParam(kCodecParamAssociatedPayloadType,
|
||||||
|
@ -813,10 +812,10 @@ void WebRtcVideoEngineTest::AssignDefaultAptRtxTypes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebRtcVideoEngineTest::AssignDefaultCodec() {
|
void WebRtcVideoEngineTest::AssignDefaultCodec() {
|
||||||
std::vector<VideoCodec> engine_codecs = engine_.send_codecs();
|
std::vector<Codec> engine_codecs = engine_.send_codecs();
|
||||||
RTC_DCHECK(!engine_codecs.empty());
|
RTC_DCHECK(!engine_codecs.empty());
|
||||||
bool codec_set = false;
|
bool codec_set = false;
|
||||||
for (const cricket::VideoCodec& codec : engine_codecs) {
|
for (const cricket::Codec& codec : engine_codecs) {
|
||||||
if (!codec_set && codec.name != "rtx" && codec.name != "red" &&
|
if (!codec_set && codec.name != "rtx" && codec.name != "red" &&
|
||||||
codec.name != "ulpfec" && codec.name != "flexfec-03") {
|
codec.name != "ulpfec" && codec.name != "flexfec-03") {
|
||||||
default_codec_ = codec;
|
default_codec_ = codec;
|
||||||
|
@ -829,9 +828,9 @@ void WebRtcVideoEngineTest::AssignDefaultCodec() {
|
||||||
|
|
||||||
size_t WebRtcVideoEngineTest::GetEngineCodecIndex(
|
size_t WebRtcVideoEngineTest::GetEngineCodecIndex(
|
||||||
const std::string& name) const {
|
const std::string& name) const {
|
||||||
const std::vector<cricket::VideoCodec> codecs = engine_.send_codecs();
|
const std::vector<cricket::Codec> codecs = engine_.send_codecs();
|
||||||
for (size_t i = 0; i < codecs.size(); ++i) {
|
for (size_t i = 0; i < codecs.size(); ++i) {
|
||||||
const cricket::VideoCodec engine_codec = codecs[i];
|
const cricket::Codec engine_codec = codecs[i];
|
||||||
if (!absl::EqualsIgnoreCase(name, engine_codec.name))
|
if (!absl::EqualsIgnoreCase(name, engine_codec.name))
|
||||||
continue;
|
continue;
|
||||||
// The tests only use H264 Constrained Baseline. Make sure we don't return
|
// The tests only use H264 Constrained Baseline. Make sure we don't return
|
||||||
|
@ -851,7 +850,7 @@ size_t WebRtcVideoEngineTest::GetEngineCodecIndex(
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
cricket::VideoCodec WebRtcVideoEngineTest::GetEngineCodec(
|
cricket::Codec WebRtcVideoEngineTest::GetEngineCodec(
|
||||||
const std::string& name) const {
|
const std::string& name) const {
|
||||||
return engine_.send_codecs()[GetEngineCodecIndex(name)];
|
return engine_.send_codecs()[GetEngineCodecIndex(name)];
|
||||||
}
|
}
|
||||||
|
@ -873,7 +872,7 @@ WebRtcVideoEngineTest::SetSendParamsWithAllSupportedCodecs() {
|
||||||
// We need to look up the codec in the engine to get the correct payload type.
|
// We need to look up the codec in the engine to get the correct payload type.
|
||||||
for (const webrtc::SdpVideoFormat& format :
|
for (const webrtc::SdpVideoFormat& format :
|
||||||
encoder_factory_->GetSupportedFormats()) {
|
encoder_factory_->GetSupportedFormats()) {
|
||||||
cricket::VideoCodec engine_codec = GetEngineCodec(format.name);
|
cricket::Codec engine_codec = GetEngineCodec(format.name);
|
||||||
if (!absl::c_linear_search(parameters.codecs, engine_codec)) {
|
if (!absl::c_linear_search(parameters.codecs, engine_codec)) {
|
||||||
parameters.codecs.push_back(engine_codec);
|
parameters.codecs.push_back(engine_codec);
|
||||||
}
|
}
|
||||||
|
@ -886,7 +885,7 @@ WebRtcVideoEngineTest::SetSendParamsWithAllSupportedCodecs() {
|
||||||
|
|
||||||
std::unique_ptr<VideoMediaReceiveChannelInterface>
|
std::unique_ptr<VideoMediaReceiveChannelInterface>
|
||||||
WebRtcVideoEngineTest::SetRecvParamsWithSupportedCodecs(
|
WebRtcVideoEngineTest::SetRecvParamsWithSupportedCodecs(
|
||||||
const std::vector<VideoCodec>& codecs) {
|
const std::vector<Codec>& codecs) {
|
||||||
std::unique_ptr<VideoMediaReceiveChannelInterface> channel =
|
std::unique_ptr<VideoMediaReceiveChannelInterface> channel =
|
||||||
engine_.CreateReceiveChannel(call_.get(), GetMediaConfig(),
|
engine_.CreateReceiveChannel(call_.get(), GetMediaConfig(),
|
||||||
VideoOptions(), webrtc::CryptoOptions());
|
VideoOptions(), webrtc::CryptoOptions());
|
||||||
|
@ -899,10 +898,10 @@ WebRtcVideoEngineTest::SetRecvParamsWithSupportedCodecs(
|
||||||
|
|
||||||
std::unique_ptr<VideoMediaReceiveChannelInterface>
|
std::unique_ptr<VideoMediaReceiveChannelInterface>
|
||||||
WebRtcVideoEngineTest::SetRecvParamsWithAllSupportedCodecs() {
|
WebRtcVideoEngineTest::SetRecvParamsWithAllSupportedCodecs() {
|
||||||
std::vector<VideoCodec> codecs;
|
std::vector<Codec> codecs;
|
||||||
for (const webrtc::SdpVideoFormat& format :
|
for (const webrtc::SdpVideoFormat& format :
|
||||||
decoder_factory_->GetSupportedFormats()) {
|
decoder_factory_->GetSupportedFormats()) {
|
||||||
cricket::VideoCodec engine_codec = GetEngineCodec(format.name);
|
cricket::Codec engine_codec = GetEngineCodec(format.name);
|
||||||
if (!absl::c_linear_search(codecs, engine_codec)) {
|
if (!absl::c_linear_search(codecs, engine_codec)) {
|
||||||
codecs.push_back(engine_codec);
|
codecs.push_back(engine_codec);
|
||||||
}
|
}
|
||||||
|
@ -965,7 +964,7 @@ TEST_F(WebRtcVideoEngineTest, UpdatesUnsignaledRtxSsrcAndRecoversPayload) {
|
||||||
// Setup a channel with VP8, RTX and transport sequence number header
|
// Setup a channel with VP8, RTX and transport sequence number header
|
||||||
// extension. Receive stream is not explicitly configured.
|
// extension. Receive stream is not explicitly configured.
|
||||||
AddSupportedVideoCodecType("VP8");
|
AddSupportedVideoCodecType("VP8");
|
||||||
std::vector<VideoCodec> supported_codecs =
|
std::vector<Codec> supported_codecs =
|
||||||
engine_.recv_codecs(/*include_rtx=*/true);
|
engine_.recv_codecs(/*include_rtx=*/true);
|
||||||
ASSERT_EQ(supported_codecs[1].name, "rtx");
|
ASSERT_EQ(supported_codecs[1].name, "rtx");
|
||||||
int rtx_payload_type = supported_codecs[1].id;
|
int rtx_payload_type = supported_codecs[1].id;
|
||||||
|
@ -1192,7 +1191,7 @@ TEST_F(WebRtcVideoEngineTest, SimulcastEnabledForH264) {
|
||||||
TEST_F(WebRtcVideoEngineTest, Flexfec03SendCodecEnablesWithFieldTrial) {
|
TEST_F(WebRtcVideoEngineTest, Flexfec03SendCodecEnablesWithFieldTrial) {
|
||||||
encoder_factory_->AddSupportedVideoCodecType("VP8");
|
encoder_factory_->AddSupportedVideoCodecType("VP8");
|
||||||
|
|
||||||
auto flexfec = Field("name", &VideoCodec::name, "flexfec-03");
|
auto flexfec = Field("name", &Codec::name, "flexfec-03");
|
||||||
|
|
||||||
EXPECT_THAT(engine_.send_codecs(), Not(Contains(flexfec)));
|
EXPECT_THAT(engine_.send_codecs(), Not(Contains(flexfec)));
|
||||||
|
|
||||||
|
@ -1205,16 +1204,15 @@ TEST_F(WebRtcVideoEngineTest, Flexfec03SendCodecEnablesWithFieldTrial) {
|
||||||
TEST_F(WebRtcVideoEngineTest, Flexfec03LowerPayloadTypeRange) {
|
TEST_F(WebRtcVideoEngineTest, Flexfec03LowerPayloadTypeRange) {
|
||||||
encoder_factory_->AddSupportedVideoCodecType("VP8");
|
encoder_factory_->AddSupportedVideoCodecType("VP8");
|
||||||
|
|
||||||
auto flexfec = Field("name", &VideoCodec::name, "flexfec-03");
|
auto flexfec = Field("name", &Codec::name, "flexfec-03");
|
||||||
|
|
||||||
// FlexFEC is active with field trial.
|
// FlexFEC is active with field trial.
|
||||||
webrtc::test::ScopedKeyValueConfig override_field_trials(
|
webrtc::test::ScopedKeyValueConfig override_field_trials(
|
||||||
field_trials_, "WebRTC-FlexFEC-03-Advertised/Enabled/");
|
field_trials_, "WebRTC-FlexFEC-03-Advertised/Enabled/");
|
||||||
auto send_codecs = engine_.send_codecs();
|
auto send_codecs = engine_.send_codecs();
|
||||||
auto it = std::find_if(send_codecs.begin(), send_codecs.end(),
|
auto it = std::find_if(
|
||||||
[](const cricket::VideoCodec& codec) {
|
send_codecs.begin(), send_codecs.end(),
|
||||||
return codec.name == "flexfec-03";
|
[](const cricket::Codec& codec) { return codec.name == "flexfec-03"; });
|
||||||
});
|
|
||||||
ASSERT_NE(it, send_codecs.end());
|
ASSERT_NE(it, send_codecs.end());
|
||||||
EXPECT_LE(35, it->id);
|
EXPECT_LE(35, it->id);
|
||||||
EXPECT_GE(65, it->id);
|
EXPECT_GE(65, it->id);
|
||||||
|
@ -1241,11 +1239,11 @@ TEST_F(WebRtcVideoEngineTest, ReportSupportedAddedCodec) {
|
||||||
// Set up external encoder factory with first codec, and initialize engine.
|
// Set up external encoder factory with first codec, and initialize engine.
|
||||||
encoder_factory_->AddSupportedVideoCodecType(kFakeExternalCodecName1);
|
encoder_factory_->AddSupportedVideoCodecType(kFakeExternalCodecName1);
|
||||||
|
|
||||||
std::vector<cricket::VideoCodec> codecs_before(engine_.send_codecs());
|
std::vector<cricket::Codec> codecs_before(engine_.send_codecs());
|
||||||
|
|
||||||
// Add second codec.
|
// Add second codec.
|
||||||
encoder_factory_->AddSupportedVideoCodecType(kFakeExternalCodecName2);
|
encoder_factory_->AddSupportedVideoCodecType(kFakeExternalCodecName2);
|
||||||
std::vector<cricket::VideoCodec> codecs_after(engine_.send_codecs());
|
std::vector<cricket::Codec> codecs_after(engine_.send_codecs());
|
||||||
// The codec itself and RTX should have been added.
|
// The codec itself and RTX should have been added.
|
||||||
EXPECT_EQ(codecs_before.size() + 2, codecs_after.size());
|
EXPECT_EQ(codecs_before.size() + 2, codecs_after.size());
|
||||||
|
|
||||||
|
@ -1293,7 +1291,7 @@ TEST_F(WebRtcVideoEngineTest, RegisterH264DecoderIfSupported) {
|
||||||
// For now we add a FakeWebRtcVideoEncoderFactory to add H264 to supported
|
// For now we add a FakeWebRtcVideoEncoderFactory to add H264 to supported
|
||||||
// codecs.
|
// codecs.
|
||||||
AddSupportedVideoCodecType("H264");
|
AddSupportedVideoCodecType("H264");
|
||||||
std::vector<cricket::VideoCodec> codecs;
|
std::vector<cricket::Codec> codecs;
|
||||||
codecs.push_back(GetEngineCodec("H264"));
|
codecs.push_back(GetEngineCodec("H264"));
|
||||||
|
|
||||||
auto receive_channel = SetRecvParamsWithSupportedCodecs(codecs);
|
auto receive_channel = SetRecvParamsWithSupportedCodecs(codecs);
|
||||||
|
@ -1382,7 +1380,7 @@ TEST(WebRtcVideoEngineNewVideoCodecFactoryTest, Vp8) {
|
||||||
.WillRepeatedly(Return(supported_formats));
|
.WillRepeatedly(Return(supported_formats));
|
||||||
|
|
||||||
// Verify the codecs from the engine.
|
// Verify the codecs from the engine.
|
||||||
const std::vector<VideoCodec> engine_codecs = engine.send_codecs();
|
const std::vector<Codec> engine_codecs = engine.send_codecs();
|
||||||
// Verify default codecs has been added correctly.
|
// Verify default codecs has been added correctly.
|
||||||
EXPECT_EQ(5u, engine_codecs.size());
|
EXPECT_EQ(5u, engine_codecs.size());
|
||||||
EXPECT_EQ("VP8", engine_codecs.at(0).name);
|
EXPECT_EQ("VP8", engine_codecs.at(0).name);
|
||||||
|
@ -1481,7 +1479,7 @@ TEST_F(WebRtcVideoEngineTest, DISABLED_RecreatesEncoderOnContentTypeChange) {
|
||||||
|
|
||||||
ASSERT_TRUE(
|
ASSERT_TRUE(
|
||||||
send_channel->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc)));
|
send_channel->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc)));
|
||||||
cricket::VideoCodec codec = GetEngineCodec("VP8");
|
cricket::Codec codec = GetEngineCodec("VP8");
|
||||||
cricket::VideoSenderParameters parameters;
|
cricket::VideoSenderParameters parameters;
|
||||||
parameters.codecs.push_back(codec);
|
parameters.codecs.push_back(codec);
|
||||||
send_channel->OnReadyToSend(true);
|
send_channel->OnReadyToSend(true);
|
||||||
|
@ -1536,8 +1534,8 @@ TEST_F(WebRtcVideoEngineTest, DISABLED_RecreatesEncoderOnContentTypeChange) {
|
||||||
|
|
||||||
TEST_F(WebRtcVideoEngineTest, SetVideoRtxEnabled) {
|
TEST_F(WebRtcVideoEngineTest, SetVideoRtxEnabled) {
|
||||||
AddSupportedVideoCodecType("VP8");
|
AddSupportedVideoCodecType("VP8");
|
||||||
std::vector<VideoCodec> send_codecs;
|
std::vector<Codec> send_codecs;
|
||||||
std::vector<VideoCodec> recv_codecs;
|
std::vector<Codec> recv_codecs;
|
||||||
|
|
||||||
webrtc::test::ScopedKeyValueConfig field_trials;
|
webrtc::test::ScopedKeyValueConfig field_trials;
|
||||||
|
|
||||||
|
@ -1831,7 +1829,7 @@ class WebRtcVideoChannelBaseTest : public ::testing::Test {
|
||||||
|
|
||||||
bool SetDefaultCodec() { return SetOneCodec(DefaultCodec()); }
|
bool SetDefaultCodec() { return SetOneCodec(DefaultCodec()); }
|
||||||
|
|
||||||
bool SetOneCodec(const cricket::VideoCodec& codec) {
|
bool SetOneCodec(const cricket::Codec& codec) {
|
||||||
frame_source_ = std::make_unique<cricket::FakeFrameSource>(
|
frame_source_ = std::make_unique<cricket::FakeFrameSource>(
|
||||||
kVideoWidth, kVideoHeight, rtc::kNumMicrosecsPerSec / kFramerate);
|
kVideoWidth, kVideoHeight, rtc::kNumMicrosecsPerSec / kFramerate);
|
||||||
|
|
||||||
|
@ -1879,7 +1877,7 @@ class WebRtcVideoChannelBaseTest : public ::testing::Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that we can send and receive frames.
|
// Tests that we can send and receive frames.
|
||||||
void SendAndReceive(const cricket::VideoCodec& codec) {
|
void SendAndReceive(const cricket::Codec& codec) {
|
||||||
EXPECT_TRUE(SetOneCodec(codec));
|
EXPECT_TRUE(SetOneCodec(codec));
|
||||||
EXPECT_TRUE(SetSend(true));
|
EXPECT_TRUE(SetSend(true));
|
||||||
receive_channel_->SetDefaultSink(&renderer_);
|
receive_channel_->SetDefaultSink(&renderer_);
|
||||||
|
@ -1889,7 +1887,7 @@ class WebRtcVideoChannelBaseTest : public ::testing::Test {
|
||||||
EXPECT_EQ(codec.id, GetPayloadType(GetRtpPacket(0)));
|
EXPECT_EQ(codec.id, GetPayloadType(GetRtpPacket(0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendReceiveManyAndGetStats(const cricket::VideoCodec& codec,
|
void SendReceiveManyAndGetStats(const cricket::Codec& codec,
|
||||||
int duration_sec,
|
int duration_sec,
|
||||||
int fps) {
|
int fps) {
|
||||||
EXPECT_TRUE(SetOneCodec(codec));
|
EXPECT_TRUE(SetOneCodec(codec));
|
||||||
|
@ -1920,7 +1918,7 @@ class WebRtcVideoChannelBaseTest : public ::testing::Test {
|
||||||
// Two streams one channel tests.
|
// Two streams one channel tests.
|
||||||
|
|
||||||
// Tests that we can send and receive frames.
|
// Tests that we can send and receive frames.
|
||||||
void TwoStreamsSendAndReceive(const cricket::VideoCodec& codec) {
|
void TwoStreamsSendAndReceive(const cricket::Codec& codec) {
|
||||||
SetUpSecondStream();
|
SetUpSecondStream();
|
||||||
// Test sending and receiving on first stream.
|
// Test sending and receiving on first stream.
|
||||||
SendAndReceive(codec);
|
SendAndReceive(codec);
|
||||||
|
@ -1929,8 +1927,8 @@ class WebRtcVideoChannelBaseTest : public ::testing::Test {
|
||||||
EXPECT_GT(NumRtpPackets(), 0);
|
EXPECT_GT(NumRtpPackets(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
cricket::VideoCodec GetEngineCodec(const std::string& name) {
|
cricket::Codec GetEngineCodec(const std::string& name) {
|
||||||
for (const cricket::VideoCodec& engine_codec : engine_.send_codecs()) {
|
for (const cricket::Codec& engine_codec : engine_.send_codecs()) {
|
||||||
if (absl::EqualsIgnoreCase(name, engine_codec.name))
|
if (absl::EqualsIgnoreCase(name, engine_codec.name))
|
||||||
return engine_codec;
|
return engine_codec;
|
||||||
}
|
}
|
||||||
|
@ -1939,7 +1937,7 @@ class WebRtcVideoChannelBaseTest : public ::testing::Test {
|
||||||
return cricket::CreateVideoCodec(0, "");
|
return cricket::CreateVideoCodec(0, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
cricket::VideoCodec DefaultCodec() { return GetEngineCodec("VP8"); }
|
cricket::Codec DefaultCodec() { return GetEngineCodec("VP8"); }
|
||||||
|
|
||||||
cricket::StreamParams DefaultSendStreamParams() {
|
cricket::StreamParams DefaultSendStreamParams() {
|
||||||
return cricket::StreamParams::CreateLegacy(kSsrc);
|
return cricket::StreamParams::CreateLegacy(kSsrc);
|
||||||
|
@ -2303,12 +2301,12 @@ TEST_F(WebRtcVideoChannelBaseTest, SimulateConference) {
|
||||||
|
|
||||||
// Tests that we can add and remove capturers and frames are sent out properly
|
// Tests that we can add and remove capturers and frames are sent out properly
|
||||||
TEST_F(WebRtcVideoChannelBaseTest, DISABLED_AddRemoveCapturer) {
|
TEST_F(WebRtcVideoChannelBaseTest, DISABLED_AddRemoveCapturer) {
|
||||||
|
using cricket::Codec;
|
||||||
using cricket::FOURCC_I420;
|
using cricket::FOURCC_I420;
|
||||||
using cricket::VideoCodec;
|
|
||||||
using cricket::VideoFormat;
|
using cricket::VideoFormat;
|
||||||
using cricket::VideoOptions;
|
using cricket::VideoOptions;
|
||||||
|
|
||||||
VideoCodec codec = DefaultCodec();
|
Codec codec = DefaultCodec();
|
||||||
const int time_between_send_ms = VideoFormat::FpsToInterval(kFramerate);
|
const int time_between_send_ms = VideoFormat::FpsToInterval(kFramerate);
|
||||||
EXPECT_TRUE(SetOneCodec(codec));
|
EXPECT_TRUE(SetOneCodec(codec));
|
||||||
EXPECT_TRUE(SetSend(true));
|
EXPECT_TRUE(SetSend(true));
|
||||||
|
@ -2495,7 +2493,7 @@ TEST_F(WebRtcVideoChannelBaseTest, TwoStreamsSendAndReceive) {
|
||||||
// initially will use QVGA instead of VGA.
|
// initially will use QVGA instead of VGA.
|
||||||
// TODO(pbos): Set up the quality scaler so that both senders reliably start
|
// TODO(pbos): Set up the quality scaler so that both senders reliably start
|
||||||
// at QVGA, then verify that instead.
|
// at QVGA, then verify that instead.
|
||||||
cricket::VideoCodec codec = GetEngineCodec("VP8");
|
cricket::Codec codec = GetEngineCodec("VP8");
|
||||||
codec.params[kCodecParamStartBitrate] = "1000000";
|
codec.params[kCodecParamStartBitrate] = "1000000";
|
||||||
TwoStreamsSendAndReceive(codec);
|
TwoStreamsSendAndReceive(codec);
|
||||||
}
|
}
|
||||||
|
@ -2508,7 +2506,7 @@ TEST_F(WebRtcVideoChannelBaseTest, RequestEncoderFallback) {
|
||||||
parameters.codecs.push_back(GetEngineCodec("VP8"));
|
parameters.codecs.push_back(GetEngineCodec("VP8"));
|
||||||
EXPECT_TRUE(send_channel_->SetSenderParameters(parameters));
|
EXPECT_TRUE(send_channel_->SetSenderParameters(parameters));
|
||||||
|
|
||||||
absl::optional<VideoCodec> codec = send_channel_->GetSendCodec();
|
absl::optional<Codec> codec = send_channel_->GetSendCodec();
|
||||||
ASSERT_TRUE(codec);
|
ASSERT_TRUE(codec);
|
||||||
EXPECT_EQ("VP9", codec->name);
|
EXPECT_EQ("VP9", codec->name);
|
||||||
|
|
||||||
|
@ -2534,7 +2532,7 @@ TEST_F(WebRtcVideoChannelBaseTest, RequestEncoderSwitchDefaultFallback) {
|
||||||
parameters.codecs.push_back(GetEngineCodec("VP8"));
|
parameters.codecs.push_back(GetEngineCodec("VP8"));
|
||||||
EXPECT_TRUE(send_channel_->SetSenderParameters(parameters));
|
EXPECT_TRUE(send_channel_->SetSenderParameters(parameters));
|
||||||
|
|
||||||
absl::optional<VideoCodec> codec = send_channel_->GetSendCodec();
|
absl::optional<Codec> codec = send_channel_->GetSendCodec();
|
||||||
ASSERT_TRUE(codec);
|
ASSERT_TRUE(codec);
|
||||||
EXPECT_EQ("VP9", codec->name);
|
EXPECT_EQ("VP9", codec->name);
|
||||||
|
|
||||||
|
@ -2552,7 +2550,7 @@ TEST_F(WebRtcVideoChannelBaseTest, RequestEncoderSwitchDefaultFallback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WebRtcVideoChannelBaseTest, RequestEncoderSwitchStrictPreference) {
|
TEST_F(WebRtcVideoChannelBaseTest, RequestEncoderSwitchStrictPreference) {
|
||||||
VideoCodec vp9 = GetEngineCodec("VP9");
|
Codec vp9 = GetEngineCodec("VP9");
|
||||||
vp9.params["profile-id"] = "0";
|
vp9.params["profile-id"] = "0";
|
||||||
|
|
||||||
cricket::VideoSenderParameters parameters;
|
cricket::VideoSenderParameters parameters;
|
||||||
|
@ -2560,7 +2558,7 @@ TEST_F(WebRtcVideoChannelBaseTest, RequestEncoderSwitchStrictPreference) {
|
||||||
parameters.codecs.push_back(vp9);
|
parameters.codecs.push_back(vp9);
|
||||||
EXPECT_TRUE(send_channel_->SetSenderParameters(parameters));
|
EXPECT_TRUE(send_channel_->SetSenderParameters(parameters));
|
||||||
|
|
||||||
absl::optional<VideoCodec> codec = send_channel_->GetSendCodec();
|
absl::optional<Codec> codec = send_channel_->GetSendCodec();
|
||||||
ASSERT_TRUE(codec);
|
ASSERT_TRUE(codec);
|
||||||
EXPECT_EQ("VP8", codec->name);
|
EXPECT_EQ("VP8", codec->name);
|
||||||
|
|
||||||
|
@ -2674,8 +2672,8 @@ class WebRtcVideoChannelTest : public WebRtcVideoEngineTest {
|
||||||
return static_cast<cricket::WebRtcVideoSendChannel*>(channel)->transport();
|
return static_cast<cricket::WebRtcVideoSendChannel*>(channel)->transport();
|
||||||
}
|
}
|
||||||
|
|
||||||
cricket::VideoCodec GetEngineCodec(const std::string& name) {
|
cricket::Codec GetEngineCodec(const std::string& name) {
|
||||||
for (const cricket::VideoCodec& engine_codec : engine_.send_codecs()) {
|
for (const cricket::Codec& engine_codec : engine_.send_codecs()) {
|
||||||
if (absl::EqualsIgnoreCase(name, engine_codec.name))
|
if (absl::EqualsIgnoreCase(name, engine_codec.name))
|
||||||
return engine_codec;
|
return engine_codec;
|
||||||
}
|
}
|
||||||
|
@ -2684,7 +2682,7 @@ class WebRtcVideoChannelTest : public WebRtcVideoEngineTest {
|
||||||
return cricket::CreateVideoCodec(0, "");
|
return cricket::CreateVideoCodec(0, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
cricket::VideoCodec DefaultCodec() { return GetEngineCodec("VP8"); }
|
cricket::Codec DefaultCodec() { return GetEngineCodec("VP8"); }
|
||||||
|
|
||||||
// After receciving and processing the packet, enough time is advanced that
|
// After receciving and processing the packet, enough time is advanced that
|
||||||
// the unsignalled receive stream cooldown is no longer in effect.
|
// the unsignalled receive stream cooldown is no longer in effect.
|
||||||
|
@ -3425,7 +3423,7 @@ TEST_F(WebRtcVideoChannelTest, ReconfiguresEncodersWhenNotSending) {
|
||||||
|
|
||||||
TEST_F(WebRtcVideoChannelTest, UsesCorrectSettingsForScreencast) {
|
TEST_F(WebRtcVideoChannelTest, UsesCorrectSettingsForScreencast) {
|
||||||
static const int kScreenshareMinBitrateKbps = 800;
|
static const int kScreenshareMinBitrateKbps = 800;
|
||||||
cricket::VideoCodec codec = GetEngineCodec("VP8");
|
cricket::Codec codec = GetEngineCodec("VP8");
|
||||||
cricket::VideoSenderParameters parameters;
|
cricket::VideoSenderParameters parameters;
|
||||||
parameters.codecs.push_back(codec);
|
parameters.codecs.push_back(codec);
|
||||||
EXPECT_TRUE(send_channel_->SetSenderParameters(parameters));
|
EXPECT_TRUE(send_channel_->SetSenderParameters(parameters));
|
||||||
|
@ -4126,7 +4124,7 @@ TEST_F(WebRtcVideoChannelTest, DoesNotAdaptOnOveruseWhenScreensharing) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WebRtcVideoChannelTest, PreviousAdaptationDoesNotApplyToScreenshare) {
|
TEST_F(WebRtcVideoChannelTest, PreviousAdaptationDoesNotApplyToScreenshare) {
|
||||||
cricket::VideoCodec codec = GetEngineCodec("VP8");
|
cricket::Codec codec = GetEngineCodec("VP8");
|
||||||
cricket::VideoSenderParameters parameters;
|
cricket::VideoSenderParameters parameters;
|
||||||
parameters.codecs.push_back(codec);
|
parameters.codecs.push_back(codec);
|
||||||
|
|
||||||
|
@ -4180,7 +4178,7 @@ TEST_F(WebRtcVideoChannelTest, PreviousAdaptationDoesNotApplyToScreenshare) {
|
||||||
void WebRtcVideoChannelTest::TestDegradationPreference(
|
void WebRtcVideoChannelTest::TestDegradationPreference(
|
||||||
bool resolution_scaling_enabled,
|
bool resolution_scaling_enabled,
|
||||||
bool fps_scaling_enabled) {
|
bool fps_scaling_enabled) {
|
||||||
cricket::VideoCodec codec = GetEngineCodec("VP8");
|
cricket::Codec codec = GetEngineCodec("VP8");
|
||||||
cricket::VideoSenderParameters parameters;
|
cricket::VideoSenderParameters parameters;
|
||||||
parameters.codecs.push_back(codec);
|
parameters.codecs.push_back(codec);
|
||||||
|
|
||||||
|
@ -4214,7 +4212,7 @@ void WebRtcVideoChannelTest::TestDegradationPreference(
|
||||||
|
|
||||||
void WebRtcVideoChannelTest::TestCpuAdaptation(bool enable_overuse,
|
void WebRtcVideoChannelTest::TestCpuAdaptation(bool enable_overuse,
|
||||||
bool is_screenshare) {
|
bool is_screenshare) {
|
||||||
cricket::VideoCodec codec = GetEngineCodec("VP8");
|
cricket::Codec codec = GetEngineCodec("VP8");
|
||||||
cricket::VideoSenderParameters parameters;
|
cricket::VideoSenderParameters parameters;
|
||||||
parameters.codecs.push_back(codec);
|
parameters.codecs.push_back(codec);
|
||||||
|
|
||||||
|
@ -4305,7 +4303,7 @@ TEST_F(WebRtcVideoChannelTest, SetDefaultSendCodecs) {
|
||||||
AssignDefaultAptRtxTypes();
|
AssignDefaultAptRtxTypes();
|
||||||
ASSERT_TRUE(send_channel_->SetSenderParameters(send_parameters_));
|
ASSERT_TRUE(send_channel_->SetSenderParameters(send_parameters_));
|
||||||
|
|
||||||
absl::optional<VideoCodec> codec = send_channel_->GetSendCodec();
|
absl::optional<Codec> codec = send_channel_->GetSendCodec();
|
||||||
ASSERT_TRUE(codec);
|
ASSERT_TRUE(codec);
|
||||||
EXPECT_TRUE(codec->Matches(engine_.send_codecs()[0]));
|
EXPECT_TRUE(codec->Matches(engine_.send_codecs()[0]));
|
||||||
|
|
||||||
|
@ -4534,7 +4532,7 @@ TEST_F(WebRtcVideoChannelFlexfecRecvTest, DuplicateFlexfecCodecIsDropped) {
|
||||||
cricket::VideoReceiverParameters recv_parameters;
|
cricket::VideoReceiverParameters recv_parameters;
|
||||||
recv_parameters.codecs.push_back(GetEngineCodec("VP8"));
|
recv_parameters.codecs.push_back(GetEngineCodec("VP8"));
|
||||||
recv_parameters.codecs.push_back(GetEngineCodec("flexfec-03"));
|
recv_parameters.codecs.push_back(GetEngineCodec("flexfec-03"));
|
||||||
cricket::VideoCodec duplicate = GetEngineCodec("flexfec-03");
|
cricket::Codec duplicate = GetEngineCodec("flexfec-03");
|
||||||
duplicate.id = kUnusedPayloadType1;
|
duplicate.id = kUnusedPayloadType1;
|
||||||
recv_parameters.codecs.push_back(duplicate);
|
recv_parameters.codecs.push_back(duplicate);
|
||||||
ASSERT_TRUE(receive_channel_->SetReceiverParameters(recv_parameters));
|
ASSERT_TRUE(receive_channel_->SetReceiverParameters(recv_parameters));
|
||||||
|
@ -4677,7 +4675,7 @@ TEST_F(WebRtcVideoChannelTest,
|
||||||
EXPECT_FALSE(FindCodecById(engine_.send_codecs(), kUnusedPayloadType));
|
EXPECT_FALSE(FindCodecById(engine_.send_codecs(), kUnusedPayloadType));
|
||||||
|
|
||||||
cricket::VideoSenderParameters parameters;
|
cricket::VideoSenderParameters parameters;
|
||||||
cricket::VideoCodec rtx_codec =
|
cricket::Codec rtx_codec =
|
||||||
cricket::CreateVideoCodec(kUnusedPayloadType, "rtx");
|
cricket::CreateVideoCodec(kUnusedPayloadType, "rtx");
|
||||||
parameters.codecs.push_back(rtx_codec);
|
parameters.codecs.push_back(rtx_codec);
|
||||||
EXPECT_FALSE(send_channel_->SetSenderParameters(parameters))
|
EXPECT_FALSE(send_channel_->SetSenderParameters(parameters))
|
||||||
|
@ -4691,7 +4689,7 @@ TEST_F(WebRtcVideoChannelTest,
|
||||||
EXPECT_FALSE(FindCodecById(engine_.send_codecs(), kUnusedPayloadType1));
|
EXPECT_FALSE(FindCodecById(engine_.send_codecs(), kUnusedPayloadType1));
|
||||||
EXPECT_FALSE(FindCodecById(engine_.send_codecs(), kUnusedPayloadType2));
|
EXPECT_FALSE(FindCodecById(engine_.send_codecs(), kUnusedPayloadType2));
|
||||||
{
|
{
|
||||||
cricket::VideoCodec rtx_codec = cricket::CreateVideoRtxCodec(
|
cricket::Codec rtx_codec = cricket::CreateVideoRtxCodec(
|
||||||
kUnusedPayloadType1, GetEngineCodec("VP8").id);
|
kUnusedPayloadType1, GetEngineCodec("VP8").id);
|
||||||
cricket::VideoSenderParameters parameters;
|
cricket::VideoSenderParameters parameters;
|
||||||
parameters.codecs.push_back(GetEngineCodec("VP8"));
|
parameters.codecs.push_back(GetEngineCodec("VP8"));
|
||||||
|
@ -4699,7 +4697,7 @@ TEST_F(WebRtcVideoChannelTest,
|
||||||
ASSERT_TRUE(send_channel_->SetSenderParameters(parameters));
|
ASSERT_TRUE(send_channel_->SetSenderParameters(parameters));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
cricket::VideoCodec rtx_codec =
|
cricket::Codec rtx_codec =
|
||||||
cricket::CreateVideoRtxCodec(kUnusedPayloadType1, kUnusedPayloadType2);
|
cricket::CreateVideoRtxCodec(kUnusedPayloadType1, kUnusedPayloadType2);
|
||||||
cricket::VideoSenderParameters parameters;
|
cricket::VideoSenderParameters parameters;
|
||||||
parameters.codecs.push_back(GetEngineCodec("VP8"));
|
parameters.codecs.push_back(GetEngineCodec("VP8"));
|
||||||
|
@ -4724,7 +4722,7 @@ TEST_F(WebRtcVideoChannelTest, SetSendCodecsWithChangedRtxPayloadType) {
|
||||||
// Original payload type for RTX.
|
// Original payload type for RTX.
|
||||||
cricket::VideoSenderParameters parameters;
|
cricket::VideoSenderParameters parameters;
|
||||||
parameters.codecs.push_back(GetEngineCodec("VP8"));
|
parameters.codecs.push_back(GetEngineCodec("VP8"));
|
||||||
cricket::VideoCodec rtx_codec =
|
cricket::Codec rtx_codec =
|
||||||
cricket::CreateVideoCodec(kUnusedPayloadType1, "rtx");
|
cricket::CreateVideoCodec(kUnusedPayloadType1, "rtx");
|
||||||
rtx_codec.SetParam("apt", GetEngineCodec("VP8").id);
|
rtx_codec.SetParam("apt", GetEngineCodec("VP8").id);
|
||||||
parameters.codecs.push_back(rtx_codec);
|
parameters.codecs.push_back(rtx_codec);
|
||||||
|
@ -4794,7 +4792,7 @@ TEST_F(WebRtcVideoChannelFlexfecSendRecvTest,
|
||||||
|
|
||||||
TEST_F(WebRtcVideoChannelTest, SetSendCodecsChangesExistingStreams) {
|
TEST_F(WebRtcVideoChannelTest, SetSendCodecsChangesExistingStreams) {
|
||||||
cricket::VideoSenderParameters parameters;
|
cricket::VideoSenderParameters parameters;
|
||||||
cricket::VideoCodec codec = cricket::CreateVideoCodec(100, "VP8");
|
cricket::Codec codec = cricket::CreateVideoCodec(100, "VP8");
|
||||||
codec.SetParam(kCodecParamMaxQuantization, kDefaultVideoMaxQpVpx);
|
codec.SetParam(kCodecParamMaxQuantization, kDefaultVideoMaxQpVpx);
|
||||||
parameters.codecs.push_back(codec);
|
parameters.codecs.push_back(codec);
|
||||||
|
|
||||||
|
@ -5096,7 +5094,7 @@ TEST_F(WebRtcVideoChannelTest, SetSendCodecsWithMaxQuantization) {
|
||||||
EXPECT_EQ(atoi(kMaxQuantization),
|
EXPECT_EQ(atoi(kMaxQuantization),
|
||||||
AddSendStream()->GetVideoStreams().back().max_qp);
|
AddSendStream()->GetVideoStreams().back().max_qp);
|
||||||
|
|
||||||
absl::optional<VideoCodec> codec = send_channel_->GetSendCodec();
|
absl::optional<Codec> codec = send_channel_->GetSendCodec();
|
||||||
ASSERT_TRUE(codec);
|
ASSERT_TRUE(codec);
|
||||||
EXPECT_EQ(kMaxQuantization, codec->params[kCodecParamMaxQuantization]);
|
EXPECT_EQ(kMaxQuantization, codec->params[kCodecParamMaxQuantization]);
|
||||||
}
|
}
|
||||||
|
@ -5158,7 +5156,7 @@ TEST_F(WebRtcVideoChannelTest, SetRecvCodecsWithRtx) {
|
||||||
|
|
||||||
cricket::VideoReceiverParameters parameters;
|
cricket::VideoReceiverParameters parameters;
|
||||||
parameters.codecs.push_back(GetEngineCodec("VP8"));
|
parameters.codecs.push_back(GetEngineCodec("VP8"));
|
||||||
cricket::VideoCodec rtx_codec =
|
cricket::Codec rtx_codec =
|
||||||
cricket::CreateVideoCodec(kUnusedPayloadType1, "rtx");
|
cricket::CreateVideoCodec(kUnusedPayloadType1, "rtx");
|
||||||
parameters.codecs.push_back(rtx_codec);
|
parameters.codecs.push_back(rtx_codec);
|
||||||
EXPECT_FALSE(receive_channel_->SetReceiverParameters(parameters))
|
EXPECT_FALSE(receive_channel_->SetReceiverParameters(parameters))
|
||||||
|
@ -5171,7 +5169,7 @@ TEST_F(WebRtcVideoChannelTest, SetRecvCodecsWithRtx) {
|
||||||
parameters.codecs[1].SetParam("apt", GetEngineCodec("VP8").id);
|
parameters.codecs[1].SetParam("apt", GetEngineCodec("VP8").id);
|
||||||
EXPECT_TRUE(receive_channel_->SetReceiverParameters(parameters));
|
EXPECT_TRUE(receive_channel_->SetReceiverParameters(parameters));
|
||||||
|
|
||||||
cricket::VideoCodec rtx_codec2 =
|
cricket::Codec rtx_codec2 =
|
||||||
cricket::CreateVideoCodec(kUnusedPayloadType2, "rtx");
|
cricket::CreateVideoCodec(kUnusedPayloadType2, "rtx");
|
||||||
rtx_codec2.SetParam("apt", rtx_codec.id);
|
rtx_codec2.SetParam("apt", rtx_codec.id);
|
||||||
parameters.codecs.push_back(rtx_codec2);
|
parameters.codecs.push_back(rtx_codec2);
|
||||||
|
@ -5182,7 +5180,7 @@ TEST_F(WebRtcVideoChannelTest, SetRecvCodecsWithRtx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WebRtcVideoChannelTest, SetRecvCodecsWithPacketization) {
|
TEST_F(WebRtcVideoChannelTest, SetRecvCodecsWithPacketization) {
|
||||||
cricket::VideoCodec vp8_codec = GetEngineCodec("VP8");
|
cricket::Codec vp8_codec = GetEngineCodec("VP8");
|
||||||
vp8_codec.packetization = kPacketizationParamRaw;
|
vp8_codec.packetization = kPacketizationParamRaw;
|
||||||
|
|
||||||
cricket::VideoReceiverParameters parameters;
|
cricket::VideoReceiverParameters parameters;
|
||||||
|
@ -5266,7 +5264,7 @@ TEST_F(WebRtcVideoChannelTest, SetRecvCodecsWithChangedRtxPayloadType) {
|
||||||
// Original payload type for RTX.
|
// Original payload type for RTX.
|
||||||
cricket::VideoReceiverParameters parameters;
|
cricket::VideoReceiverParameters parameters;
|
||||||
parameters.codecs.push_back(GetEngineCodec("VP8"));
|
parameters.codecs.push_back(GetEngineCodec("VP8"));
|
||||||
cricket::VideoCodec rtx_codec =
|
cricket::Codec rtx_codec =
|
||||||
cricket::CreateVideoCodec(kUnusedPayloadType1, "rtx");
|
cricket::CreateVideoCodec(kUnusedPayloadType1, "rtx");
|
||||||
rtx_codec.SetParam("apt", GetEngineCodec("VP8").id);
|
rtx_codec.SetParam("apt", GetEngineCodec("VP8").id);
|
||||||
parameters.codecs.push_back(rtx_codec);
|
parameters.codecs.push_back(rtx_codec);
|
||||||
|
@ -5310,7 +5308,7 @@ TEST_F(WebRtcVideoChannelTest, SetRecvCodecsRtxWithRtxTime) {
|
||||||
// Payload type for RTX.
|
// Payload type for RTX.
|
||||||
cricket::VideoReceiverParameters parameters;
|
cricket::VideoReceiverParameters parameters;
|
||||||
parameters.codecs.push_back(GetEngineCodec("VP8"));
|
parameters.codecs.push_back(GetEngineCodec("VP8"));
|
||||||
cricket::VideoCodec rtx_codec =
|
cricket::Codec rtx_codec =
|
||||||
cricket::CreateVideoCodec(kUnusedPayloadType1, "rtx");
|
cricket::CreateVideoCodec(kUnusedPayloadType1, "rtx");
|
||||||
rtx_codec.SetParam("apt", GetEngineCodec("VP8").id);
|
rtx_codec.SetParam("apt", GetEngineCodec("VP8").id);
|
||||||
parameters.codecs.push_back(rtx_codec);
|
parameters.codecs.push_back(rtx_codec);
|
||||||
|
@ -7376,8 +7374,8 @@ void WebRtcVideoChannelTest::TestReceiveUnsignaledSsrcPacket(
|
||||||
EXPECT_FALSE(FindCodecById(engine_.recv_codecs(), kRedRtxPayloadType));
|
EXPECT_FALSE(FindCodecById(engine_.recv_codecs(), kRedRtxPayloadType));
|
||||||
|
|
||||||
// Add a RED RTX codec.
|
// Add a RED RTX codec.
|
||||||
VideoCodec red_rtx_codec = cricket::CreateVideoRtxCodec(
|
Codec red_rtx_codec = cricket::CreateVideoRtxCodec(kRedRtxPayloadType,
|
||||||
kRedRtxPayloadType, GetEngineCodec("red").id);
|
GetEngineCodec("red").id);
|
||||||
recv_parameters_.codecs.push_back(red_rtx_codec);
|
recv_parameters_.codecs.push_back(red_rtx_codec);
|
||||||
EXPECT_TRUE(receive_channel_->SetReceiverParameters(recv_parameters_));
|
EXPECT_TRUE(receive_channel_->SetReceiverParameters(recv_parameters_));
|
||||||
|
|
||||||
|
@ -7422,7 +7420,7 @@ TEST_F(WebRtcVideoChannelTest, Vp9PacketCreatesUnsignalledStream) {
|
||||||
|
|
||||||
TEST_F(WebRtcVideoChannelTest, RtxPacketDoesntCreateUnsignalledStream) {
|
TEST_F(WebRtcVideoChannelTest, RtxPacketDoesntCreateUnsignalledStream) {
|
||||||
AssignDefaultAptRtxTypes();
|
AssignDefaultAptRtxTypes();
|
||||||
const cricket::VideoCodec vp8 = GetEngineCodec("VP8");
|
const cricket::Codec vp8 = GetEngineCodec("VP8");
|
||||||
const int rtx_vp8_payload_type = default_apt_rtx_types_[vp8.id];
|
const int rtx_vp8_payload_type = default_apt_rtx_types_[vp8.id];
|
||||||
TestReceiveUnsignaledSsrcPacket(rtx_vp8_payload_type,
|
TestReceiveUnsignaledSsrcPacket(rtx_vp8_payload_type,
|
||||||
false /* expect_created_receive_stream */);
|
false /* expect_created_receive_stream */);
|
||||||
|
@ -7446,7 +7444,7 @@ TEST_F(WebRtcVideoChannelTest, RedRtxPacketDoesntCreateUnsignalledStream) {
|
||||||
|
|
||||||
TEST_F(WebRtcVideoChannelTest, RtxAfterMediaPacketUpdatesUnsignalledRtxSsrc) {
|
TEST_F(WebRtcVideoChannelTest, RtxAfterMediaPacketUpdatesUnsignalledRtxSsrc) {
|
||||||
AssignDefaultAptRtxTypes();
|
AssignDefaultAptRtxTypes();
|
||||||
const cricket::VideoCodec vp8 = GetEngineCodec("VP8");
|
const cricket::Codec vp8 = GetEngineCodec("VP8");
|
||||||
const int payload_type = vp8.id;
|
const int payload_type = vp8.id;
|
||||||
const int rtx_vp8_payload_type = default_apt_rtx_types_[vp8.id];
|
const int rtx_vp8_payload_type = default_apt_rtx_types_[vp8.id];
|
||||||
const uint32_t ssrc = kIncomingUnsignalledSsrc;
|
const uint32_t ssrc = kIncomingUnsignalledSsrc;
|
||||||
|
@ -7481,7 +7479,7 @@ TEST_F(WebRtcVideoChannelTest, RtxAfterMediaPacketUpdatesUnsignalledRtxSsrc) {
|
||||||
|
|
||||||
TEST_F(WebRtcVideoChannelTest, UnsignaledStreamCreatedAfterMediaPacket) {
|
TEST_F(WebRtcVideoChannelTest, UnsignaledStreamCreatedAfterMediaPacket) {
|
||||||
AssignDefaultAptRtxTypes();
|
AssignDefaultAptRtxTypes();
|
||||||
const cricket::VideoCodec vp8 = GetEngineCodec("VP8");
|
const cricket::Codec vp8 = GetEngineCodec("VP8");
|
||||||
const int payload_type = vp8.id;
|
const int payload_type = vp8.id;
|
||||||
const int rtx_vp8_payload_type = default_apt_rtx_types_[vp8.id];
|
const int rtx_vp8_payload_type = default_apt_rtx_types_[vp8.id];
|
||||||
const uint32_t ssrc = kIncomingUnsignalledSsrc;
|
const uint32_t ssrc = kIncomingUnsignalledSsrc;
|
||||||
|
@ -7519,7 +7517,7 @@ TEST_F(WebRtcVideoChannelTest, ReceiveDifferentUnsignaledSsrc) {
|
||||||
parameters.codecs.push_back(GetEngineCodec("VP9"));
|
parameters.codecs.push_back(GetEngineCodec("VP9"));
|
||||||
|
|
||||||
#if defined(WEBRTC_USE_H264)
|
#if defined(WEBRTC_USE_H264)
|
||||||
cricket::VideoCodec H264codec = cricket::CreateVideoCodec(126, "H264");
|
cricket::Codec H264codec = cricket::CreateVideoCodec(126, "H264");
|
||||||
parameters.codecs.push_back(H264codec);
|
parameters.codecs.push_back(H264codec);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -9197,10 +9195,10 @@ TEST_F(WebRtcVideoChannelTest, GetRtpReceiveFmtpSprop) {
|
||||||
TEST_F(WebRtcVideoChannelTest, DISABLED_GetRtpReceiveFmtpSprop) {
|
TEST_F(WebRtcVideoChannelTest, DISABLED_GetRtpReceiveFmtpSprop) {
|
||||||
#endif
|
#endif
|
||||||
cricket::VideoReceiverParameters parameters;
|
cricket::VideoReceiverParameters parameters;
|
||||||
cricket::VideoCodec kH264sprop1 = cricket::CreateVideoCodec(101, "H264");
|
cricket::Codec kH264sprop1 = cricket::CreateVideoCodec(101, "H264");
|
||||||
kH264sprop1.SetParam(kH264FmtpSpropParameterSets, "uvw");
|
kH264sprop1.SetParam(kH264FmtpSpropParameterSets, "uvw");
|
||||||
parameters.codecs.push_back(kH264sprop1);
|
parameters.codecs.push_back(kH264sprop1);
|
||||||
cricket::VideoCodec kH264sprop2 = cricket::CreateVideoCodec(102, "H264");
|
cricket::Codec kH264sprop2 = cricket::CreateVideoCodec(102, "H264");
|
||||||
kH264sprop2.SetParam(kH264FmtpSpropParameterSets, "xyz");
|
kH264sprop2.SetParam(kH264FmtpSpropParameterSets, "xyz");
|
||||||
parameters.codecs.push_back(kH264sprop2);
|
parameters.codecs.push_back(kH264sprop2);
|
||||||
EXPECT_TRUE(receive_channel_->SetReceiverParameters(parameters));
|
EXPECT_TRUE(receive_channel_->SetReceiverParameters(parameters));
|
||||||
|
@ -9303,7 +9301,7 @@ TEST_F(WebRtcVideoChannelTest,
|
||||||
AddReceiveStreamAfterReceivingNonPrimaryUnsignaledSsrc) {
|
AddReceiveStreamAfterReceivingNonPrimaryUnsignaledSsrc) {
|
||||||
// Receive VP8 RTX packet.
|
// Receive VP8 RTX packet.
|
||||||
RtpPacketReceived rtp_packet;
|
RtpPacketReceived rtp_packet;
|
||||||
const cricket::VideoCodec vp8 = GetEngineCodec("VP8");
|
const cricket::Codec vp8 = GetEngineCodec("VP8");
|
||||||
rtp_packet.SetPayloadType(default_apt_rtx_types_[vp8.id]);
|
rtp_packet.SetPayloadType(default_apt_rtx_types_[vp8.id]);
|
||||||
rtp_packet.SetSsrc(2);
|
rtp_packet.SetSsrc(2);
|
||||||
ReceivePacketAndAdvanceTime(rtp_packet);
|
ReceivePacketAndAdvanceTime(rtp_packet);
|
||||||
|
@ -9515,7 +9513,7 @@ class WebRtcVideoChannelSimulcastTest : public ::testing::Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void VerifySimulcastSettings(const VideoCodec& codec,
|
void VerifySimulcastSettings(const Codec& codec,
|
||||||
int capture_width,
|
int capture_width,
|
||||||
int capture_height,
|
int capture_height,
|
||||||
size_t num_configured_streams,
|
size_t num_configured_streams,
|
||||||
|
@ -9753,7 +9751,7 @@ TEST_F(WebRtcVideoChannelTest, SetsRidsOnSendStream) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WebRtcVideoChannelBaseTest, EncoderSelectorSwitchCodec) {
|
TEST_F(WebRtcVideoChannelBaseTest, EncoderSelectorSwitchCodec) {
|
||||||
VideoCodec vp9 = GetEngineCodec("VP9");
|
Codec vp9 = GetEngineCodec("VP9");
|
||||||
|
|
||||||
cricket::VideoSenderParameters parameters;
|
cricket::VideoSenderParameters parameters;
|
||||||
parameters.codecs.push_back(GetEngineCodec("VP8"));
|
parameters.codecs.push_back(GetEngineCodec("VP8"));
|
||||||
|
@ -9761,7 +9759,7 @@ TEST_F(WebRtcVideoChannelBaseTest, EncoderSelectorSwitchCodec) {
|
||||||
EXPECT_TRUE(send_channel_->SetSenderParameters(parameters));
|
EXPECT_TRUE(send_channel_->SetSenderParameters(parameters));
|
||||||
send_channel_->SetSend(true);
|
send_channel_->SetSend(true);
|
||||||
|
|
||||||
absl::optional<VideoCodec> codec = send_channel_->GetSendCodec();
|
absl::optional<Codec> codec = send_channel_->GetSendCodec();
|
||||||
ASSERT_TRUE(codec);
|
ASSERT_TRUE(codec);
|
||||||
EXPECT_EQ("VP8", codec->name);
|
EXPECT_EQ("VP8", codec->name);
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ bool ValidateStreamParams(const StreamParams& sp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dumps an AudioCodec in RFC 2327-ish format.
|
// Dumps an AudioCodec in RFC 2327-ish format.
|
||||||
std::string ToString(const AudioCodec& codec) {
|
std::string ToString(const Codec& codec) {
|
||||||
rtc::StringBuilder ss;
|
rtc::StringBuilder ss;
|
||||||
ss << codec.name << "/" << codec.clockrate << "/" << codec.channels;
|
ss << codec.name << "/" << codec.clockrate << "/" << codec.channels;
|
||||||
if (!codec.params.empty()) {
|
if (!codec.params.empty()) {
|
||||||
|
@ -141,13 +141,13 @@ std::string ToString(const AudioCodec& codec) {
|
||||||
return ss.Release();
|
return ss.Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsCodec(const AudioCodec& codec, const char* ref_name) {
|
bool IsCodec(const Codec& codec, const char* ref_name) {
|
||||||
return absl::EqualsIgnoreCase(codec.name, ref_name);
|
return absl::EqualsIgnoreCase(codec.name, ref_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::optional<AudioCodec> FindCodec(const std::vector<AudioCodec>& codecs,
|
absl::optional<Codec> FindCodec(const std::vector<Codec>& codecs,
|
||||||
const AudioCodec& codec) {
|
const Codec& codec) {
|
||||||
for (const AudioCodec& c : codecs) {
|
for (const Codec& c : codecs) {
|
||||||
if (c.Matches(codec)) {
|
if (c.Matches(codec)) {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
@ -155,13 +155,13 @@ absl::optional<AudioCodec> FindCodec(const std::vector<AudioCodec>& codecs,
|
||||||
return absl::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VerifyUniquePayloadTypes(const std::vector<AudioCodec>& codecs) {
|
bool VerifyUniquePayloadTypes(const std::vector<Codec>& codecs) {
|
||||||
if (codecs.empty()) {
|
if (codecs.empty()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
std::vector<int> payload_types;
|
std::vector<int> payload_types;
|
||||||
absl::c_transform(codecs, std::back_inserter(payload_types),
|
absl::c_transform(codecs, std::back_inserter(payload_types),
|
||||||
[](const AudioCodec& codec) { return codec.id; });
|
[](const Codec& codec) { return codec.id; });
|
||||||
absl::c_sort(payload_types);
|
absl::c_sort(payload_types);
|
||||||
return absl::c_adjacent_find(payload_types) == payload_types.end();
|
return absl::c_adjacent_find(payload_types) == payload_types.end();
|
||||||
}
|
}
|
||||||
|
@ -302,7 +302,7 @@ webrtc::AudioReceiveStreamInterface::Config BuildReceiveStreamConfig(
|
||||||
|
|
||||||
// Utility function to check if RED codec and its parameters match a codec spec.
|
// Utility function to check if RED codec and its parameters match a codec spec.
|
||||||
bool CheckRedParameters(
|
bool CheckRedParameters(
|
||||||
const AudioCodec& red_codec,
|
const Codec& red_codec,
|
||||||
const webrtc::AudioSendStream::Config::SendCodecSpec& send_codec_spec) {
|
const webrtc::AudioSendStream::Config::SendCodecSpec& send_codec_spec) {
|
||||||
if (red_codec.clockrate != send_codec_spec.format.clockrate_hz ||
|
if (red_codec.clockrate != send_codec_spec.format.clockrate_hz ||
|
||||||
red_codec.channels != send_codec_spec.format.num_channels) {
|
red_codec.channels != send_codec_spec.format.num_channels) {
|
||||||
|
@ -383,13 +383,13 @@ void WebRtcVoiceEngine::Init() {
|
||||||
// Load our audio codec lists.
|
// Load our audio codec lists.
|
||||||
RTC_LOG(LS_VERBOSE) << "Supported send codecs in order of preference:";
|
RTC_LOG(LS_VERBOSE) << "Supported send codecs in order of preference:";
|
||||||
send_codecs_ = CollectCodecs(encoder_factory_->GetSupportedEncoders());
|
send_codecs_ = CollectCodecs(encoder_factory_->GetSupportedEncoders());
|
||||||
for (const AudioCodec& codec : send_codecs_) {
|
for (const Codec& codec : send_codecs_) {
|
||||||
RTC_LOG(LS_VERBOSE) << ToString(codec);
|
RTC_LOG(LS_VERBOSE) << ToString(codec);
|
||||||
}
|
}
|
||||||
|
|
||||||
RTC_LOG(LS_VERBOSE) << "Supported recv codecs in order of preference:";
|
RTC_LOG(LS_VERBOSE) << "Supported recv codecs in order of preference:";
|
||||||
recv_codecs_ = CollectCodecs(decoder_factory_->GetSupportedDecoders());
|
recv_codecs_ = CollectCodecs(decoder_factory_->GetSupportedDecoders());
|
||||||
for (const AudioCodec& codec : recv_codecs_) {
|
for (const Codec& codec : recv_codecs_) {
|
||||||
RTC_LOG(LS_VERBOSE) << ToString(codec);
|
RTC_LOG(LS_VERBOSE) << ToString(codec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -629,12 +629,12 @@ void WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
|
||||||
ap->ApplyConfig(apm_config);
|
ap->ApplyConfig(apm_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<AudioCodec>& WebRtcVoiceEngine::send_codecs() const {
|
const std::vector<Codec>& WebRtcVoiceEngine::send_codecs() const {
|
||||||
RTC_DCHECK(signal_thread_checker_.IsCurrent());
|
RTC_DCHECK(signal_thread_checker_.IsCurrent());
|
||||||
return send_codecs_;
|
return send_codecs_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<AudioCodec>& WebRtcVoiceEngine::recv_codecs() const {
|
const std::vector<Codec>& WebRtcVoiceEngine::recv_codecs() const {
|
||||||
RTC_DCHECK(signal_thread_checker_.IsCurrent());
|
RTC_DCHECK(signal_thread_checker_.IsCurrent());
|
||||||
return recv_codecs_;
|
return recv_codecs_;
|
||||||
}
|
}
|
||||||
|
@ -707,10 +707,10 @@ webrtc::AudioState* WebRtcVoiceEngine::audio_state() {
|
||||||
return audio_state_.get();
|
return audio_state_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<AudioCodec> WebRtcVoiceEngine::CollectCodecs(
|
std::vector<Codec> WebRtcVoiceEngine::CollectCodecs(
|
||||||
const std::vector<webrtc::AudioCodecSpec>& specs) const {
|
const std::vector<webrtc::AudioCodecSpec>& specs) const {
|
||||||
PayloadTypeMapper mapper;
|
PayloadTypeMapper mapper;
|
||||||
std::vector<AudioCodec> out;
|
std::vector<Codec> out;
|
||||||
|
|
||||||
// Only generate CN payload types for these clockrates:
|
// Only generate CN payload types for these clockrates:
|
||||||
std::map<int, bool, std::greater<int>> generate_cn = {
|
std::map<int, bool, std::greater<int>> generate_cn = {
|
||||||
|
@ -720,8 +720,8 @@ std::vector<AudioCodec> WebRtcVoiceEngine::CollectCodecs(
|
||||||
{8000, false}, {16000, false}, {32000, false}, {48000, false}};
|
{8000, false}, {16000, false}, {32000, false}, {48000, false}};
|
||||||
|
|
||||||
auto map_format = [&mapper](const webrtc::SdpAudioFormat& format,
|
auto map_format = [&mapper](const webrtc::SdpAudioFormat& format,
|
||||||
std::vector<AudioCodec>* out) {
|
std::vector<Codec>* out) {
|
||||||
absl::optional<AudioCodec> opt_codec = mapper.ToAudioCodec(format);
|
absl::optional<Codec> opt_codec = mapper.ToAudioCodec(format);
|
||||||
if (opt_codec) {
|
if (opt_codec) {
|
||||||
if (out) {
|
if (out) {
|
||||||
out->push_back(*opt_codec);
|
out->push_back(*opt_codec);
|
||||||
|
@ -736,9 +736,9 @@ std::vector<AudioCodec> WebRtcVoiceEngine::CollectCodecs(
|
||||||
|
|
||||||
for (const auto& spec : specs) {
|
for (const auto& spec : specs) {
|
||||||
// We need to do some extra stuff before adding the main codecs to out.
|
// We need to do some extra stuff before adding the main codecs to out.
|
||||||
absl::optional<AudioCodec> opt_codec = map_format(spec.format, nullptr);
|
absl::optional<Codec> opt_codec = map_format(spec.format, nullptr);
|
||||||
if (opt_codec) {
|
if (opt_codec) {
|
||||||
AudioCodec& codec = *opt_codec;
|
Codec& codec = *opt_codec;
|
||||||
if (spec.info.supports_network_adaption) {
|
if (spec.info.supports_network_adaption) {
|
||||||
codec.AddFeedbackParam(
|
codec.AddFeedbackParam(
|
||||||
FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty));
|
FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty));
|
||||||
|
@ -1772,7 +1772,7 @@ bool WebRtcVoiceSendChannel::GetStats(VoiceMediaSendInfo* info) {
|
||||||
void WebRtcVoiceSendChannel::FillSendCodecStats(
|
void WebRtcVoiceSendChannel::FillSendCodecStats(
|
||||||
VoiceMediaSendInfo* voice_media_info) {
|
VoiceMediaSendInfo* voice_media_info) {
|
||||||
for (const auto& sender : voice_media_info->senders) {
|
for (const auto& sender : voice_media_info->senders) {
|
||||||
auto codec = absl::c_find_if(send_codecs_, [&sender](const AudioCodec& c) {
|
auto codec = absl::c_find_if(send_codecs_, [&sender](const Codec& c) {
|
||||||
return sender.codec_payload_type && *sender.codec_payload_type == c.id;
|
return sender.codec_payload_type && *sender.codec_payload_type == c.id;
|
||||||
});
|
});
|
||||||
if (codec != send_codecs_.end()) {
|
if (codec != send_codecs_.end()) {
|
||||||
|
@ -1810,7 +1810,7 @@ webrtc::RtpParameters WebRtcVoiceSendChannel::GetRtpSendParameters(
|
||||||
webrtc::RtpParameters rtp_params = it->second->rtp_parameters();
|
webrtc::RtpParameters rtp_params = it->second->rtp_parameters();
|
||||||
// Need to add the common list of codecs to the send stream-specific
|
// Need to add the common list of codecs to the send stream-specific
|
||||||
// RTP parameters.
|
// RTP parameters.
|
||||||
for (const AudioCodec& codec : send_codecs_) {
|
for (const Codec& codec : send_codecs_) {
|
||||||
rtp_params.codecs.push_back(codec.ToCodecParameters());
|
rtp_params.codecs.push_back(codec.ToCodecParameters());
|
||||||
}
|
}
|
||||||
return rtp_params;
|
return rtp_params;
|
||||||
|
@ -2084,7 +2084,7 @@ webrtc::RtpParameters WebRtcVoiceReceiveChannel::GetRtpReceiverParameters(
|
||||||
rtp_params.encodings.back().ssrc = it->second->stream().remote_ssrc();
|
rtp_params.encodings.back().ssrc = it->second->stream().remote_ssrc();
|
||||||
rtp_params.header_extensions = recv_rtp_extensions_;
|
rtp_params.header_extensions = recv_rtp_extensions_;
|
||||||
|
|
||||||
for (const AudioCodec& codec : recv_codecs_) {
|
for (const Codec& codec : recv_codecs_) {
|
||||||
rtp_params.codecs.push_back(codec.ToCodecParameters());
|
rtp_params.codecs.push_back(codec.ToCodecParameters());
|
||||||
}
|
}
|
||||||
return rtp_params;
|
return rtp_params;
|
||||||
|
@ -2102,7 +2102,7 @@ WebRtcVoiceReceiveChannel::GetDefaultRtpReceiveParameters() const {
|
||||||
}
|
}
|
||||||
rtp_params.encodings.emplace_back();
|
rtp_params.encodings.emplace_back();
|
||||||
|
|
||||||
for (const AudioCodec& codec : recv_codecs_) {
|
for (const Codec& codec : recv_codecs_) {
|
||||||
rtp_params.codecs.push_back(codec.ToCodecParameters());
|
rtp_params.codecs.push_back(codec.ToCodecParameters());
|
||||||
}
|
}
|
||||||
return rtp_params;
|
return rtp_params;
|
||||||
|
@ -2124,7 +2124,7 @@ bool WebRtcVoiceReceiveChannel::SetOptions(const AudioOptions& options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebRtcVoiceReceiveChannel::SetRecvCodecs(
|
bool WebRtcVoiceReceiveChannel::SetRecvCodecs(
|
||||||
const std::vector<AudioCodec>& codecs) {
|
const std::vector<Codec>& codecs) {
|
||||||
RTC_DCHECK_RUN_ON(worker_thread_);
|
RTC_DCHECK_RUN_ON(worker_thread_);
|
||||||
|
|
||||||
// Set the payload types to be used for incoming media.
|
// Set the payload types to be used for incoming media.
|
||||||
|
@ -2138,10 +2138,10 @@ bool WebRtcVoiceReceiveChannel::SetRecvCodecs(
|
||||||
// Create a payload type -> SdpAudioFormat map with all the decoders. Fail
|
// Create a payload type -> SdpAudioFormat map with all the decoders. Fail
|
||||||
// unless the factory claims to support all decoders.
|
// unless the factory claims to support all decoders.
|
||||||
std::map<int, webrtc::SdpAudioFormat> decoder_map;
|
std::map<int, webrtc::SdpAudioFormat> decoder_map;
|
||||||
for (const AudioCodec& codec : codecs) {
|
for (const Codec& codec : codecs) {
|
||||||
// Log a warning if a codec's payload type is changing. This used to be
|
// Log a warning if a codec's payload type is changing. This used to be
|
||||||
// treated as an error. It's abnormal, but not really illegal.
|
// treated as an error. It's abnormal, but not really illegal.
|
||||||
absl::optional<AudioCodec> old_codec = FindCodec(recv_codecs_, codec);
|
absl::optional<Codec> old_codec = FindCodec(recv_codecs_, codec);
|
||||||
if (old_codec && old_codec->id != codec.id) {
|
if (old_codec && old_codec->id != codec.id) {
|
||||||
RTC_LOG(LS_WARNING) << codec.name << " mapped to a second payload type ("
|
RTC_LOG(LS_WARNING) << codec.name << " mapped to a second payload type ("
|
||||||
<< codec.id << ", was already mapped to "
|
<< codec.id << ", was already mapped to "
|
||||||
|
@ -2632,7 +2632,7 @@ void WebRtcVoiceReceiveChannel::FillReceiveCodecStats(
|
||||||
VoiceMediaReceiveInfo* voice_media_info) {
|
VoiceMediaReceiveInfo* voice_media_info) {
|
||||||
for (const auto& receiver : voice_media_info->receivers) {
|
for (const auto& receiver : voice_media_info->receivers) {
|
||||||
auto codec =
|
auto codec =
|
||||||
absl::c_find_if(recv_codecs_, [&receiver](const AudioCodec& c) {
|
absl::c_find_if(recv_codecs_, [&receiver](const Codec& c) {
|
||||||
return receiver.codec_payload_type &&
|
return receiver.codec_payload_type &&
|
||||||
*receiver.codec_payload_type == c.id;
|
*receiver.codec_payload_type == c.id;
|
||||||
});
|
});
|
||||||
|
|
|
@ -116,8 +116,8 @@ class WebRtcVoiceEngine final : public VoiceEngineInterface {
|
||||||
const webrtc::CryptoOptions& crypto_options,
|
const webrtc::CryptoOptions& crypto_options,
|
||||||
webrtc::AudioCodecPairId codec_pair_id) override;
|
webrtc::AudioCodecPairId codec_pair_id) override;
|
||||||
|
|
||||||
const std::vector<AudioCodec>& send_codecs() const override;
|
const std::vector<Codec>& send_codecs() const override;
|
||||||
const std::vector<AudioCodec>& recv_codecs() const override;
|
const std::vector<Codec>& recv_codecs() const override;
|
||||||
std::vector<webrtc::RtpHeaderExtensionCapability> GetRtpHeaderExtensions()
|
std::vector<webrtc::RtpHeaderExtensionCapability> GetRtpHeaderExtensions()
|
||||||
const override;
|
const override;
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ class WebRtcVoiceEngine final : public VoiceEngineInterface {
|
||||||
webrtc::AudioProcessing* apm() const;
|
webrtc::AudioProcessing* apm() const;
|
||||||
webrtc::AudioState* audio_state();
|
webrtc::AudioState* audio_state();
|
||||||
|
|
||||||
std::vector<AudioCodec> CollectCodecs(
|
std::vector<Codec> CollectCodecs(
|
||||||
const std::vector<webrtc::AudioCodecSpec>& specs) const;
|
const std::vector<webrtc::AudioCodecSpec>& specs) const;
|
||||||
|
|
||||||
webrtc::SequenceChecker signal_thread_checker_{
|
webrtc::SequenceChecker signal_thread_checker_{
|
||||||
|
@ -166,8 +166,8 @@ class WebRtcVoiceEngine final : public VoiceEngineInterface {
|
||||||
std::unique_ptr<webrtc::AudioFrameProcessor> audio_frame_processor_;
|
std::unique_ptr<webrtc::AudioFrameProcessor> audio_frame_processor_;
|
||||||
// The primary instance of WebRtc VoiceEngine.
|
// The primary instance of WebRtc VoiceEngine.
|
||||||
rtc::scoped_refptr<webrtc::AudioState> audio_state_;
|
rtc::scoped_refptr<webrtc::AudioState> audio_state_;
|
||||||
std::vector<AudioCodec> send_codecs_;
|
std::vector<Codec> send_codecs_;
|
||||||
std::vector<AudioCodec> recv_codecs_;
|
std::vector<Codec> recv_codecs_;
|
||||||
bool is_dumping_aec_ = false;
|
bool is_dumping_aec_ = false;
|
||||||
bool initialized_ = false;
|
bool initialized_ = false;
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ class WebRtcVoiceSendChannel final : public MediaChannelUtil,
|
||||||
webrtc::SequenceChecker::kDetached};
|
webrtc::SequenceChecker::kDetached};
|
||||||
|
|
||||||
WebRtcVoiceEngine* const engine_ = nullptr;
|
WebRtcVoiceEngine* const engine_ = nullptr;
|
||||||
std::vector<AudioCodec> send_codecs_;
|
std::vector<Codec> send_codecs_;
|
||||||
|
|
||||||
int max_send_bitrate_bps_ = 0;
|
int max_send_bitrate_bps_ = 0;
|
||||||
AudioOptions options_;
|
AudioOptions options_;
|
||||||
|
@ -428,7 +428,7 @@ class WebRtcVoiceReceiveChannel final
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool SetOptions(const AudioOptions& options);
|
bool SetOptions(const AudioOptions& options);
|
||||||
bool SetRecvCodecs(const std::vector<AudioCodec>& codecs);
|
bool SetRecvCodecs(const std::vector<Codec>& codecs);
|
||||||
bool SetLocalSource(uint32_t ssrc, AudioSource* source);
|
bool SetLocalSource(uint32_t ssrc, AudioSource* source);
|
||||||
bool MuteStream(uint32_t ssrc, bool mute);
|
bool MuteStream(uint32_t ssrc, bool mute);
|
||||||
|
|
||||||
|
@ -453,7 +453,7 @@ class WebRtcVoiceReceiveChannel final
|
||||||
// TODO(kwiberg): decoder_map_ and recv_codecs_ store the exact same
|
// TODO(kwiberg): decoder_map_ and recv_codecs_ store the exact same
|
||||||
// information, in slightly different formats. Eliminate recv_codecs_.
|
// information, in slightly different formats. Eliminate recv_codecs_.
|
||||||
std::map<int, webrtc::SdpAudioFormat> decoder_map_;
|
std::map<int, webrtc::SdpAudioFormat> decoder_map_;
|
||||||
std::vector<AudioCodec> recv_codecs_;
|
std::vector<Codec> recv_codecs_;
|
||||||
|
|
||||||
AudioOptions options_;
|
AudioOptions options_;
|
||||||
bool recv_nack_enabled_ = false;
|
bool recv_nack_enabled_ = false;
|
||||||
|
|
|
@ -65,23 +65,22 @@ using ::webrtc::Environment;
|
||||||
|
|
||||||
constexpr uint32_t kMaxUnsignaledRecvStreams = 4;
|
constexpr uint32_t kMaxUnsignaledRecvStreams = 4;
|
||||||
|
|
||||||
const cricket::AudioCodec kPcmuCodec =
|
const cricket::Codec kPcmuCodec = cricket::CreateAudioCodec(0, "PCMU", 8000, 1);
|
||||||
cricket::CreateAudioCodec(0, "PCMU", 8000, 1);
|
const cricket::Codec kOpusCodec =
|
||||||
const cricket::AudioCodec kOpusCodec =
|
|
||||||
cricket::CreateAudioCodec(111, "opus", 48000, 2);
|
cricket::CreateAudioCodec(111, "opus", 48000, 2);
|
||||||
const cricket::AudioCodec kG722CodecVoE =
|
const cricket::Codec kG722CodecVoE =
|
||||||
cricket::CreateAudioCodec(9, "G722", 16000, 1);
|
cricket::CreateAudioCodec(9, "G722", 16000, 1);
|
||||||
const cricket::AudioCodec kG722CodecSdp =
|
const cricket::Codec kG722CodecSdp =
|
||||||
cricket::CreateAudioCodec(9, "G722", 8000, 1);
|
cricket::CreateAudioCodec(9, "G722", 8000, 1);
|
||||||
const cricket::AudioCodec kCn8000Codec =
|
const cricket::Codec kCn8000Codec =
|
||||||
cricket::CreateAudioCodec(13, "CN", 8000, 1);
|
cricket::CreateAudioCodec(13, "CN", 8000, 1);
|
||||||
const cricket::AudioCodec kCn16000Codec =
|
const cricket::Codec kCn16000Codec =
|
||||||
cricket::CreateAudioCodec(105, "CN", 16000, 1);
|
cricket::CreateAudioCodec(105, "CN", 16000, 1);
|
||||||
const cricket::AudioCodec kRed48000Codec =
|
const cricket::Codec kRed48000Codec =
|
||||||
cricket::CreateAudioCodec(112, "RED", 48000, 2);
|
cricket::CreateAudioCodec(112, "RED", 48000, 2);
|
||||||
const cricket::AudioCodec kTelephoneEventCodec1 =
|
const cricket::Codec kTelephoneEventCodec1 =
|
||||||
cricket::CreateAudioCodec(106, "telephone-event", 8000, 1);
|
cricket::CreateAudioCodec(106, "telephone-event", 8000, 1);
|
||||||
const cricket::AudioCodec kTelephoneEventCodec2 =
|
const cricket::Codec kTelephoneEventCodec2 =
|
||||||
cricket::CreateAudioCodec(107, "telephone-event", 32000, 1);
|
cricket::CreateAudioCodec(107, "telephone-event", 32000, 1);
|
||||||
|
|
||||||
const uint32_t kSsrc0 = 0;
|
const uint32_t kSsrc0 = 0;
|
||||||
|
@ -360,9 +359,7 @@ class WebRtcVoiceEngineTestFake : public ::testing::TestWithParam<bool> {
|
||||||
EXPECT_TRUE(send_channel_->SetAudioSend(ssrc, enable, options, source));
|
EXPECT_TRUE(send_channel_->SetAudioSend(ssrc, enable, options, source));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestInsertDtmf(uint32_t ssrc,
|
void TestInsertDtmf(uint32_t ssrc, bool caller, const cricket::Codec& codec) {
|
||||||
bool caller,
|
|
||||||
const cricket::AudioCodec& codec) {
|
|
||||||
EXPECT_TRUE(SetupChannel());
|
EXPECT_TRUE(SetupChannel());
|
||||||
if (caller) {
|
if (caller) {
|
||||||
// If this is a caller, local description will be applied and add the
|
// If this is a caller, local description will be applied and add the
|
||||||
|
@ -431,7 +428,7 @@ class WebRtcVoiceEngineTestFake : public ::testing::TestWithParam<bool> {
|
||||||
// `max_bitrate` is a parameter to set to SetMaxSendBandwidth().
|
// `max_bitrate` is a parameter to set to SetMaxSendBandwidth().
|
||||||
// `expected_result` is the expected result from SetMaxSendBandwidth().
|
// `expected_result` is the expected result from SetMaxSendBandwidth().
|
||||||
// `expected_bitrate` is the expected audio bitrate afterward.
|
// `expected_bitrate` is the expected audio bitrate afterward.
|
||||||
void TestMaxSendBandwidth(const cricket::AudioCodec& codec,
|
void TestMaxSendBandwidth(const cricket::Codec& codec,
|
||||||
int max_bitrate,
|
int max_bitrate,
|
||||||
bool expected_result,
|
bool expected_result,
|
||||||
int expected_bitrate) {
|
int expected_bitrate) {
|
||||||
|
@ -456,7 +453,7 @@ class WebRtcVoiceEngineTestFake : public ::testing::TestWithParam<bool> {
|
||||||
return send_channel_->SetRtpSendParameters(ssrc, parameters).ok();
|
return send_channel_->SetRtpSendParameters(ssrc, parameters).ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetGlobalMaxBitrate(const cricket::AudioCodec& codec, int bitrate) {
|
void SetGlobalMaxBitrate(const cricket::Codec& codec, int bitrate) {
|
||||||
cricket::AudioSenderParameter send_parameters;
|
cricket::AudioSenderParameter send_parameters;
|
||||||
send_parameters.codecs.push_back(codec);
|
send_parameters.codecs.push_back(codec);
|
||||||
send_parameters.max_bandwidth_bps = bitrate;
|
send_parameters.max_bandwidth_bps = bitrate;
|
||||||
|
@ -484,7 +481,7 @@ class WebRtcVoiceEngineTestFake : public ::testing::TestWithParam<bool> {
|
||||||
return GetSendStreamConfig(ssrc).audio_network_adaptor_config;
|
return GetSendStreamConfig(ssrc).audio_network_adaptor_config;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetAndExpectMaxBitrate(const cricket::AudioCodec& codec,
|
void SetAndExpectMaxBitrate(const cricket::Codec& codec,
|
||||||
int global_max,
|
int global_max,
|
||||||
int stream_max,
|
int stream_max,
|
||||||
bool expected_result,
|
bool expected_result,
|
||||||
|
@ -789,14 +786,14 @@ class WebRtcVoiceEngineTestFake : public ::testing::TestWithParam<bool> {
|
||||||
const cricket::VoiceMediaSendInfo& send_info,
|
const cricket::VoiceMediaSendInfo& send_info,
|
||||||
const cricket::VoiceMediaReceiveInfo& receive_info) const {
|
const cricket::VoiceMediaReceiveInfo& receive_info) const {
|
||||||
EXPECT_EQ(send_parameters_.codecs.size(), send_info.send_codecs.size());
|
EXPECT_EQ(send_parameters_.codecs.size(), send_info.send_codecs.size());
|
||||||
for (const cricket::AudioCodec& codec : send_parameters_.codecs) {
|
for (const cricket::Codec& codec : send_parameters_.codecs) {
|
||||||
ASSERT_EQ(send_info.send_codecs.count(codec.id), 1U);
|
ASSERT_EQ(send_info.send_codecs.count(codec.id), 1U);
|
||||||
EXPECT_EQ(send_info.send_codecs.find(codec.id)->second,
|
EXPECT_EQ(send_info.send_codecs.find(codec.id)->second,
|
||||||
codec.ToCodecParameters());
|
codec.ToCodecParameters());
|
||||||
}
|
}
|
||||||
EXPECT_EQ(recv_parameters_.codecs.size(),
|
EXPECT_EQ(recv_parameters_.codecs.size(),
|
||||||
receive_info.receive_codecs.size());
|
receive_info.receive_codecs.size());
|
||||||
for (const cricket::AudioCodec& codec : recv_parameters_.codecs) {
|
for (const cricket::Codec& codec : recv_parameters_.codecs) {
|
||||||
ASSERT_EQ(receive_info.receive_codecs.count(codec.id), 1U);
|
ASSERT_EQ(receive_info.receive_codecs.count(codec.id), 1U);
|
||||||
EXPECT_EQ(receive_info.receive_codecs.find(codec.id)->second,
|
EXPECT_EQ(receive_info.receive_codecs.find(codec.id)->second,
|
||||||
codec.ToCodecParameters());
|
codec.ToCodecParameters());
|
||||||
|
@ -893,9 +890,9 @@ TEST_P(WebRtcVoiceEngineTestFake, CreateRecvStream) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(WebRtcVoiceEngineTestFake, OpusSupportsTransportCc) {
|
TEST_P(WebRtcVoiceEngineTestFake, OpusSupportsTransportCc) {
|
||||||
const std::vector<cricket::AudioCodec>& codecs = engine_->send_codecs();
|
const std::vector<cricket::Codec>& codecs = engine_->send_codecs();
|
||||||
bool opus_found = false;
|
bool opus_found = false;
|
||||||
for (const cricket::AudioCodec& codec : codecs) {
|
for (const cricket::Codec& codec : codecs) {
|
||||||
if (codec.name == "opus") {
|
if (codec.name == "opus") {
|
||||||
EXPECT_TRUE(HasTransportCc(codec));
|
EXPECT_TRUE(HasTransportCc(codec));
|
||||||
opus_found = true;
|
opus_found = true;
|
||||||
|
@ -3764,7 +3761,7 @@ TEST(WebRtcVoiceEngineTest, HasCorrectPayloadTypeMapping) {
|
||||||
webrtc::MockAudioDecoderFactory::CreateUnusedFactory(), nullptr, apm,
|
webrtc::MockAudioDecoderFactory::CreateUnusedFactory(), nullptr, apm,
|
||||||
nullptr, field_trials);
|
nullptr, field_trials);
|
||||||
engine.Init();
|
engine.Init();
|
||||||
for (const cricket::AudioCodec& codec : engine.send_codecs()) {
|
for (const cricket::Codec& codec : engine.send_codecs()) {
|
||||||
auto is_codec = [&codec](const char* name, int clockrate = 0) {
|
auto is_codec = [&codec](const char* name, int clockrate = 0) {
|
||||||
return absl::EqualsIgnoreCase(codec.name, name) &&
|
return absl::EqualsIgnoreCase(codec.name, name) &&
|
||||||
(clockrate == 0 || codec.clockrate == clockrate);
|
(clockrate == 0 || codec.clockrate == clockrate);
|
||||||
|
@ -3952,8 +3949,8 @@ TEST(WebRtcVoiceEngineTest, CollectRecvCodecs) {
|
||||||
|
|
||||||
// Rather than just ASSERTing that there are enough codecs, ensure that we
|
// Rather than just ASSERTing that there are enough codecs, ensure that we
|
||||||
// can check the actual values safely, to provide better test results.
|
// can check the actual values safely, to provide better test results.
|
||||||
auto get_codec = [&codecs](size_t index) -> const cricket::AudioCodec& {
|
auto get_codec = [&codecs](size_t index) -> const cricket::Codec& {
|
||||||
static const cricket::AudioCodec missing_codec =
|
static const cricket::Codec missing_codec =
|
||||||
cricket::CreateAudioCodec(0, "<missing>", 0, 0);
|
cricket::CreateAudioCodec(0, "<missing>", 0, 0);
|
||||||
if (codecs.size() > index)
|
if (codecs.size() > index)
|
||||||
return codecs[index];
|
return codecs[index];
|
||||||
|
@ -3972,7 +3969,7 @@ TEST(WebRtcVoiceEngineTest, CollectRecvCodecs) {
|
||||||
// check supplementary codecs are ordered after the general codecs.
|
// check supplementary codecs are ordered after the general codecs.
|
||||||
auto find_codec = [&codecs](const webrtc::SdpAudioFormat& format) -> int {
|
auto find_codec = [&codecs](const webrtc::SdpAudioFormat& format) -> int {
|
||||||
for (size_t i = 0; i != codecs.size(); ++i) {
|
for (size_t i = 0; i != codecs.size(); ++i) {
|
||||||
const cricket::AudioCodec& codec = codecs[i];
|
const cricket::Codec& codec = codecs[i];
|
||||||
if (absl::EqualsIgnoreCase(codec.name, format.name) &&
|
if (absl::EqualsIgnoreCase(codec.name, format.name) &&
|
||||||
codec.clockrate == format.clockrate_hz &&
|
codec.clockrate == format.clockrate_hz &&
|
||||||
codec.channels == format.num_channels) {
|
codec.channels == format.num_channels) {
|
||||||
|
|
|
@ -1029,15 +1029,15 @@ bool VideoChannel::SetLocalContent_w(const MediaContentDescription* content,
|
||||||
// instead.
|
// instead.
|
||||||
bool needs_send_params_update = false;
|
bool needs_send_params_update = false;
|
||||||
if (type == SdpType::kAnswer || type == SdpType::kPrAnswer) {
|
if (type == SdpType::kAnswer || type == SdpType::kPrAnswer) {
|
||||||
webrtc::flat_set<const VideoCodec*> matched_codecs;
|
webrtc::flat_set<const Codec*> matched_codecs;
|
||||||
for (VideoCodec& send_codec : send_params.codecs) {
|
for (Codec& send_codec : send_params.codecs) {
|
||||||
if (absl::c_any_of(matched_codecs, [&](const VideoCodec* c) {
|
if (absl::c_any_of(matched_codecs, [&](const Codec* c) {
|
||||||
return send_codec.Matches(*c);
|
return send_codec.Matches(*c);
|
||||||
})) {
|
})) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<const VideoCodec*> recv_codecs =
|
std::vector<const Codec*> recv_codecs =
|
||||||
FindAllMatchingCodecs(recv_params.codecs, send_codec);
|
FindAllMatchingCodecs(recv_params.codecs, send_codec);
|
||||||
if (recv_codecs.empty()) {
|
if (recv_codecs.empty()) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -1045,7 +1045,7 @@ bool VideoChannel::SetLocalContent_w(const MediaContentDescription* content,
|
||||||
|
|
||||||
bool may_ignore_packetization = false;
|
bool may_ignore_packetization = false;
|
||||||
bool has_matching_packetization = false;
|
bool has_matching_packetization = false;
|
||||||
for (const VideoCodec* recv_codec : recv_codecs) {
|
for (const Codec* recv_codec : recv_codecs) {
|
||||||
if (!recv_codec->packetization.has_value() &&
|
if (!recv_codec->packetization.has_value() &&
|
||||||
send_codec.packetization.has_value()) {
|
send_codec.packetization.has_value()) {
|
||||||
may_ignore_packetization = true;
|
may_ignore_packetization = true;
|
||||||
|
|
|
@ -2098,8 +2098,8 @@ TEST_F(VideoChannelSingleThreadTest, UpdateLocalStreamsWithSimulcast) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(VideoChannelSingleThreadTest, TestSetLocalOfferWithPacketization) {
|
TEST_F(VideoChannelSingleThreadTest, TestSetLocalOfferWithPacketization) {
|
||||||
const cricket::VideoCodec kVp8Codec = cricket::CreateVideoCodec(97, "VP8");
|
const cricket::Codec kVp8Codec = cricket::CreateVideoCodec(97, "VP8");
|
||||||
cricket::VideoCodec vp9_codec = cricket::CreateVideoCodec(98, "VP9");
|
cricket::Codec vp9_codec = cricket::CreateVideoCodec(98, "VP9");
|
||||||
vp9_codec.packetization = cricket::kPacketizationParamRaw;
|
vp9_codec.packetization = cricket::kPacketizationParamRaw;
|
||||||
cricket::VideoContentDescription video;
|
cricket::VideoContentDescription video;
|
||||||
video.set_codecs({kVp8Codec, vp9_codec});
|
video.set_codecs({kVp8Codec, vp9_codec});
|
||||||
|
@ -2121,8 +2121,8 @@ TEST_F(VideoChannelSingleThreadTest, TestSetLocalOfferWithPacketization) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(VideoChannelSingleThreadTest, TestSetRemoteOfferWithPacketization) {
|
TEST_F(VideoChannelSingleThreadTest, TestSetRemoteOfferWithPacketization) {
|
||||||
const cricket::VideoCodec kVp8Codec = cricket::CreateVideoCodec(97, "VP8");
|
const cricket::Codec kVp8Codec = cricket::CreateVideoCodec(97, "VP8");
|
||||||
cricket::VideoCodec vp9_codec = cricket::CreateVideoCodec(98, "VP9");
|
cricket::Codec vp9_codec = cricket::CreateVideoCodec(98, "VP9");
|
||||||
vp9_codec.packetization = cricket::kPacketizationParamRaw;
|
vp9_codec.packetization = cricket::kPacketizationParamRaw;
|
||||||
cricket::VideoContentDescription video;
|
cricket::VideoContentDescription video;
|
||||||
video.set_codecs({kVp8Codec, vp9_codec});
|
video.set_codecs({kVp8Codec, vp9_codec});
|
||||||
|
@ -2143,8 +2143,8 @@ TEST_F(VideoChannelSingleThreadTest, TestSetRemoteOfferWithPacketization) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(VideoChannelSingleThreadTest, TestSetAnswerWithPacketization) {
|
TEST_F(VideoChannelSingleThreadTest, TestSetAnswerWithPacketization) {
|
||||||
const cricket::VideoCodec kVp8Codec = cricket::CreateVideoCodec(97, "VP8");
|
const cricket::Codec kVp8Codec = cricket::CreateVideoCodec(97, "VP8");
|
||||||
cricket::VideoCodec vp9_codec = cricket::CreateVideoCodec(98, "VP9");
|
cricket::Codec vp9_codec = cricket::CreateVideoCodec(98, "VP9");
|
||||||
vp9_codec.packetization = cricket::kPacketizationParamRaw;
|
vp9_codec.packetization = cricket::kPacketizationParamRaw;
|
||||||
cricket::VideoContentDescription video;
|
cricket::VideoContentDescription video;
|
||||||
video.set_codecs({kVp8Codec, vp9_codec});
|
video.set_codecs({kVp8Codec, vp9_codec});
|
||||||
|
@ -2175,8 +2175,8 @@ TEST_F(VideoChannelSingleThreadTest, TestSetAnswerWithPacketization) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(VideoChannelSingleThreadTest, TestSetLocalAnswerWithoutPacketization) {
|
TEST_F(VideoChannelSingleThreadTest, TestSetLocalAnswerWithoutPacketization) {
|
||||||
const cricket::VideoCodec kLocalCodec = cricket::CreateVideoCodec(98, "VP8");
|
const cricket::Codec kLocalCodec = cricket::CreateVideoCodec(98, "VP8");
|
||||||
cricket::VideoCodec remote_codec = cricket::CreateVideoCodec(99, "VP8");
|
cricket::Codec remote_codec = cricket::CreateVideoCodec(99, "VP8");
|
||||||
remote_codec.packetization = cricket::kPacketizationParamRaw;
|
remote_codec.packetization = cricket::kPacketizationParamRaw;
|
||||||
cricket::VideoContentDescription local_video;
|
cricket::VideoContentDescription local_video;
|
||||||
local_video.set_codecs({kLocalCodec});
|
local_video.set_codecs({kLocalCodec});
|
||||||
|
@ -2197,9 +2197,9 @@ TEST_F(VideoChannelSingleThreadTest, TestSetLocalAnswerWithoutPacketization) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(VideoChannelSingleThreadTest, TestSetRemoteAnswerWithoutPacketization) {
|
TEST_F(VideoChannelSingleThreadTest, TestSetRemoteAnswerWithoutPacketization) {
|
||||||
cricket::VideoCodec local_codec = cricket::CreateVideoCodec(98, "VP8");
|
cricket::Codec local_codec = cricket::CreateVideoCodec(98, "VP8");
|
||||||
local_codec.packetization = cricket::kPacketizationParamRaw;
|
local_codec.packetization = cricket::kPacketizationParamRaw;
|
||||||
const cricket::VideoCodec kRemoteCodec = cricket::CreateVideoCodec(99, "VP8");
|
const cricket::Codec kRemoteCodec = cricket::CreateVideoCodec(99, "VP8");
|
||||||
cricket::VideoContentDescription local_video;
|
cricket::VideoContentDescription local_video;
|
||||||
local_video.set_codecs({local_codec});
|
local_video.set_codecs({local_codec});
|
||||||
cricket::VideoContentDescription remote_video;
|
cricket::VideoContentDescription remote_video;
|
||||||
|
@ -2221,9 +2221,9 @@ TEST_F(VideoChannelSingleThreadTest, TestSetRemoteAnswerWithoutPacketization) {
|
||||||
|
|
||||||
TEST_F(VideoChannelSingleThreadTest,
|
TEST_F(VideoChannelSingleThreadTest,
|
||||||
TestSetRemoteAnswerWithInvalidPacketization) {
|
TestSetRemoteAnswerWithInvalidPacketization) {
|
||||||
cricket::VideoCodec local_codec = cricket::CreateVideoCodec(98, "VP8");
|
cricket::Codec local_codec = cricket::CreateVideoCodec(98, "VP8");
|
||||||
local_codec.packetization = cricket::kPacketizationParamRaw;
|
local_codec.packetization = cricket::kPacketizationParamRaw;
|
||||||
cricket::VideoCodec remote_codec = cricket::CreateVideoCodec(99, "VP8");
|
cricket::Codec remote_codec = cricket::CreateVideoCodec(99, "VP8");
|
||||||
remote_codec.packetization = "unknownpacketizationattributevalue";
|
remote_codec.packetization = "unknownpacketizationattributevalue";
|
||||||
cricket::VideoContentDescription local_video;
|
cricket::VideoContentDescription local_video;
|
||||||
local_video.set_codecs({local_codec});
|
local_video.set_codecs({local_codec});
|
||||||
|
@ -2246,9 +2246,9 @@ TEST_F(VideoChannelSingleThreadTest,
|
||||||
|
|
||||||
TEST_F(VideoChannelSingleThreadTest,
|
TEST_F(VideoChannelSingleThreadTest,
|
||||||
TestSetLocalAnswerWithInvalidPacketization) {
|
TestSetLocalAnswerWithInvalidPacketization) {
|
||||||
cricket::VideoCodec local_codec = cricket::CreateVideoCodec(98, "VP8");
|
cricket::Codec local_codec = cricket::CreateVideoCodec(98, "VP8");
|
||||||
local_codec.packetization = cricket::kPacketizationParamRaw;
|
local_codec.packetization = cricket::kPacketizationParamRaw;
|
||||||
const cricket::VideoCodec kRemoteCodec = cricket::CreateVideoCodec(99, "VP8");
|
const cricket::Codec kRemoteCodec = cricket::CreateVideoCodec(99, "VP8");
|
||||||
cricket::VideoContentDescription local_video;
|
cricket::VideoContentDescription local_video;
|
||||||
local_video.set_codecs({local_codec});
|
local_video.set_codecs({local_codec});
|
||||||
cricket::VideoContentDescription remote_video;
|
cricket::VideoContentDescription remote_video;
|
||||||
|
@ -2269,12 +2269,12 @@ TEST_F(VideoChannelSingleThreadTest,
|
||||||
|
|
||||||
TEST_F(VideoChannelSingleThreadTest,
|
TEST_F(VideoChannelSingleThreadTest,
|
||||||
StopsPacketizationVerificationWhenMatchIsFoundInRemoteAnswer) {
|
StopsPacketizationVerificationWhenMatchIsFoundInRemoteAnswer) {
|
||||||
cricket::VideoCodec vp8_foo = cricket::CreateVideoCodec(96, "VP8");
|
cricket::Codec vp8_foo = cricket::CreateVideoCodec(96, "VP8");
|
||||||
vp8_foo.packetization = "foo";
|
vp8_foo.packetization = "foo";
|
||||||
cricket::VideoCodec vp8_bar = cricket::CreateVideoCodec(97, "VP8");
|
cricket::Codec vp8_bar = cricket::CreateVideoCodec(97, "VP8");
|
||||||
vp8_bar.packetization = "bar";
|
vp8_bar.packetization = "bar";
|
||||||
cricket::VideoCodec vp9 = cricket::CreateVideoCodec(98, "VP9");
|
cricket::Codec vp9 = cricket::CreateVideoCodec(98, "VP9");
|
||||||
cricket::VideoCodec vp9_foo = cricket::CreateVideoCodec(99, "VP9");
|
cricket::Codec vp9_foo = cricket::CreateVideoCodec(99, "VP9");
|
||||||
vp9_foo.packetization = "bar";
|
vp9_foo.packetization = "bar";
|
||||||
cricket::VideoContentDescription local;
|
cricket::VideoContentDescription local;
|
||||||
local.set_codecs({vp8_foo, vp8_bar, vp9_foo});
|
local.set_codecs({vp8_foo, vp8_bar, vp9_foo});
|
||||||
|
@ -2305,12 +2305,12 @@ TEST_F(VideoChannelSingleThreadTest,
|
||||||
|
|
||||||
TEST_F(VideoChannelSingleThreadTest,
|
TEST_F(VideoChannelSingleThreadTest,
|
||||||
StopsPacketizationVerificationWhenMatchIsFoundInLocalAnswer) {
|
StopsPacketizationVerificationWhenMatchIsFoundInLocalAnswer) {
|
||||||
cricket::VideoCodec vp8_foo = cricket::CreateVideoCodec(96, "VP8");
|
cricket::Codec vp8_foo = cricket::CreateVideoCodec(96, "VP8");
|
||||||
vp8_foo.packetization = "foo";
|
vp8_foo.packetization = "foo";
|
||||||
cricket::VideoCodec vp8_bar = cricket::CreateVideoCodec(97, "VP8");
|
cricket::Codec vp8_bar = cricket::CreateVideoCodec(97, "VP8");
|
||||||
vp8_bar.packetization = "bar";
|
vp8_bar.packetization = "bar";
|
||||||
cricket::VideoCodec vp9 = cricket::CreateVideoCodec(98, "VP9");
|
cricket::Codec vp9 = cricket::CreateVideoCodec(98, "VP9");
|
||||||
cricket::VideoCodec vp9_foo = cricket::CreateVideoCodec(99, "VP9");
|
cricket::Codec vp9_foo = cricket::CreateVideoCodec(99, "VP9");
|
||||||
vp9_foo.packetization = "bar";
|
vp9_foo.packetization = "bar";
|
||||||
cricket::VideoContentDescription local;
|
cricket::VideoContentDescription local;
|
||||||
local.set_codecs({vp8_foo, vp9});
|
local.set_codecs({vp8_foo, vp9});
|
||||||
|
@ -2341,8 +2341,8 @@ TEST_F(VideoChannelSingleThreadTest,
|
||||||
|
|
||||||
TEST_F(VideoChannelSingleThreadTest,
|
TEST_F(VideoChannelSingleThreadTest,
|
||||||
ConsidersAllCodecsWithDiffrentPacketizationsInRemoteAnswer) {
|
ConsidersAllCodecsWithDiffrentPacketizationsInRemoteAnswer) {
|
||||||
cricket::VideoCodec vp8 = cricket::CreateVideoCodec(96, "VP8");
|
cricket::Codec vp8 = cricket::CreateVideoCodec(96, "VP8");
|
||||||
cricket::VideoCodec vp8_raw = cricket::CreateVideoCodec(97, "VP8");
|
cricket::Codec vp8_raw = cricket::CreateVideoCodec(97, "VP8");
|
||||||
vp8_raw.packetization = cricket::kPacketizationParamRaw;
|
vp8_raw.packetization = cricket::kPacketizationParamRaw;
|
||||||
cricket::VideoContentDescription local;
|
cricket::VideoContentDescription local;
|
||||||
local.set_codecs({vp8, vp8_raw});
|
local.set_codecs({vp8, vp8_raw});
|
||||||
|
@ -2373,8 +2373,8 @@ TEST_F(VideoChannelSingleThreadTest,
|
||||||
|
|
||||||
TEST_F(VideoChannelSingleThreadTest,
|
TEST_F(VideoChannelSingleThreadTest,
|
||||||
ConsidersAllCodecsWithDiffrentPacketizationsInLocalAnswer) {
|
ConsidersAllCodecsWithDiffrentPacketizationsInLocalAnswer) {
|
||||||
cricket::VideoCodec vp8 = cricket::CreateVideoCodec(96, "VP8");
|
cricket::Codec vp8 = cricket::CreateVideoCodec(96, "VP8");
|
||||||
cricket::VideoCodec vp8_raw = cricket::CreateVideoCodec(97, "VP8");
|
cricket::Codec vp8_raw = cricket::CreateVideoCodec(97, "VP8");
|
||||||
vp8_raw.packetization = cricket::kPacketizationParamRaw;
|
vp8_raw.packetization = cricket::kPacketizationParamRaw;
|
||||||
cricket::VideoContentDescription local;
|
cricket::VideoContentDescription local;
|
||||||
local.set_codecs({vp8_raw, vp8});
|
local.set_codecs({vp8_raw, vp8});
|
||||||
|
|
|
@ -127,9 +127,9 @@ bool IsComfortNoiseCodec(const Codec& codec) {
|
||||||
return absl::EqualsIgnoreCase(codec.name, kComfortNoiseCodecName);
|
return absl::EqualsIgnoreCase(codec.name, kComfortNoiseCodecName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StripCNCodecs(AudioCodecs* audio_codecs) {
|
void StripCNCodecs(Codecs* audio_codecs) {
|
||||||
audio_codecs->erase(std::remove_if(audio_codecs->begin(), audio_codecs->end(),
|
audio_codecs->erase(std::remove_if(audio_codecs->begin(), audio_codecs->end(),
|
||||||
[](const AudioCodec& codec) {
|
[](const Codec& codec) {
|
||||||
return IsComfortNoiseCodec(codec);
|
return IsComfortNoiseCodec(codec);
|
||||||
}),
|
}),
|
||||||
audio_codecs->end());
|
audio_codecs->end());
|
||||||
|
@ -1160,7 +1160,7 @@ const TransportDescription* GetTransportDescription(
|
||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
webrtc::RTCErrorOr<AudioCodecs> GetNegotiatedCodecsForOffer(
|
webrtc::RTCErrorOr<Codecs> GetNegotiatedCodecsForOffer(
|
||||||
const MediaDescriptionOptions& media_description_options,
|
const MediaDescriptionOptions& media_description_options,
|
||||||
const MediaSessionOptions& session_options,
|
const MediaSessionOptions& session_options,
|
||||||
const ContentInfo* current_content,
|
const ContentInfo* current_content,
|
||||||
|
@ -1237,7 +1237,7 @@ webrtc::RTCErrorOr<AudioCodecs> GetNegotiatedCodecsForOffer(
|
||||||
return filtered_codecs;
|
return filtered_codecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
webrtc::RTCErrorOr<AudioCodecs> GetNegotiatedCodecsForAnswer(
|
webrtc::RTCErrorOr<Codecs> GetNegotiatedCodecsForAnswer(
|
||||||
const MediaDescriptionOptions& media_description_options,
|
const MediaDescriptionOptions& media_description_options,
|
||||||
const MediaSessionOptions& session_options,
|
const MediaSessionOptions& session_options,
|
||||||
const ContentInfo* current_content,
|
const ContentInfo* current_content,
|
||||||
|
@ -1363,43 +1363,41 @@ MediaSessionDescriptionFactory::MediaSessionDescriptionFactory(
|
||||||
ComputeVideoCodecsIntersectionAndUnion();
|
ComputeVideoCodecsIntersectionAndUnion();
|
||||||
}
|
}
|
||||||
|
|
||||||
const AudioCodecs& MediaSessionDescriptionFactory::audio_sendrecv_codecs()
|
const Codecs& MediaSessionDescriptionFactory::audio_sendrecv_codecs() const {
|
||||||
const {
|
|
||||||
return audio_sendrecv_codecs_;
|
return audio_sendrecv_codecs_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const AudioCodecs& MediaSessionDescriptionFactory::audio_send_codecs() const {
|
const Codecs& MediaSessionDescriptionFactory::audio_send_codecs() const {
|
||||||
return audio_send_codecs_;
|
return audio_send_codecs_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const AudioCodecs& MediaSessionDescriptionFactory::audio_recv_codecs() const {
|
const Codecs& MediaSessionDescriptionFactory::audio_recv_codecs() const {
|
||||||
return audio_recv_codecs_;
|
return audio_recv_codecs_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaSessionDescriptionFactory::set_audio_codecs(
|
void MediaSessionDescriptionFactory::set_audio_codecs(
|
||||||
const AudioCodecs& send_codecs,
|
const Codecs& send_codecs,
|
||||||
const AudioCodecs& recv_codecs) {
|
const Codecs& recv_codecs) {
|
||||||
audio_send_codecs_ = send_codecs;
|
audio_send_codecs_ = send_codecs;
|
||||||
audio_recv_codecs_ = recv_codecs;
|
audio_recv_codecs_ = recv_codecs;
|
||||||
ComputeAudioCodecsIntersectionAndUnion();
|
ComputeAudioCodecsIntersectionAndUnion();
|
||||||
}
|
}
|
||||||
|
|
||||||
const VideoCodecs& MediaSessionDescriptionFactory::video_sendrecv_codecs()
|
const Codecs& MediaSessionDescriptionFactory::video_sendrecv_codecs() const {
|
||||||
const {
|
|
||||||
return video_sendrecv_codecs_;
|
return video_sendrecv_codecs_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const VideoCodecs& MediaSessionDescriptionFactory::video_send_codecs() const {
|
const Codecs& MediaSessionDescriptionFactory::video_send_codecs() const {
|
||||||
return video_send_codecs_;
|
return video_send_codecs_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const VideoCodecs& MediaSessionDescriptionFactory::video_recv_codecs() const {
|
const Codecs& MediaSessionDescriptionFactory::video_recv_codecs() const {
|
||||||
return video_recv_codecs_;
|
return video_recv_codecs_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaSessionDescriptionFactory::set_video_codecs(
|
void MediaSessionDescriptionFactory::set_video_codecs(
|
||||||
const VideoCodecs& send_codecs,
|
const Codecs& send_codecs,
|
||||||
const VideoCodecs& recv_codecs) {
|
const Codecs& recv_codecs) {
|
||||||
video_send_codecs_ = send_codecs;
|
video_send_codecs_ = send_codecs;
|
||||||
video_recv_codecs_ = recv_codecs;
|
video_recv_codecs_ = recv_codecs;
|
||||||
ComputeVideoCodecsIntersectionAndUnion();
|
ComputeVideoCodecsIntersectionAndUnion();
|
||||||
|
@ -1445,8 +1443,8 @@ MediaSessionDescriptionFactory::CreateOfferOrError(
|
||||||
StreamParamsVec current_streams =
|
StreamParamsVec current_streams =
|
||||||
GetCurrentStreamParams(current_active_contents);
|
GetCurrentStreamParams(current_active_contents);
|
||||||
|
|
||||||
AudioCodecs offer_audio_codecs;
|
Codecs offer_audio_codecs;
|
||||||
VideoCodecs offer_video_codecs;
|
Codecs offer_video_codecs;
|
||||||
GetCodecsForOffer(current_active_contents, &offer_audio_codecs,
|
GetCodecsForOffer(current_active_contents, &offer_audio_codecs,
|
||||||
&offer_video_codecs);
|
&offer_video_codecs);
|
||||||
AudioVideoRtpHeaderExtensions extensions_with_ids =
|
AudioVideoRtpHeaderExtensions extensions_with_ids =
|
||||||
|
@ -1578,8 +1576,8 @@ MediaSessionDescriptionFactory::CreateAnswerOrError(
|
||||||
// Note that these lists may be further filtered for each m= section; this
|
// Note that these lists may be further filtered for each m= section; this
|
||||||
// step is done just to establish the payload type mappings shared by all
|
// step is done just to establish the payload type mappings shared by all
|
||||||
// sections.
|
// sections.
|
||||||
AudioCodecs answer_audio_codecs;
|
Codecs answer_audio_codecs;
|
||||||
VideoCodecs answer_video_codecs;
|
Codecs answer_video_codecs;
|
||||||
GetCodecsForAnswer(current_active_contents, *offer, &answer_audio_codecs,
|
GetCodecsForAnswer(current_active_contents, *offer, &answer_audio_codecs,
|
||||||
&answer_video_codecs);
|
&answer_video_codecs);
|
||||||
|
|
||||||
|
@ -1742,7 +1740,7 @@ MediaSessionDescriptionFactory::CreateAnswerOrError(
|
||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
const AudioCodecs& MediaSessionDescriptionFactory::GetAudioCodecsForOffer(
|
const Codecs& MediaSessionDescriptionFactory::GetAudioCodecsForOffer(
|
||||||
const RtpTransceiverDirection& direction) const {
|
const RtpTransceiverDirection& direction) const {
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
// If stream is inactive - generate list as if sendrecv.
|
// If stream is inactive - generate list as if sendrecv.
|
||||||
|
@ -1758,7 +1756,7 @@ const AudioCodecs& MediaSessionDescriptionFactory::GetAudioCodecsForOffer(
|
||||||
RTC_CHECK_NOTREACHED();
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
const AudioCodecs& MediaSessionDescriptionFactory::GetAudioCodecsForAnswer(
|
const Codecs& MediaSessionDescriptionFactory::GetAudioCodecsForAnswer(
|
||||||
const RtpTransceiverDirection& offer,
|
const RtpTransceiverDirection& offer,
|
||||||
const RtpTransceiverDirection& answer) const {
|
const RtpTransceiverDirection& answer) const {
|
||||||
switch (answer) {
|
switch (answer) {
|
||||||
|
@ -1777,7 +1775,7 @@ const AudioCodecs& MediaSessionDescriptionFactory::GetAudioCodecsForAnswer(
|
||||||
RTC_CHECK_NOTREACHED();
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
const VideoCodecs& MediaSessionDescriptionFactory::GetVideoCodecsForOffer(
|
const Codecs& MediaSessionDescriptionFactory::GetVideoCodecsForOffer(
|
||||||
const RtpTransceiverDirection& direction) const {
|
const RtpTransceiverDirection& direction) const {
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
// If stream is inactive - generate list as if sendrecv.
|
// If stream is inactive - generate list as if sendrecv.
|
||||||
|
@ -1793,7 +1791,7 @@ const VideoCodecs& MediaSessionDescriptionFactory::GetVideoCodecsForOffer(
|
||||||
RTC_CHECK_NOTREACHED();
|
RTC_CHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
const VideoCodecs& MediaSessionDescriptionFactory::GetVideoCodecsForAnswer(
|
const Codecs& MediaSessionDescriptionFactory::GetVideoCodecsForAnswer(
|
||||||
const RtpTransceiverDirection& offer,
|
const RtpTransceiverDirection& offer,
|
||||||
const RtpTransceiverDirection& answer) const {
|
const RtpTransceiverDirection& answer) const {
|
||||||
switch (answer) {
|
switch (answer) {
|
||||||
|
@ -1814,8 +1812,8 @@ const VideoCodecs& MediaSessionDescriptionFactory::GetVideoCodecsForAnswer(
|
||||||
|
|
||||||
void MergeCodecsFromDescription(
|
void MergeCodecsFromDescription(
|
||||||
const std::vector<const ContentInfo*>& current_active_contents,
|
const std::vector<const ContentInfo*>& current_active_contents,
|
||||||
AudioCodecs* audio_codecs,
|
Codecs* audio_codecs,
|
||||||
VideoCodecs* video_codecs,
|
Codecs* video_codecs,
|
||||||
UsedPayloadTypes* used_pltypes) {
|
UsedPayloadTypes* used_pltypes) {
|
||||||
for (const ContentInfo* content : current_active_contents) {
|
for (const ContentInfo* content : current_active_contents) {
|
||||||
if (IsMediaContentOfType(content, MEDIA_TYPE_AUDIO)) {
|
if (IsMediaContentOfType(content, MEDIA_TYPE_AUDIO)) {
|
||||||
|
@ -1836,8 +1834,8 @@ void MergeCodecsFromDescription(
|
||||||
// on the directional attribute (happens in another method).
|
// on the directional attribute (happens in another method).
|
||||||
void MediaSessionDescriptionFactory::GetCodecsForOffer(
|
void MediaSessionDescriptionFactory::GetCodecsForOffer(
|
||||||
const std::vector<const ContentInfo*>& current_active_contents,
|
const std::vector<const ContentInfo*>& current_active_contents,
|
||||||
AudioCodecs* audio_codecs,
|
Codecs* audio_codecs,
|
||||||
VideoCodecs* video_codecs) const {
|
Codecs* video_codecs) const {
|
||||||
// First - get all codecs from the current description if the media type
|
// First - get all codecs from the current description if the media type
|
||||||
// is used. Add them to `used_pltypes` so the payload type is not reused if a
|
// is used. Add them to `used_pltypes` so the payload type is not reused if a
|
||||||
// new media type is added.
|
// new media type is added.
|
||||||
|
@ -1860,8 +1858,8 @@ void MediaSessionDescriptionFactory::GetCodecsForOffer(
|
||||||
void MediaSessionDescriptionFactory::GetCodecsForAnswer(
|
void MediaSessionDescriptionFactory::GetCodecsForAnswer(
|
||||||
const std::vector<const ContentInfo*>& current_active_contents,
|
const std::vector<const ContentInfo*>& current_active_contents,
|
||||||
const SessionDescription& remote_offer,
|
const SessionDescription& remote_offer,
|
||||||
AudioCodecs* audio_codecs,
|
Codecs* audio_codecs,
|
||||||
VideoCodecs* video_codecs) const {
|
Codecs* video_codecs) const {
|
||||||
// First - get all codecs from the current description if the media type
|
// First - get all codecs from the current description if the media type
|
||||||
// is used. Add them to `used_pltypes` so the payload type is not reused if a
|
// is used. Add them to `used_pltypes` so the payload type is not reused if a
|
||||||
// new media type is added.
|
// new media type is added.
|
||||||
|
@ -1870,8 +1868,8 @@ void MediaSessionDescriptionFactory::GetCodecsForAnswer(
|
||||||
video_codecs, &used_pltypes);
|
video_codecs, &used_pltypes);
|
||||||
|
|
||||||
// Second - filter out codecs that we don't support at all and should ignore.
|
// Second - filter out codecs that we don't support at all and should ignore.
|
||||||
AudioCodecs filtered_offered_audio_codecs;
|
Codecs filtered_offered_audio_codecs;
|
||||||
VideoCodecs filtered_offered_video_codecs;
|
Codecs filtered_offered_video_codecs;
|
||||||
for (const ContentInfo& content : remote_offer.contents()) {
|
for (const ContentInfo& content : remote_offer.contents()) {
|
||||||
if (IsMediaContentOfType(&content, MEDIA_TYPE_AUDIO)) {
|
if (IsMediaContentOfType(&content, MEDIA_TYPE_AUDIO)) {
|
||||||
std::vector<Codec> offered_codecs = content.media_description()->codecs();
|
std::vector<Codec> offered_codecs = content.media_description()->codecs();
|
||||||
|
|
|
@ -148,16 +148,14 @@ class MediaSessionDescriptionFactory {
|
||||||
rtc::UniqueRandomIdGenerator* ssrc_generator,
|
rtc::UniqueRandomIdGenerator* ssrc_generator,
|
||||||
const TransportDescriptionFactory* factory);
|
const TransportDescriptionFactory* factory);
|
||||||
|
|
||||||
const AudioCodecs& audio_sendrecv_codecs() const;
|
const Codecs& audio_sendrecv_codecs() const;
|
||||||
const AudioCodecs& audio_send_codecs() const;
|
const Codecs& audio_send_codecs() const;
|
||||||
const AudioCodecs& audio_recv_codecs() const;
|
const Codecs& audio_recv_codecs() const;
|
||||||
void set_audio_codecs(const AudioCodecs& send_codecs,
|
void set_audio_codecs(const Codecs& send_codecs, const Codecs& recv_codecs);
|
||||||
const AudioCodecs& recv_codecs);
|
const Codecs& video_sendrecv_codecs() const;
|
||||||
const VideoCodecs& video_sendrecv_codecs() const;
|
const Codecs& video_send_codecs() const;
|
||||||
const VideoCodecs& video_send_codecs() const;
|
const Codecs& video_recv_codecs() const;
|
||||||
const VideoCodecs& video_recv_codecs() const;
|
void set_video_codecs(const Codecs& send_codecs, const Codecs& recv_codecs);
|
||||||
void set_video_codecs(const VideoCodecs& send_codecs,
|
|
||||||
const VideoCodecs& recv_codecs);
|
|
||||||
RtpHeaderExtensions filtered_rtp_header_extensions(
|
RtpHeaderExtensions filtered_rtp_header_extensions(
|
||||||
RtpHeaderExtensions extensions) const;
|
RtpHeaderExtensions extensions) const;
|
||||||
|
|
||||||
|
@ -183,25 +181,25 @@ class MediaSessionDescriptionFactory {
|
||||||
RtpHeaderExtensions video;
|
RtpHeaderExtensions video;
|
||||||
};
|
};
|
||||||
|
|
||||||
const AudioCodecs& GetAudioCodecsForOffer(
|
const Codecs& GetAudioCodecsForOffer(
|
||||||
const webrtc::RtpTransceiverDirection& direction) const;
|
const webrtc::RtpTransceiverDirection& direction) const;
|
||||||
const AudioCodecs& GetAudioCodecsForAnswer(
|
const Codecs& GetAudioCodecsForAnswer(
|
||||||
const webrtc::RtpTransceiverDirection& offer,
|
const webrtc::RtpTransceiverDirection& offer,
|
||||||
const webrtc::RtpTransceiverDirection& answer) const;
|
const webrtc::RtpTransceiverDirection& answer) const;
|
||||||
const VideoCodecs& GetVideoCodecsForOffer(
|
const Codecs& GetVideoCodecsForOffer(
|
||||||
const webrtc::RtpTransceiverDirection& direction) const;
|
const webrtc::RtpTransceiverDirection& direction) const;
|
||||||
const VideoCodecs& GetVideoCodecsForAnswer(
|
const Codecs& GetVideoCodecsForAnswer(
|
||||||
const webrtc::RtpTransceiverDirection& offer,
|
const webrtc::RtpTransceiverDirection& offer,
|
||||||
const webrtc::RtpTransceiverDirection& answer) const;
|
const webrtc::RtpTransceiverDirection& answer) const;
|
||||||
void GetCodecsForOffer(
|
void GetCodecsForOffer(
|
||||||
const std::vector<const ContentInfo*>& current_active_contents,
|
const std::vector<const ContentInfo*>& current_active_contents,
|
||||||
AudioCodecs* audio_codecs,
|
Codecs* audio_codecs,
|
||||||
VideoCodecs* video_codecs) const;
|
Codecs* video_codecs) const;
|
||||||
void GetCodecsForAnswer(
|
void GetCodecsForAnswer(
|
||||||
const std::vector<const ContentInfo*>& current_active_contents,
|
const std::vector<const ContentInfo*>& current_active_contents,
|
||||||
const SessionDescription& remote_offer,
|
const SessionDescription& remote_offer,
|
||||||
AudioCodecs* audio_codecs,
|
Codecs* audio_codecs,
|
||||||
VideoCodecs* video_codecs) const;
|
Codecs* video_codecs) const;
|
||||||
AudioVideoRtpHeaderExtensions GetOfferedRtpHeaderExtensionsWithIds(
|
AudioVideoRtpHeaderExtensions GetOfferedRtpHeaderExtensionsWithIds(
|
||||||
const std::vector<const ContentInfo*>& current_active_contents,
|
const std::vector<const ContentInfo*>& current_active_contents,
|
||||||
bool extmap_allow_mixed,
|
bool extmap_allow_mixed,
|
||||||
|
@ -302,18 +300,18 @@ class MediaSessionDescriptionFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_unified_plan_ = false;
|
bool is_unified_plan_ = false;
|
||||||
AudioCodecs audio_send_codecs_;
|
Codecs audio_send_codecs_;
|
||||||
AudioCodecs audio_recv_codecs_;
|
Codecs audio_recv_codecs_;
|
||||||
// Intersection of send and recv.
|
// Intersection of send and recv.
|
||||||
AudioCodecs audio_sendrecv_codecs_;
|
Codecs audio_sendrecv_codecs_;
|
||||||
// Union of send and recv.
|
// Union of send and recv.
|
||||||
AudioCodecs all_audio_codecs_;
|
Codecs all_audio_codecs_;
|
||||||
VideoCodecs video_send_codecs_;
|
Codecs video_send_codecs_;
|
||||||
VideoCodecs video_recv_codecs_;
|
Codecs video_recv_codecs_;
|
||||||
// Intersection of send and recv.
|
// Intersection of send and recv.
|
||||||
VideoCodecs video_sendrecv_codecs_;
|
Codecs video_sendrecv_codecs_;
|
||||||
// Union of send and recv.
|
// Union of send and recv.
|
||||||
VideoCodecs all_video_codecs_;
|
Codecs all_video_codecs_;
|
||||||
// This object may or may not be owned by this class.
|
// This object may or may not be owned by this class.
|
||||||
webrtc::AlwaysValidPointer<rtc::UniqueRandomIdGenerator> const
|
webrtc::AlwaysValidPointer<rtc::UniqueRandomIdGenerator> const
|
||||||
ssrc_generator_;
|
ssrc_generator_;
|
||||||
|
|
|
@ -78,14 +78,14 @@ using ::webrtc::RtpTransceiverDirection;
|
||||||
|
|
||||||
using Candidates = std::vector<Candidate>;
|
using Candidates = std::vector<Candidate>;
|
||||||
|
|
||||||
AudioCodec CreateRedAudioCodec(absl::string_view encoding_id) {
|
Codec CreateRedAudioCodec(absl::string_view encoding_id) {
|
||||||
AudioCodec red = CreateAudioCodec(63, "red", 48000, 2);
|
Codec red = CreateAudioCodec(63, "red", 48000, 2);
|
||||||
red.SetParam(kCodecParamNotInNameValueFormat,
|
red.SetParam(kCodecParamNotInNameValueFormat,
|
||||||
std::string(encoding_id) + '/' + std::string(encoding_id));
|
std::string(encoding_id) + '/' + std::string(encoding_id));
|
||||||
return red;
|
return red;
|
||||||
}
|
}
|
||||||
|
|
||||||
const AudioCodec kAudioCodecs1[] = {CreateAudioCodec(111, "opus", 48000, 2),
|
const Codec kAudioCodecs1[] = {CreateAudioCodec(111, "opus", 48000, 2),
|
||||||
CreateRedAudioCodec("111"),
|
CreateRedAudioCodec("111"),
|
||||||
CreateAudioCodec(102, "iLBC", 8000, 1),
|
CreateAudioCodec(102, "iLBC", 8000, 1),
|
||||||
CreateAudioCodec(0, "PCMU", 8000, 1),
|
CreateAudioCodec(0, "PCMU", 8000, 1),
|
||||||
|
@ -93,27 +93,27 @@ const AudioCodec kAudioCodecs1[] = {CreateAudioCodec(111, "opus", 48000, 2),
|
||||||
CreateAudioCodec(117, "red", 8000, 1),
|
CreateAudioCodec(117, "red", 8000, 1),
|
||||||
CreateAudioCodec(107, "CN", 48000, 1)};
|
CreateAudioCodec(107, "CN", 48000, 1)};
|
||||||
|
|
||||||
const AudioCodec kAudioCodecs2[] = {
|
const Codec kAudioCodecs2[] = {
|
||||||
CreateAudioCodec(126, "foo", 16000, 1),
|
CreateAudioCodec(126, "foo", 16000, 1),
|
||||||
CreateAudioCodec(0, "PCMU", 8000, 1),
|
CreateAudioCodec(0, "PCMU", 8000, 1),
|
||||||
CreateAudioCodec(127, "iLBC", 8000, 1),
|
CreateAudioCodec(127, "iLBC", 8000, 1),
|
||||||
};
|
};
|
||||||
|
|
||||||
const AudioCodec kAudioCodecsAnswer[] = {
|
const Codec kAudioCodecsAnswer[] = {
|
||||||
CreateAudioCodec(102, "iLBC", 8000, 1),
|
CreateAudioCodec(102, "iLBC", 8000, 1),
|
||||||
CreateAudioCodec(0, "PCMU", 8000, 1),
|
CreateAudioCodec(0, "PCMU", 8000, 1),
|
||||||
};
|
};
|
||||||
|
|
||||||
const VideoCodec kVideoCodecs1[] = {CreateVideoCodec(96, "H264-SVC"),
|
const Codec kVideoCodecs1[] = {CreateVideoCodec(96, "H264-SVC"),
|
||||||
CreateVideoCodec(97, "H264")};
|
CreateVideoCodec(97, "H264")};
|
||||||
|
|
||||||
const VideoCodec kVideoCodecs1Reverse[] = {CreateVideoCodec(97, "H264"),
|
const Codec kVideoCodecs1Reverse[] = {CreateVideoCodec(97, "H264"),
|
||||||
CreateVideoCodec(96, "H264-SVC")};
|
CreateVideoCodec(96, "H264-SVC")};
|
||||||
|
|
||||||
const VideoCodec kVideoCodecs2[] = {CreateVideoCodec(126, "H264"),
|
const Codec kVideoCodecs2[] = {CreateVideoCodec(126, "H264"),
|
||||||
CreateVideoCodec(127, "H263")};
|
CreateVideoCodec(127, "H263")};
|
||||||
|
|
||||||
const VideoCodec kVideoCodecsAnswer[] = {CreateVideoCodec(97, "H264")};
|
const Codec kVideoCodecsAnswer[] = {CreateVideoCodec(97, "H264")};
|
||||||
|
|
||||||
const RtpExtension kAudioRtpExtension1[] = {
|
const RtpExtension kAudioRtpExtension1[] = {
|
||||||
RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8),
|
RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8),
|
||||||
|
@ -264,7 +264,7 @@ RtpTransceiverDirection GetMediaDirection(const ContentInfo* content) {
|
||||||
return content->media_description()->direction();
|
return content->media_description()->direction();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddRtxCodec(const VideoCodec& rtx_codec, std::vector<VideoCodec>* codecs) {
|
void AddRtxCodec(const Codec& rtx_codec, std::vector<Codec>* codecs) {
|
||||||
ASSERT_FALSE(FindCodecById(*codecs, rtx_codec.id));
|
ASSERT_FALSE(FindCodecById(*codecs, rtx_codec.id));
|
||||||
codecs->push_back(rtx_codec);
|
codecs->push_back(rtx_codec);
|
||||||
}
|
}
|
||||||
|
@ -744,8 +744,8 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateVideoOffer) {
|
||||||
// RTP playlod type. The test verifies that the offer don't contain the
|
// RTP playlod type. The test verifies that the offer don't contain the
|
||||||
// duplicate RTP payload types.
|
// duplicate RTP payload types.
|
||||||
TEST_F(MediaSessionDescriptionFactoryTest, TestBundleOfferWithSameCodecPlType) {
|
TEST_F(MediaSessionDescriptionFactoryTest, TestBundleOfferWithSameCodecPlType) {
|
||||||
const VideoCodec& offered_video_codec = f2_.video_sendrecv_codecs()[0];
|
const Codec& offered_video_codec = f2_.video_sendrecv_codecs()[0];
|
||||||
const AudioCodec& offered_audio_codec = f2_.audio_sendrecv_codecs()[0];
|
const Codec& offered_audio_codec = f2_.audio_sendrecv_codecs()[0];
|
||||||
ASSERT_EQ(offered_video_codec.id, offered_audio_codec.id);
|
ASSERT_EQ(offered_video_codec.id, offered_audio_codec.id);
|
||||||
|
|
||||||
MediaSessionOptions opts;
|
MediaSessionOptions opts;
|
||||||
|
@ -2705,7 +2705,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
|
||||||
// preference order.
|
// preference order.
|
||||||
// TODO(wu): `updated_offer` should not include the codec
|
// TODO(wu): `updated_offer` should not include the codec
|
||||||
// (i.e. `kAudioCodecs2[0]`) the other side doesn't support.
|
// (i.e. `kAudioCodecs2[0]`) the other side doesn't support.
|
||||||
const AudioCodec kUpdatedAudioCodecOffer[] = {
|
const Codec kUpdatedAudioCodecOffer[] = {
|
||||||
kAudioCodecsAnswer[0],
|
kAudioCodecsAnswer[0],
|
||||||
kAudioCodecsAnswer[1],
|
kAudioCodecsAnswer[1],
|
||||||
kAudioCodecs2[0],
|
kAudioCodecs2[0],
|
||||||
|
@ -2714,7 +2714,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
|
||||||
// The expected video codecs are the common video codecs from the first
|
// The expected video codecs are the common video codecs from the first
|
||||||
// offer/answer exchange plus the video codecs only `f2_` offer, sorted in
|
// offer/answer exchange plus the video codecs only `f2_` offer, sorted in
|
||||||
// preference order.
|
// preference order.
|
||||||
const VideoCodec kUpdatedVideoCodecOffer[] = {
|
const Codec kUpdatedVideoCodecOffer[] = {
|
||||||
kVideoCodecsAnswer[0],
|
kVideoCodecsAnswer[0],
|
||||||
kVideoCodecs2[1],
|
kVideoCodecs2[1],
|
||||||
};
|
};
|
||||||
|
@ -2856,12 +2856,12 @@ TEST_F(MediaSessionDescriptionFactoryTest,
|
||||||
AddMediaDescriptionOptions(MEDIA_TYPE_VIDEO, "video",
|
AddMediaDescriptionOptions(MEDIA_TYPE_VIDEO, "video",
|
||||||
RtpTransceiverDirection::kRecvOnly, kActive,
|
RtpTransceiverDirection::kRecvOnly, kActive,
|
||||||
&opts);
|
&opts);
|
||||||
std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
|
std::vector<Codec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
|
||||||
// This creates rtx for H264 with the payload type `f1_` uses.
|
// This creates rtx for H264 with the payload type `f1_` uses.
|
||||||
AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs);
|
AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs);
|
||||||
f1_.set_video_codecs(f1_codecs, f1_codecs);
|
f1_.set_video_codecs(f1_codecs, f1_codecs);
|
||||||
|
|
||||||
std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
|
std::vector<Codec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
|
||||||
// This creates rtx for H264 with the payload type `f2_` uses.
|
// This creates rtx for H264 with the payload type `f2_` uses.
|
||||||
AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs2[0].id), &f2_codecs);
|
AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs2[0].id), &f2_codecs);
|
||||||
f2_.set_video_codecs(f2_codecs, f2_codecs);
|
f2_.set_video_codecs(f2_codecs, f2_codecs);
|
||||||
|
@ -2875,7 +2875,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
|
||||||
const VideoContentDescription* vcd =
|
const VideoContentDescription* vcd =
|
||||||
GetFirstVideoContentDescription(answer.get());
|
GetFirstVideoContentDescription(answer.get());
|
||||||
|
|
||||||
std::vector<VideoCodec> expected_codecs = MAKE_VECTOR(kVideoCodecsAnswer);
|
std::vector<Codec> expected_codecs = MAKE_VECTOR(kVideoCodecsAnswer);
|
||||||
AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &expected_codecs);
|
AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &expected_codecs);
|
||||||
|
|
||||||
EXPECT_EQ(expected_codecs, vcd->codecs());
|
EXPECT_EQ(expected_codecs, vcd->codecs());
|
||||||
|
@ -2909,22 +2909,21 @@ TEST_F(MediaSessionDescriptionFactoryTest,
|
||||||
&opts);
|
&opts);
|
||||||
// We specifically choose different preferred payload types for VP8 to
|
// We specifically choose different preferred payload types for VP8 to
|
||||||
// trigger the issue.
|
// trigger the issue.
|
||||||
VideoCodec vp8_offerer = CreateVideoCodec(100, "VP8");
|
Codec vp8_offerer = CreateVideoCodec(100, "VP8");
|
||||||
VideoCodec vp8_offerer_rtx = CreateVideoRtxCodec(101, vp8_offerer.id);
|
Codec vp8_offerer_rtx = CreateVideoRtxCodec(101, vp8_offerer.id);
|
||||||
VideoCodec vp8_answerer = CreateVideoCodec(110, "VP8");
|
Codec vp8_answerer = CreateVideoCodec(110, "VP8");
|
||||||
VideoCodec vp8_answerer_rtx = CreateVideoRtxCodec(111, vp8_answerer.id);
|
Codec vp8_answerer_rtx = CreateVideoRtxCodec(111, vp8_answerer.id);
|
||||||
VideoCodec vp9 = CreateVideoCodec(120, "VP9");
|
Codec vp9 = CreateVideoCodec(120, "VP9");
|
||||||
VideoCodec vp9_rtx = CreateVideoRtxCodec(121, vp9.id);
|
Codec vp9_rtx = CreateVideoRtxCodec(121, vp9.id);
|
||||||
|
|
||||||
std::vector<VideoCodec> f1_codecs = {vp8_offerer, vp8_offerer_rtx};
|
std::vector<Codec> f1_codecs = {vp8_offerer, vp8_offerer_rtx};
|
||||||
// We also specifically cause the answerer to prefer VP9, such that if it
|
// We also specifically cause the answerer to prefer VP9, such that if it
|
||||||
// *doesn't* honor the existing preferred codec (VP8) we'll notice.
|
// *doesn't* honor the existing preferred codec (VP8) we'll notice.
|
||||||
std::vector<VideoCodec> f2_codecs = {vp9, vp9_rtx, vp8_answerer,
|
std::vector<Codec> f2_codecs = {vp9, vp9_rtx, vp8_answerer, vp8_answerer_rtx};
|
||||||
vp8_answerer_rtx};
|
|
||||||
|
|
||||||
f1_.set_video_codecs(f1_codecs, f1_codecs);
|
f1_.set_video_codecs(f1_codecs, f1_codecs);
|
||||||
f2_.set_video_codecs(f2_codecs, f2_codecs);
|
f2_.set_video_codecs(f2_codecs, f2_codecs);
|
||||||
std::vector<AudioCodec> audio_codecs;
|
std::vector<Codec> audio_codecs;
|
||||||
f1_.set_audio_codecs(audio_codecs, audio_codecs);
|
f1_.set_audio_codecs(audio_codecs, audio_codecs);
|
||||||
f2_.set_audio_codecs(audio_codecs, audio_codecs);
|
f2_.set_audio_codecs(audio_codecs, audio_codecs);
|
||||||
|
|
||||||
|
@ -2942,7 +2941,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
|
||||||
|
|
||||||
const VideoContentDescription* vcd =
|
const VideoContentDescription* vcd =
|
||||||
GetFirstVideoContentDescription(updated_offer.get());
|
GetFirstVideoContentDescription(updated_offer.get());
|
||||||
std::vector<VideoCodec> codecs = vcd->codecs();
|
std::vector<Codec> codecs = vcd->codecs();
|
||||||
ASSERT_EQ(4u, codecs.size());
|
ASSERT_EQ(4u, codecs.size());
|
||||||
EXPECT_EQ(vp8_offerer, codecs[0]);
|
EXPECT_EQ(vp8_offerer, codecs[0]);
|
||||||
EXPECT_EQ(vp8_offerer_rtx, codecs[1]);
|
EXPECT_EQ(vp8_offerer_rtx, codecs[1]);
|
||||||
|
@ -2956,7 +2955,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
|
||||||
// use, the added codecs payload types are changed.
|
// use, the added codecs payload types are changed.
|
||||||
TEST_F(MediaSessionDescriptionFactoryTest,
|
TEST_F(MediaSessionDescriptionFactoryTest,
|
||||||
RespondentCreatesOfferWithVideoAndRtxAfterCreatingAudioAnswer) {
|
RespondentCreatesOfferWithVideoAndRtxAfterCreatingAudioAnswer) {
|
||||||
std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
|
std::vector<Codec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
|
||||||
// This creates rtx for H264 with the payload type `f1_` uses.
|
// This creates rtx for H264 with the payload type `f1_` uses.
|
||||||
AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs);
|
AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs);
|
||||||
f1_.set_video_codecs(f1_codecs, f1_codecs);
|
f1_.set_video_codecs(f1_codecs, f1_codecs);
|
||||||
|
@ -2981,7 +2980,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
|
||||||
opts.media_description_options.clear();
|
opts.media_description_options.clear();
|
||||||
AddAudioVideoSections(RtpTransceiverDirection::kRecvOnly, &opts);
|
AddAudioVideoSections(RtpTransceiverDirection::kRecvOnly, &opts);
|
||||||
|
|
||||||
std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
|
std::vector<Codec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
|
||||||
int used_pl_type = acd->codecs()[0].id;
|
int used_pl_type = acd->codecs()[0].id;
|
||||||
f2_codecs[0].id = used_pl_type; // Set the payload type for H264.
|
f2_codecs[0].id = used_pl_type; // Set the payload type for H264.
|
||||||
AddRtxCodec(CreateVideoRtxCodec(125, used_pl_type), &f2_codecs);
|
AddRtxCodec(CreateVideoRtxCodec(125, used_pl_type), &f2_codecs);
|
||||||
|
@ -3005,7 +3004,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
|
||||||
ASSERT_EQ(kRtxCodecName, updated_vcd->codecs()[1].name);
|
ASSERT_EQ(kRtxCodecName, updated_vcd->codecs()[1].name);
|
||||||
int new_h264_pl_type = updated_vcd->codecs()[0].id;
|
int new_h264_pl_type = updated_vcd->codecs()[0].id;
|
||||||
EXPECT_NE(used_pl_type, new_h264_pl_type);
|
EXPECT_NE(used_pl_type, new_h264_pl_type);
|
||||||
VideoCodec rtx = updated_vcd->codecs()[1];
|
Codec rtx = updated_vcd->codecs()[1];
|
||||||
int pt_referenced_by_rtx =
|
int pt_referenced_by_rtx =
|
||||||
rtc::FromString<int>(rtx.params[kCodecParamAssociatedPayloadType]);
|
rtc::FromString<int>(rtx.params[kCodecParamAssociatedPayloadType]);
|
||||||
EXPECT_EQ(new_h264_pl_type, pt_referenced_by_rtx);
|
EXPECT_EQ(new_h264_pl_type, pt_referenced_by_rtx);
|
||||||
|
@ -3019,7 +3018,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
|
||||||
MediaSessionOptions opts;
|
MediaSessionOptions opts;
|
||||||
AddAudioVideoSections(RtpTransceiverDirection::kRecvOnly, &opts);
|
AddAudioVideoSections(RtpTransceiverDirection::kRecvOnly, &opts);
|
||||||
|
|
||||||
std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
|
std::vector<Codec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
|
||||||
// This creates rtx for H264 with the payload type `f2_` uses.
|
// This creates rtx for H264 with the payload type `f2_` uses.
|
||||||
AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs2[0].id), &f2_codecs);
|
AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs2[0].id), &f2_codecs);
|
||||||
f2_.set_video_codecs(f2_codecs, f2_codecs);
|
f2_.set_video_codecs(f2_codecs, f2_codecs);
|
||||||
|
@ -3033,7 +3032,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
|
||||||
const VideoContentDescription* vcd =
|
const VideoContentDescription* vcd =
|
||||||
GetFirstVideoContentDescription(answer.get());
|
GetFirstVideoContentDescription(answer.get());
|
||||||
|
|
||||||
std::vector<VideoCodec> expected_codecs = MAKE_VECTOR(kVideoCodecsAnswer);
|
std::vector<Codec> expected_codecs = MAKE_VECTOR(kVideoCodecsAnswer);
|
||||||
EXPECT_EQ(expected_codecs, vcd->codecs());
|
EXPECT_EQ(expected_codecs, vcd->codecs());
|
||||||
|
|
||||||
// Now, ensure that the RTX codec is created correctly when `f2_` creates an
|
// Now, ensure that the RTX codec is created correctly when `f2_` creates an
|
||||||
|
@ -3058,12 +3057,12 @@ TEST_F(MediaSessionDescriptionFactoryTest, RtxWithoutApt) {
|
||||||
AddMediaDescriptionOptions(MEDIA_TYPE_VIDEO, "video",
|
AddMediaDescriptionOptions(MEDIA_TYPE_VIDEO, "video",
|
||||||
RtpTransceiverDirection::kRecvOnly, kActive,
|
RtpTransceiverDirection::kRecvOnly, kActive,
|
||||||
&opts);
|
&opts);
|
||||||
std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
|
std::vector<Codec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
|
||||||
// This creates RTX without associated payload type parameter.
|
// This creates RTX without associated payload type parameter.
|
||||||
AddRtxCodec(CreateVideoCodec(126, kRtxCodecName), &f1_codecs);
|
AddRtxCodec(CreateVideoCodec(126, kRtxCodecName), &f1_codecs);
|
||||||
f1_.set_video_codecs(f1_codecs, f1_codecs);
|
f1_.set_video_codecs(f1_codecs, f1_codecs);
|
||||||
|
|
||||||
std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
|
std::vector<Codec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
|
||||||
// This creates RTX for H264 with the payload type `f2_` uses.
|
// This creates RTX for H264 with the payload type `f2_` uses.
|
||||||
AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs2[0].id), &f2_codecs);
|
AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs2[0].id), &f2_codecs);
|
||||||
f2_.set_video_codecs(f2_codecs, f2_codecs);
|
f2_.set_video_codecs(f2_codecs, f2_codecs);
|
||||||
|
@ -3101,12 +3100,12 @@ TEST_F(MediaSessionDescriptionFactoryTest, FilterOutRtxIfAptDoesntMatch) {
|
||||||
AddMediaDescriptionOptions(MEDIA_TYPE_VIDEO, "video",
|
AddMediaDescriptionOptions(MEDIA_TYPE_VIDEO, "video",
|
||||||
RtpTransceiverDirection::kRecvOnly, kActive,
|
RtpTransceiverDirection::kRecvOnly, kActive,
|
||||||
&opts);
|
&opts);
|
||||||
std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
|
std::vector<Codec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
|
||||||
// This creates RTX for H264 in sender.
|
// This creates RTX for H264 in sender.
|
||||||
AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs);
|
AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs);
|
||||||
f1_.set_video_codecs(f1_codecs, f1_codecs);
|
f1_.set_video_codecs(f1_codecs, f1_codecs);
|
||||||
|
|
||||||
std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
|
std::vector<Codec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
|
||||||
// This creates RTX for H263 in receiver.
|
// This creates RTX for H263 in receiver.
|
||||||
AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs2[1].id), &f2_codecs);
|
AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs2[1].id), &f2_codecs);
|
||||||
f2_.set_video_codecs(f2_codecs, f2_codecs);
|
f2_.set_video_codecs(f2_codecs, f2_codecs);
|
||||||
|
@ -3132,7 +3131,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
|
||||||
AddMediaDescriptionOptions(MEDIA_TYPE_VIDEO, "video",
|
AddMediaDescriptionOptions(MEDIA_TYPE_VIDEO, "video",
|
||||||
RtpTransceiverDirection::kRecvOnly, kActive,
|
RtpTransceiverDirection::kRecvOnly, kActive,
|
||||||
&opts);
|
&opts);
|
||||||
std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
|
std::vector<Codec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
|
||||||
// This creates RTX for H264-SVC in sender.
|
// This creates RTX for H264-SVC in sender.
|
||||||
AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs1[0].id), &f1_codecs);
|
AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs1[0].id), &f1_codecs);
|
||||||
f1_.set_video_codecs(f1_codecs, f1_codecs);
|
f1_.set_video_codecs(f1_codecs, f1_codecs);
|
||||||
|
@ -3141,7 +3140,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
|
||||||
AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs);
|
AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs);
|
||||||
f1_.set_video_codecs(f1_codecs, f1_codecs);
|
f1_.set_video_codecs(f1_codecs, f1_codecs);
|
||||||
|
|
||||||
std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
|
std::vector<Codec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
|
||||||
// This creates RTX for H264 in receiver.
|
// This creates RTX for H264 in receiver.
|
||||||
AddRtxCodec(CreateVideoRtxCodec(124, kVideoCodecs2[0].id), &f2_codecs);
|
AddRtxCodec(CreateVideoRtxCodec(124, kVideoCodecs2[0].id), &f2_codecs);
|
||||||
f2_.set_video_codecs(f2_codecs, f1_codecs);
|
f2_.set_video_codecs(f2_codecs, f1_codecs);
|
||||||
|
@ -3155,7 +3154,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
|
||||||
f2_.CreateAnswerOrError(offer.get(), opts, nullptr).MoveValue();
|
f2_.CreateAnswerOrError(offer.get(), opts, nullptr).MoveValue();
|
||||||
const VideoContentDescription* vcd =
|
const VideoContentDescription* vcd =
|
||||||
GetFirstVideoContentDescription(answer.get());
|
GetFirstVideoContentDescription(answer.get());
|
||||||
std::vector<VideoCodec> expected_codecs = MAKE_VECTOR(kVideoCodecsAnswer);
|
std::vector<Codec> expected_codecs = MAKE_VECTOR(kVideoCodecsAnswer);
|
||||||
AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &expected_codecs);
|
AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &expected_codecs);
|
||||||
|
|
||||||
EXPECT_EQ(expected_codecs, vcd->codecs());
|
EXPECT_EQ(expected_codecs, vcd->codecs());
|
||||||
|
@ -3168,7 +3167,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, AddSecondRtxInNewOffer) {
|
||||||
AddMediaDescriptionOptions(MEDIA_TYPE_VIDEO, "video",
|
AddMediaDescriptionOptions(MEDIA_TYPE_VIDEO, "video",
|
||||||
RtpTransceiverDirection::kRecvOnly, kActive,
|
RtpTransceiverDirection::kRecvOnly, kActive,
|
||||||
&opts);
|
&opts);
|
||||||
std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
|
std::vector<Codec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
|
||||||
// This creates RTX for H264 for the offerer.
|
// This creates RTX for H264 for the offerer.
|
||||||
AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs);
|
AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs);
|
||||||
f1_.set_video_codecs(f1_codecs, f1_codecs);
|
f1_.set_video_codecs(f1_codecs, f1_codecs);
|
||||||
|
@ -3179,7 +3178,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, AddSecondRtxInNewOffer) {
|
||||||
const VideoContentDescription* vcd =
|
const VideoContentDescription* vcd =
|
||||||
GetFirstVideoContentDescription(offer.get());
|
GetFirstVideoContentDescription(offer.get());
|
||||||
|
|
||||||
std::vector<VideoCodec> expected_codecs = MAKE_VECTOR(kVideoCodecs1);
|
std::vector<Codec> expected_codecs = MAKE_VECTOR(kVideoCodecs1);
|
||||||
AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &expected_codecs);
|
AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &expected_codecs);
|
||||||
EXPECT_EQ(expected_codecs, vcd->codecs());
|
EXPECT_EQ(expected_codecs, vcd->codecs());
|
||||||
|
|
||||||
|
@ -3208,7 +3207,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, SimSsrcsGenerateMultipleRtxSsrcs) {
|
||||||
{"stream1label"}, 3, &opts);
|
{"stream1label"}, 3, &opts);
|
||||||
|
|
||||||
// Use a single real codec, and then add RTX for it.
|
// Use a single real codec, and then add RTX for it.
|
||||||
std::vector<VideoCodec> f1_codecs;
|
std::vector<Codec> f1_codecs;
|
||||||
f1_codecs.push_back(CreateVideoCodec(97, "H264"));
|
f1_codecs.push_back(CreateVideoCodec(97, "H264"));
|
||||||
AddRtxCodec(CreateVideoRtxCodec(125, 97), &f1_codecs);
|
AddRtxCodec(CreateVideoRtxCodec(125, 97), &f1_codecs);
|
||||||
f1_.set_video_codecs(f1_codecs, f1_codecs);
|
f1_.set_video_codecs(f1_codecs, f1_codecs);
|
||||||
|
@ -3252,7 +3251,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, GenerateFlexfecSsrc) {
|
||||||
{"stream1label"}, 1, &opts);
|
{"stream1label"}, 1, &opts);
|
||||||
|
|
||||||
// Use a single real codec, and then add FlexFEC for it.
|
// Use a single real codec, and then add FlexFEC for it.
|
||||||
std::vector<VideoCodec> f1_codecs;
|
std::vector<Codec> f1_codecs;
|
||||||
f1_codecs.push_back(CreateVideoCodec(97, "H264"));
|
f1_codecs.push_back(CreateVideoCodec(97, "H264"));
|
||||||
f1_codecs.push_back(CreateVideoCodec(118, "flexfec-03"));
|
f1_codecs.push_back(CreateVideoCodec(118, "flexfec-03"));
|
||||||
f1_.set_video_codecs(f1_codecs, f1_codecs);
|
f1_.set_video_codecs(f1_codecs, f1_codecs);
|
||||||
|
@ -3295,7 +3294,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, SimSsrcsGenerateNoFlexfecSsrcs) {
|
||||||
{"stream1label"}, 3, &opts);
|
{"stream1label"}, 3, &opts);
|
||||||
|
|
||||||
// Use a single real codec, and then add FlexFEC for it.
|
// Use a single real codec, and then add FlexFEC for it.
|
||||||
std::vector<VideoCodec> f1_codecs;
|
std::vector<Codec> f1_codecs;
|
||||||
f1_codecs.push_back(CreateVideoCodec(97, "H264"));
|
f1_codecs.push_back(CreateVideoCodec(97, "H264"));
|
||||||
f1_codecs.push_back(CreateVideoCodec(118, "flexfec-03"));
|
f1_codecs.push_back(CreateVideoCodec(118, "flexfec-03"));
|
||||||
f1_.set_video_codecs(f1_codecs, f1_codecs);
|
f1_.set_video_codecs(f1_codecs, f1_codecs);
|
||||||
|
@ -4276,10 +4275,10 @@ TEST_F(MediaSessionDescriptionFactoryTest,
|
||||||
H264MatchCriteriaIncludesPacketizationMode) {
|
H264MatchCriteriaIncludesPacketizationMode) {
|
||||||
// Create two H264 codecs with the same profile level ID and different
|
// Create two H264 codecs with the same profile level ID and different
|
||||||
// packetization modes.
|
// packetization modes.
|
||||||
VideoCodec h264_pm0 = CreateVideoCodec(96, "H264");
|
Codec h264_pm0 = CreateVideoCodec(96, "H264");
|
||||||
h264_pm0.params[kH264FmtpProfileLevelId] = "42c01f";
|
h264_pm0.params[kH264FmtpProfileLevelId] = "42c01f";
|
||||||
h264_pm0.params[kH264FmtpPacketizationMode] = "0";
|
h264_pm0.params[kH264FmtpPacketizationMode] = "0";
|
||||||
VideoCodec h264_pm1 = CreateVideoCodec(97, "H264");
|
Codec h264_pm1 = CreateVideoCodec(97, "H264");
|
||||||
h264_pm1.params[kH264FmtpProfileLevelId] = "42c01f";
|
h264_pm1.params[kH264FmtpProfileLevelId] = "42c01f";
|
||||||
h264_pm1.params[kH264FmtpPacketizationMode] = "1";
|
h264_pm1.params[kH264FmtpPacketizationMode] = "1";
|
||||||
|
|
||||||
|
@ -4380,17 +4379,16 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestSetAudioCodecs) {
|
||||||
|
|
||||||
UniqueRandomIdGenerator ssrc_generator;
|
UniqueRandomIdGenerator ssrc_generator;
|
||||||
MediaSessionDescriptionFactory sf(nullptr, false, &ssrc_generator, &tdf);
|
MediaSessionDescriptionFactory sf(nullptr, false, &ssrc_generator, &tdf);
|
||||||
std::vector<AudioCodec> send_codecs = MAKE_VECTOR(kAudioCodecs1);
|
std::vector<Codec> send_codecs = MAKE_VECTOR(kAudioCodecs1);
|
||||||
std::vector<AudioCodec> recv_codecs = MAKE_VECTOR(kAudioCodecs2);
|
std::vector<Codec> recv_codecs = MAKE_VECTOR(kAudioCodecs2);
|
||||||
|
|
||||||
// The merged list of codecs should contain any send codecs that are also
|
// The merged list of codecs should contain any send codecs that are also
|
||||||
// nominally in the receive codecs list. Payload types should be picked from
|
// nominally in the receive codecs list. Payload types should be picked from
|
||||||
// the send codecs and a number-of-channels of 0 and 1 should be equivalent
|
// the send codecs and a number-of-channels of 0 and 1 should be equivalent
|
||||||
// (set to 1). This equals what happens when the send codecs are used in an
|
// (set to 1). This equals what happens when the send codecs are used in an
|
||||||
// offer and the receive codecs are used in the following answer.
|
// offer and the receive codecs are used in the following answer.
|
||||||
const std::vector<AudioCodec> sendrecv_codecs =
|
const std::vector<Codec> sendrecv_codecs = MAKE_VECTOR(kAudioCodecsAnswer);
|
||||||
MAKE_VECTOR(kAudioCodecsAnswer);
|
const std::vector<Codec> no_codecs;
|
||||||
const std::vector<AudioCodec> no_codecs;
|
|
||||||
|
|
||||||
RTC_CHECK_EQ(send_codecs[2].name, "iLBC")
|
RTC_CHECK_EQ(send_codecs[2].name, "iLBC")
|
||||||
<< "Please don't change shared test data!";
|
<< "Please don't change shared test data!";
|
||||||
|
@ -4452,10 +4450,9 @@ void TestAudioCodecsOffer(RtpTransceiverDirection direction) {
|
||||||
|
|
||||||
UniqueRandomIdGenerator ssrc_generator;
|
UniqueRandomIdGenerator ssrc_generator;
|
||||||
MediaSessionDescriptionFactory sf(nullptr, false, &ssrc_generator, &tdf);
|
MediaSessionDescriptionFactory sf(nullptr, false, &ssrc_generator, &tdf);
|
||||||
const std::vector<AudioCodec> send_codecs = MAKE_VECTOR(kAudioCodecs1);
|
const std::vector<Codec> send_codecs = MAKE_VECTOR(kAudioCodecs1);
|
||||||
const std::vector<AudioCodec> recv_codecs = MAKE_VECTOR(kAudioCodecs2);
|
const std::vector<Codec> recv_codecs = MAKE_VECTOR(kAudioCodecs2);
|
||||||
const std::vector<AudioCodec> sendrecv_codecs =
|
const std::vector<Codec> sendrecv_codecs = MAKE_VECTOR(kAudioCodecsAnswer);
|
||||||
MAKE_VECTOR(kAudioCodecsAnswer);
|
|
||||||
sf.set_audio_codecs(send_codecs, recv_codecs);
|
sf.set_audio_codecs(send_codecs, recv_codecs);
|
||||||
|
|
||||||
MediaSessionOptions opts;
|
MediaSessionOptions opts;
|
||||||
|
@ -4493,8 +4490,7 @@ void TestAudioCodecsOffer(RtpTransceiverDirection direction) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const AudioCodec kOfferAnswerCodecs[] = {
|
const Codec kOfferAnswerCodecs[] = {CreateAudioCodec(0, "codec0", 16000, 1),
|
||||||
CreateAudioCodec(0, "codec0", 16000, 1),
|
|
||||||
CreateAudioCodec(1, "codec1", 8000, 1),
|
CreateAudioCodec(1, "codec1", 8000, 1),
|
||||||
CreateAudioCodec(2, "codec2", 8000, 1),
|
CreateAudioCodec(2, "codec2", 8000, 1),
|
||||||
CreateAudioCodec(3, "codec3", 8000, 1),
|
CreateAudioCodec(3, "codec3", 8000, 1),
|
||||||
|
@ -4604,7 +4600,7 @@ void TestAudioCodecsAnswer(RtpTransceiverDirection offer_direction,
|
||||||
ASSERT_EQ(MEDIA_TYPE_AUDIO, ac->media_description()->type());
|
ASSERT_EQ(MEDIA_TYPE_AUDIO, ac->media_description()->type());
|
||||||
const MediaContentDescription* acd = ac->media_description();
|
const MediaContentDescription* acd = ac->media_description();
|
||||||
|
|
||||||
std::vector<AudioCodec> target_codecs;
|
std::vector<Codec> target_codecs;
|
||||||
// For offers with sendrecv or inactive, we should never reply with more
|
// For offers with sendrecv or inactive, we should never reply with more
|
||||||
// codecs than offered, with these codec sets.
|
// codecs than offered, with these codec sets.
|
||||||
switch (offer_direction) {
|
switch (offer_direction) {
|
||||||
|
@ -4637,7 +4633,7 @@ void TestAudioCodecsAnswer(RtpTransceiverDirection offer_direction,
|
||||||
RTC_DCHECK_NOTREACHED();
|
RTC_DCHECK_NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto format_codecs = [](const std::vector<AudioCodec>& codecs) {
|
auto format_codecs = [](const std::vector<Codec>& codecs) {
|
||||||
rtc::StringBuilder os;
|
rtc::StringBuilder os;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
os << "{";
|
os << "{";
|
||||||
|
|
|
@ -1141,7 +1141,7 @@ PeerConnection::AddTransceiver(
|
||||||
"Attempted to set an unimplemented parameter of RtpParameters.");
|
"Attempted to set an unimplemented parameter of RtpParameters.");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<cricket::VideoCodec> codecs;
|
std::vector<cricket::Codec> codecs;
|
||||||
// Gather the current codec capabilities to allow checking scalabilityMode and
|
// Gather the current codec capabilities to allow checking scalabilityMode and
|
||||||
// codec selection against supported values.
|
// codec selection against supported values.
|
||||||
if (media_type == cricket::MEDIA_TYPE_VIDEO) {
|
if (media_type == cricket::MEDIA_TYPE_VIDEO) {
|
||||||
|
|
|
@ -134,14 +134,14 @@ RtpCapabilities PeerConnectionFactory::GetRtpSenderCapabilities(
|
||||||
RTC_DCHECK_RUN_ON(signaling_thread());
|
RTC_DCHECK_RUN_ON(signaling_thread());
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case cricket::MEDIA_TYPE_AUDIO: {
|
case cricket::MEDIA_TYPE_AUDIO: {
|
||||||
cricket::AudioCodecs cricket_codecs;
|
cricket::Codecs cricket_codecs;
|
||||||
cricket_codecs = media_engine()->voice().send_codecs();
|
cricket_codecs = media_engine()->voice().send_codecs();
|
||||||
auto extensions =
|
auto extensions =
|
||||||
GetDefaultEnabledRtpHeaderExtensions(media_engine()->voice());
|
GetDefaultEnabledRtpHeaderExtensions(media_engine()->voice());
|
||||||
return ToRtpCapabilities(cricket_codecs, extensions);
|
return ToRtpCapabilities(cricket_codecs, extensions);
|
||||||
}
|
}
|
||||||
case cricket::MEDIA_TYPE_VIDEO: {
|
case cricket::MEDIA_TYPE_VIDEO: {
|
||||||
cricket::VideoCodecs cricket_codecs;
|
cricket::Codecs cricket_codecs;
|
||||||
cricket_codecs = media_engine()->video().send_codecs(context_->use_rtx());
|
cricket_codecs = media_engine()->video().send_codecs(context_->use_rtx());
|
||||||
auto extensions =
|
auto extensions =
|
||||||
GetDefaultEnabledRtpHeaderExtensions(media_engine()->video());
|
GetDefaultEnabledRtpHeaderExtensions(media_engine()->video());
|
||||||
|
@ -161,14 +161,14 @@ RtpCapabilities PeerConnectionFactory::GetRtpReceiverCapabilities(
|
||||||
RTC_DCHECK_RUN_ON(signaling_thread());
|
RTC_DCHECK_RUN_ON(signaling_thread());
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case cricket::MEDIA_TYPE_AUDIO: {
|
case cricket::MEDIA_TYPE_AUDIO: {
|
||||||
cricket::AudioCodecs cricket_codecs;
|
cricket::Codecs cricket_codecs;
|
||||||
cricket_codecs = media_engine()->voice().recv_codecs();
|
cricket_codecs = media_engine()->voice().recv_codecs();
|
||||||
auto extensions =
|
auto extensions =
|
||||||
GetDefaultEnabledRtpHeaderExtensions(media_engine()->voice());
|
GetDefaultEnabledRtpHeaderExtensions(media_engine()->voice());
|
||||||
return ToRtpCapabilities(cricket_codecs, extensions);
|
return ToRtpCapabilities(cricket_codecs, extensions);
|
||||||
}
|
}
|
||||||
case cricket::MEDIA_TYPE_VIDEO: {
|
case cricket::MEDIA_TYPE_VIDEO: {
|
||||||
cricket::VideoCodecs cricket_codecs =
|
cricket::Codecs cricket_codecs =
|
||||||
media_engine()->video().recv_codecs(context_->use_rtx());
|
media_engine()->video().recv_codecs(context_->use_rtx());
|
||||||
auto extensions =
|
auto extensions =
|
||||||
GetDefaultEnabledRtpHeaderExtensions(media_engine()->video());
|
GetDefaultEnabledRtpHeaderExtensions(media_engine()->video());
|
||||||
|
|
|
@ -2573,7 +2573,7 @@ TEST_P(PeerConnectionIntegrationTest, CodecNamesAreCaseInsensitive) {
|
||||||
ASSERT_NE(nullptr, audio);
|
ASSERT_NE(nullptr, audio);
|
||||||
auto audio_codecs = audio->codecs();
|
auto audio_codecs = audio->codecs();
|
||||||
audio_codecs.erase(std::remove_if(audio_codecs.begin(), audio_codecs.end(),
|
audio_codecs.erase(std::remove_if(audio_codecs.begin(), audio_codecs.end(),
|
||||||
[](const cricket::AudioCodec& codec) {
|
[](const cricket::Codec& codec) {
|
||||||
return codec.name != "opus";
|
return codec.name != "opus";
|
||||||
}),
|
}),
|
||||||
audio_codecs.end());
|
audio_codecs.end());
|
||||||
|
@ -2586,7 +2586,7 @@ TEST_P(PeerConnectionIntegrationTest, CodecNamesAreCaseInsensitive) {
|
||||||
ASSERT_NE(nullptr, video);
|
ASSERT_NE(nullptr, video);
|
||||||
auto video_codecs = video->codecs();
|
auto video_codecs = video->codecs();
|
||||||
video_codecs.erase(std::remove_if(video_codecs.begin(), video_codecs.end(),
|
video_codecs.erase(std::remove_if(video_codecs.begin(), video_codecs.end(),
|
||||||
[](const cricket::VideoCodec& codec) {
|
[](const cricket::Codec& codec) {
|
||||||
return codec.name != "VP8";
|
return codec.name != "VP8";
|
||||||
}),
|
}),
|
||||||
video_codecs.end());
|
video_codecs.end());
|
||||||
|
|
|
@ -599,7 +599,7 @@ TEST_P(PeerConnectionMediaTest,
|
||||||
|
|
||||||
// Test that raw packetization is not set in the offer by default.
|
// Test that raw packetization is not set in the offer by default.
|
||||||
TEST_P(PeerConnectionMediaTest, RawPacketizationNotSetInOffer) {
|
TEST_P(PeerConnectionMediaTest, RawPacketizationNotSetInOffer) {
|
||||||
std::vector<cricket::VideoCodec> fake_codecs;
|
std::vector<cricket::Codec> fake_codecs;
|
||||||
fake_codecs.push_back(cricket::CreateVideoCodec(111, cricket::kVp8CodecName));
|
fake_codecs.push_back(cricket::CreateVideoCodec(111, cricket::kVp8CodecName));
|
||||||
fake_codecs.push_back(cricket::CreateVideoRtxCodec(112, 111));
|
fake_codecs.push_back(cricket::CreateVideoRtxCodec(112, 111));
|
||||||
fake_codecs.push_back(cricket::CreateVideoCodec(113, cricket::kVp9CodecName));
|
fake_codecs.push_back(cricket::CreateVideoCodec(113, cricket::kVp9CodecName));
|
||||||
|
@ -621,7 +621,7 @@ TEST_P(PeerConnectionMediaTest, RawPacketizationNotSetInOffer) {
|
||||||
// Test that raw packetization is set in the offer and answer for all
|
// Test that raw packetization is set in the offer and answer for all
|
||||||
// video payload when raw_packetization_for_video is true.
|
// video payload when raw_packetization_for_video is true.
|
||||||
TEST_P(PeerConnectionMediaTest, RawPacketizationSetInOfferAndAnswer) {
|
TEST_P(PeerConnectionMediaTest, RawPacketizationSetInOfferAndAnswer) {
|
||||||
std::vector<cricket::VideoCodec> fake_codecs;
|
std::vector<cricket::Codec> fake_codecs;
|
||||||
fake_codecs.push_back(cricket::CreateVideoCodec(111, cricket::kVp8CodecName));
|
fake_codecs.push_back(cricket::CreateVideoCodec(111, cricket::kVp8CodecName));
|
||||||
fake_codecs.push_back(cricket::CreateVideoRtxCodec(112, 111));
|
fake_codecs.push_back(cricket::CreateVideoRtxCodec(112, 111));
|
||||||
fake_codecs.push_back(cricket::CreateVideoCodec(113, cricket::kVp9CodecName));
|
fake_codecs.push_back(cricket::CreateVideoCodec(113, cricket::kVp9CodecName));
|
||||||
|
@ -664,7 +664,7 @@ TEST_P(PeerConnectionMediaTest, RawPacketizationSetInOfferAndAnswer) {
|
||||||
// raw_packetization_for_video is true if it was not set in the offer.
|
// raw_packetization_for_video is true if it was not set in the offer.
|
||||||
TEST_P(PeerConnectionMediaTest,
|
TEST_P(PeerConnectionMediaTest,
|
||||||
RawPacketizationNotSetInAnswerWhenNotSetInOffer) {
|
RawPacketizationNotSetInAnswerWhenNotSetInOffer) {
|
||||||
std::vector<cricket::VideoCodec> fake_codecs;
|
std::vector<cricket::Codec> fake_codecs;
|
||||||
fake_codecs.push_back(cricket::CreateVideoCodec(111, cricket::kVp8CodecName));
|
fake_codecs.push_back(cricket::CreateVideoCodec(111, cricket::kVp8CodecName));
|
||||||
fake_codecs.push_back(cricket::CreateVideoRtxCodec(112, 111));
|
fake_codecs.push_back(cricket::CreateVideoRtxCodec(112, 111));
|
||||||
fake_codecs.push_back(cricket::CreateVideoCodec(113, cricket::kVp9CodecName));
|
fake_codecs.push_back(cricket::CreateVideoCodec(113, cricket::kVp9CodecName));
|
||||||
|
@ -906,9 +906,9 @@ TEST_P(PeerConnectionMediaTest, AnswerHasDifferentDirectionsForAudioVideo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddComfortNoiseCodecsToSend(cricket::FakeMediaEngine* media_engine) {
|
void AddComfortNoiseCodecsToSend(cricket::FakeMediaEngine* media_engine) {
|
||||||
const cricket::AudioCodec kComfortNoiseCodec8k =
|
const cricket::Codec kComfortNoiseCodec8k =
|
||||||
cricket::CreateAudioCodec(102, cricket::kCnCodecName, 8000, 1);
|
cricket::CreateAudioCodec(102, cricket::kCnCodecName, 8000, 1);
|
||||||
const cricket::AudioCodec kComfortNoiseCodec16k =
|
const cricket::Codec kComfortNoiseCodec16k =
|
||||||
cricket::CreateAudioCodec(103, cricket::kCnCodecName, 16000, 1);
|
cricket::CreateAudioCodec(103, cricket::kCnCodecName, 16000, 1);
|
||||||
|
|
||||||
auto codecs = media_engine->voice().send_codecs();
|
auto codecs = media_engine->voice().send_codecs();
|
||||||
|
@ -1246,13 +1246,13 @@ TEST_P(PeerConnectionMediaTest, SetRemoteDescriptionFailsWithDuplicateMids) {
|
||||||
// endpoint selected a different payload type or there was a conflict), the RED
|
// endpoint selected a different payload type or there was a conflict), the RED
|
||||||
// fmtp line is modified to refer to the correct payload type.
|
// fmtp line is modified to refer to the correct payload type.
|
||||||
TEST_P(PeerConnectionMediaTest, RedFmtpPayloadTypeReassigned) {
|
TEST_P(PeerConnectionMediaTest, RedFmtpPayloadTypeReassigned) {
|
||||||
std::vector<cricket::AudioCodec> caller_fake_codecs;
|
std::vector<cricket::Codec> caller_fake_codecs;
|
||||||
caller_fake_codecs.push_back(cricket::CreateAudioCodec(100, "foo", 0, 1));
|
caller_fake_codecs.push_back(cricket::CreateAudioCodec(100, "foo", 0, 1));
|
||||||
auto caller_fake_engine = std::make_unique<FakeMediaEngine>();
|
auto caller_fake_engine = std::make_unique<FakeMediaEngine>();
|
||||||
caller_fake_engine->SetAudioCodecs(caller_fake_codecs);
|
caller_fake_engine->SetAudioCodecs(caller_fake_codecs);
|
||||||
auto caller = CreatePeerConnectionWithAudio(std::move(caller_fake_engine));
|
auto caller = CreatePeerConnectionWithAudio(std::move(caller_fake_engine));
|
||||||
|
|
||||||
std::vector<cricket::AudioCodec> callee_fake_codecs;
|
std::vector<cricket::Codec> callee_fake_codecs;
|
||||||
callee_fake_codecs.push_back(cricket::CreateAudioCodec(120, "foo", 0, 1));
|
callee_fake_codecs.push_back(cricket::CreateAudioCodec(120, "foo", 0, 1));
|
||||||
callee_fake_codecs.push_back(
|
callee_fake_codecs.push_back(
|
||||||
cricket::CreateAudioCodec(121, cricket::kRedCodecName, 0, 1));
|
cricket::CreateAudioCodec(121, cricket::kRedCodecName, 0, 1));
|
||||||
|
@ -1289,7 +1289,7 @@ TEST_P(PeerConnectionMediaTest, RedFmtpPayloadTypeReassigned) {
|
||||||
|
|
||||||
// Test that RED without fmtp does match RED without fmtp.
|
// Test that RED without fmtp does match RED without fmtp.
|
||||||
TEST_P(PeerConnectionMediaTest, RedFmtpPayloadTypeNoFmtpMatchNoFmtp) {
|
TEST_P(PeerConnectionMediaTest, RedFmtpPayloadTypeNoFmtpMatchNoFmtp) {
|
||||||
std::vector<cricket::AudioCodec> caller_fake_codecs;
|
std::vector<cricket::Codec> caller_fake_codecs;
|
||||||
caller_fake_codecs.push_back(cricket::CreateAudioCodec(100, "foo", 0, 1));
|
caller_fake_codecs.push_back(cricket::CreateAudioCodec(100, "foo", 0, 1));
|
||||||
caller_fake_codecs.push_back(
|
caller_fake_codecs.push_back(
|
||||||
cricket::CreateAudioCodec(101, cricket::kRedCodecName, 0, 1));
|
cricket::CreateAudioCodec(101, cricket::kRedCodecName, 0, 1));
|
||||||
|
@ -1297,7 +1297,7 @@ TEST_P(PeerConnectionMediaTest, RedFmtpPayloadTypeNoFmtpMatchNoFmtp) {
|
||||||
caller_fake_engine->SetAudioCodecs(caller_fake_codecs);
|
caller_fake_engine->SetAudioCodecs(caller_fake_codecs);
|
||||||
auto caller = CreatePeerConnectionWithAudio(std::move(caller_fake_engine));
|
auto caller = CreatePeerConnectionWithAudio(std::move(caller_fake_engine));
|
||||||
|
|
||||||
std::vector<cricket::AudioCodec> callee_fake_codecs;
|
std::vector<cricket::Codec> callee_fake_codecs;
|
||||||
callee_fake_codecs.push_back(cricket::CreateAudioCodec(120, "foo", 0, 1));
|
callee_fake_codecs.push_back(cricket::CreateAudioCodec(120, "foo", 0, 1));
|
||||||
callee_fake_codecs.push_back(
|
callee_fake_codecs.push_back(
|
||||||
cricket::CreateAudioCodec(121, cricket::kRedCodecName, 0, 1));
|
cricket::CreateAudioCodec(121, cricket::kRedCodecName, 0, 1));
|
||||||
|
@ -1331,7 +1331,7 @@ TEST_P(PeerConnectionMediaTest, RedFmtpPayloadTypeNoFmtpMatchNoFmtp) {
|
||||||
|
|
||||||
// Test that RED without fmtp does not match RED with fmtp.
|
// Test that RED without fmtp does not match RED with fmtp.
|
||||||
TEST_P(PeerConnectionMediaTest, RedFmtpPayloadTypeNoFmtpNoMatchFmtp) {
|
TEST_P(PeerConnectionMediaTest, RedFmtpPayloadTypeNoFmtpNoMatchFmtp) {
|
||||||
std::vector<cricket::AudioCodec> caller_fake_codecs;
|
std::vector<cricket::Codec> caller_fake_codecs;
|
||||||
caller_fake_codecs.push_back(cricket::CreateAudioCodec(100, "foo", 0, 1));
|
caller_fake_codecs.push_back(cricket::CreateAudioCodec(100, "foo", 0, 1));
|
||||||
caller_fake_codecs.push_back(
|
caller_fake_codecs.push_back(
|
||||||
cricket::CreateAudioCodec(101, cricket::kRedCodecName, 0, 1));
|
cricket::CreateAudioCodec(101, cricket::kRedCodecName, 0, 1));
|
||||||
|
@ -1339,7 +1339,7 @@ TEST_P(PeerConnectionMediaTest, RedFmtpPayloadTypeNoFmtpNoMatchFmtp) {
|
||||||
caller_fake_engine->SetAudioCodecs(caller_fake_codecs);
|
caller_fake_engine->SetAudioCodecs(caller_fake_codecs);
|
||||||
auto caller = CreatePeerConnectionWithAudio(std::move(caller_fake_engine));
|
auto caller = CreatePeerConnectionWithAudio(std::move(caller_fake_engine));
|
||||||
|
|
||||||
std::vector<cricket::AudioCodec> callee_fake_codecs;
|
std::vector<cricket::Codec> callee_fake_codecs;
|
||||||
callee_fake_codecs.push_back(cricket::CreateAudioCodec(120, "foo", 0, 1));
|
callee_fake_codecs.push_back(cricket::CreateAudioCodec(120, "foo", 0, 1));
|
||||||
callee_fake_codecs.push_back(
|
callee_fake_codecs.push_back(
|
||||||
cricket::CreateAudioCodec(121, cricket::kRedCodecName, 0, 1));
|
cricket::CreateAudioCodec(121, cricket::kRedCodecName, 0, 1));
|
||||||
|
@ -1378,7 +1378,7 @@ TEST_P(PeerConnectionMediaTest, RedFmtpPayloadTypeNoFmtpNoMatchFmtp) {
|
||||||
|
|
||||||
// Test that RED with fmtp must match base codecs.
|
// Test that RED with fmtp must match base codecs.
|
||||||
TEST_P(PeerConnectionMediaTest, RedFmtpPayloadTypeMustMatchBaseCodecs) {
|
TEST_P(PeerConnectionMediaTest, RedFmtpPayloadTypeMustMatchBaseCodecs) {
|
||||||
std::vector<cricket::AudioCodec> caller_fake_codecs;
|
std::vector<cricket::Codec> caller_fake_codecs;
|
||||||
caller_fake_codecs.push_back(cricket::CreateAudioCodec(100, "foo", 0, 1));
|
caller_fake_codecs.push_back(cricket::CreateAudioCodec(100, "foo", 0, 1));
|
||||||
caller_fake_codecs.push_back(
|
caller_fake_codecs.push_back(
|
||||||
cricket::CreateAudioCodec(101, cricket::kRedCodecName, 0, 1));
|
cricket::CreateAudioCodec(101, cricket::kRedCodecName, 0, 1));
|
||||||
|
@ -1388,7 +1388,7 @@ TEST_P(PeerConnectionMediaTest, RedFmtpPayloadTypeMustMatchBaseCodecs) {
|
||||||
caller_fake_engine->SetAudioCodecs(caller_fake_codecs);
|
caller_fake_engine->SetAudioCodecs(caller_fake_codecs);
|
||||||
auto caller = CreatePeerConnectionWithAudio(std::move(caller_fake_engine));
|
auto caller = CreatePeerConnectionWithAudio(std::move(caller_fake_engine));
|
||||||
|
|
||||||
std::vector<cricket::AudioCodec> callee_fake_codecs;
|
std::vector<cricket::Codec> callee_fake_codecs;
|
||||||
callee_fake_codecs.push_back(cricket::CreateAudioCodec(120, "foo", 0, 1));
|
callee_fake_codecs.push_back(cricket::CreateAudioCodec(120, "foo", 0, 1));
|
||||||
callee_fake_codecs.push_back(
|
callee_fake_codecs.push_back(
|
||||||
cricket::CreateAudioCodec(121, cricket::kRedCodecName, 0, 1));
|
cricket::CreateAudioCodec(121, cricket::kRedCodecName, 0, 1));
|
||||||
|
@ -1412,7 +1412,7 @@ TEST_P(PeerConnectionMediaTest, RedFmtpPayloadTypeMustMatchBaseCodecs) {
|
||||||
// Test behaviour when the RED fmtp attempts to specify different codecs
|
// Test behaviour when the RED fmtp attempts to specify different codecs
|
||||||
// which is not supported.
|
// which is not supported.
|
||||||
TEST_P(PeerConnectionMediaTest, RedFmtpPayloadMixed) {
|
TEST_P(PeerConnectionMediaTest, RedFmtpPayloadMixed) {
|
||||||
std::vector<cricket::AudioCodec> caller_fake_codecs;
|
std::vector<cricket::Codec> caller_fake_codecs;
|
||||||
caller_fake_codecs.push_back(cricket::CreateAudioCodec(100, "foo", 0, 1));
|
caller_fake_codecs.push_back(cricket::CreateAudioCodec(100, "foo", 0, 1));
|
||||||
caller_fake_codecs.push_back(cricket::CreateAudioCodec(102, "bar", 0, 1));
|
caller_fake_codecs.push_back(cricket::CreateAudioCodec(102, "bar", 0, 1));
|
||||||
caller_fake_codecs.push_back(
|
caller_fake_codecs.push_back(
|
||||||
|
@ -1423,7 +1423,7 @@ TEST_P(PeerConnectionMediaTest, RedFmtpPayloadMixed) {
|
||||||
caller_fake_engine->SetAudioCodecs(caller_fake_codecs);
|
caller_fake_engine->SetAudioCodecs(caller_fake_codecs);
|
||||||
auto caller = CreatePeerConnectionWithAudio(std::move(caller_fake_engine));
|
auto caller = CreatePeerConnectionWithAudio(std::move(caller_fake_engine));
|
||||||
|
|
||||||
std::vector<cricket::AudioCodec> callee_fake_codecs;
|
std::vector<cricket::Codec> callee_fake_codecs;
|
||||||
callee_fake_codecs.push_back(cricket::CreateAudioCodec(120, "foo", 0, 1));
|
callee_fake_codecs.push_back(cricket::CreateAudioCodec(120, "foo", 0, 1));
|
||||||
callee_fake_codecs.push_back(
|
callee_fake_codecs.push_back(
|
||||||
cricket::CreateAudioCodec(121, cricket::kRedCodecName, 0, 1));
|
cricket::CreateAudioCodec(121, cricket::kRedCodecName, 0, 1));
|
||||||
|
@ -1446,7 +1446,7 @@ TEST_P(PeerConnectionMediaTest, RedFmtpPayloadMixed) {
|
||||||
// Test behaviour when the RED fmtp attempts to negotiate different levels of
|
// Test behaviour when the RED fmtp attempts to negotiate different levels of
|
||||||
// redundancy.
|
// redundancy.
|
||||||
TEST_P(PeerConnectionMediaTest, RedFmtpPayloadDifferentRedundancy) {
|
TEST_P(PeerConnectionMediaTest, RedFmtpPayloadDifferentRedundancy) {
|
||||||
std::vector<cricket::AudioCodec> caller_fake_codecs;
|
std::vector<cricket::Codec> caller_fake_codecs;
|
||||||
caller_fake_codecs.push_back(cricket::CreateAudioCodec(100, "foo", 0, 1));
|
caller_fake_codecs.push_back(cricket::CreateAudioCodec(100, "foo", 0, 1));
|
||||||
caller_fake_codecs.push_back(
|
caller_fake_codecs.push_back(
|
||||||
cricket::CreateAudioCodec(101, cricket::kRedCodecName, 0, 1));
|
cricket::CreateAudioCodec(101, cricket::kRedCodecName, 0, 1));
|
||||||
|
@ -1456,7 +1456,7 @@ TEST_P(PeerConnectionMediaTest, RedFmtpPayloadDifferentRedundancy) {
|
||||||
caller_fake_engine->SetAudioCodecs(caller_fake_codecs);
|
caller_fake_engine->SetAudioCodecs(caller_fake_codecs);
|
||||||
auto caller = CreatePeerConnectionWithAudio(std::move(caller_fake_engine));
|
auto caller = CreatePeerConnectionWithAudio(std::move(caller_fake_engine));
|
||||||
|
|
||||||
std::vector<cricket::AudioCodec> callee_fake_codecs;
|
std::vector<cricket::Codec> callee_fake_codecs;
|
||||||
callee_fake_codecs.push_back(cricket::CreateAudioCodec(120, "foo", 0, 1));
|
callee_fake_codecs.push_back(cricket::CreateAudioCodec(120, "foo", 0, 1));
|
||||||
callee_fake_codecs.push_back(
|
callee_fake_codecs.push_back(
|
||||||
cricket::CreateAudioCodec(121, cricket::kRedCodecName, 0, 1));
|
cricket::CreateAudioCodec(121, cricket::kRedCodecName, 0, 1));
|
||||||
|
@ -2004,12 +2004,12 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan,
|
||||||
SetCodecPreferencesAvoidsPayloadTypeConflictInOffer) {
|
SetCodecPreferencesAvoidsPayloadTypeConflictInOffer) {
|
||||||
auto fake_engine = std::make_unique<cricket::FakeMediaEngine>();
|
auto fake_engine = std::make_unique<cricket::FakeMediaEngine>();
|
||||||
|
|
||||||
std::vector<cricket::AudioCodec> audio_codecs;
|
std::vector<cricket::Codec> audio_codecs;
|
||||||
audio_codecs.emplace_back(cricket::CreateAudioCodec(100, "foo", 0, 1));
|
audio_codecs.emplace_back(cricket::CreateAudioCodec(100, "foo", 0, 1));
|
||||||
audio_codecs.emplace_back(cricket::CreateAudioRtxCodec(101, 100));
|
audio_codecs.emplace_back(cricket::CreateAudioRtxCodec(101, 100));
|
||||||
fake_engine->SetAudioCodecs(audio_codecs);
|
fake_engine->SetAudioCodecs(audio_codecs);
|
||||||
|
|
||||||
std::vector<cricket::VideoCodec> video_codecs;
|
std::vector<cricket::Codec> video_codecs;
|
||||||
video_codecs.emplace_back(cricket::CreateVideoCodec(100, "bar"));
|
video_codecs.emplace_back(cricket::CreateVideoCodec(100, "bar"));
|
||||||
video_codecs.emplace_back(cricket::CreateVideoRtxCodec(101, 100));
|
video_codecs.emplace_back(cricket::CreateVideoRtxCodec(101, 100));
|
||||||
fake_engine->SetVideoCodecs(video_codecs);
|
fake_engine->SetVideoCodecs(video_codecs);
|
||||||
|
@ -2045,12 +2045,12 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan,
|
||||||
SetCodecPreferencesAvoidsPayloadTypeConflictInAnswer) {
|
SetCodecPreferencesAvoidsPayloadTypeConflictInAnswer) {
|
||||||
auto fake_engine = std::make_unique<cricket::FakeMediaEngine>();
|
auto fake_engine = std::make_unique<cricket::FakeMediaEngine>();
|
||||||
|
|
||||||
std::vector<cricket::AudioCodec> audio_codecs;
|
std::vector<cricket::Codec> audio_codecs;
|
||||||
audio_codecs.emplace_back(cricket::CreateAudioCodec(100, "foo", 0, 1));
|
audio_codecs.emplace_back(cricket::CreateAudioCodec(100, "foo", 0, 1));
|
||||||
audio_codecs.emplace_back(cricket::CreateAudioRtxCodec(101, 100));
|
audio_codecs.emplace_back(cricket::CreateAudioRtxCodec(101, 100));
|
||||||
fake_engine->SetAudioCodecs(audio_codecs);
|
fake_engine->SetAudioCodecs(audio_codecs);
|
||||||
|
|
||||||
std::vector<cricket::VideoCodec> video_codecs;
|
std::vector<cricket::Codec> video_codecs;
|
||||||
video_codecs.emplace_back(cricket::CreateVideoCodec(100, "bar"));
|
video_codecs.emplace_back(cricket::CreateVideoCodec(100, "bar"));
|
||||||
video_codecs.emplace_back(cricket::CreateVideoRtxCodec(101, 100));
|
video_codecs.emplace_back(cricket::CreateVideoRtxCodec(101, 100));
|
||||||
fake_engine->SetVideoCodecs(video_codecs);
|
fake_engine->SetVideoCodecs(video_codecs);
|
||||||
|
@ -2090,12 +2090,12 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan,
|
||||||
SetCodecPreferencesAvoidsPayloadTypeConflictInSubsequentOffer) {
|
SetCodecPreferencesAvoidsPayloadTypeConflictInSubsequentOffer) {
|
||||||
auto fake_engine = std::make_unique<cricket::FakeMediaEngine>();
|
auto fake_engine = std::make_unique<cricket::FakeMediaEngine>();
|
||||||
|
|
||||||
std::vector<cricket::AudioCodec> audio_codecs;
|
std::vector<cricket::Codec> audio_codecs;
|
||||||
audio_codecs.emplace_back(cricket::CreateAudioCodec(100, "foo", 0, 1));
|
audio_codecs.emplace_back(cricket::CreateAudioCodec(100, "foo", 0, 1));
|
||||||
audio_codecs.emplace_back(cricket::CreateAudioRtxCodec(101, 100));
|
audio_codecs.emplace_back(cricket::CreateAudioRtxCodec(101, 100));
|
||||||
fake_engine->SetAudioCodecs(audio_codecs);
|
fake_engine->SetAudioCodecs(audio_codecs);
|
||||||
|
|
||||||
std::vector<cricket::VideoCodec> video_codecs;
|
std::vector<cricket::Codec> video_codecs;
|
||||||
video_codecs.emplace_back(cricket::CreateVideoCodec(100, "bar"));
|
video_codecs.emplace_back(cricket::CreateVideoCodec(100, "bar"));
|
||||||
video_codecs.emplace_back(cricket::CreateVideoRtxCodec(101, 100));
|
video_codecs.emplace_back(cricket::CreateVideoRtxCodec(101, 100));
|
||||||
fake_engine->SetVideoCodecs(video_codecs);
|
fake_engine->SetVideoCodecs(video_codecs);
|
||||||
|
@ -2136,7 +2136,7 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan,
|
||||||
SetCodecPreferencesReceiveOnlyWithSendOnlyTransceiverStops) {
|
SetCodecPreferencesReceiveOnlyWithSendOnlyTransceiverStops) {
|
||||||
auto fake_engine = std::make_unique<cricket::FakeMediaEngine>();
|
auto fake_engine = std::make_unique<cricket::FakeMediaEngine>();
|
||||||
|
|
||||||
std::vector<cricket::AudioCodec> audio_codecs;
|
std::vector<cricket::Codec> audio_codecs;
|
||||||
audio_codecs.emplace_back(cricket::CreateAudioCodec(100, "foo", 0, 1));
|
audio_codecs.emplace_back(cricket::CreateAudioCodec(100, "foo", 0, 1));
|
||||||
fake_engine->SetAudioRecvCodecs(audio_codecs);
|
fake_engine->SetAudioRecvCodecs(audio_codecs);
|
||||||
|
|
||||||
|
|
|
@ -397,8 +397,7 @@ TEST(RtpParametersConversionTest, ToRtcpFeedbackErrors) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RtpParametersConversionTest, ToAudioRtpCodecCapability) {
|
TEST(RtpParametersConversionTest, ToAudioRtpCodecCapability) {
|
||||||
cricket::AudioCodec cricket_codec =
|
cricket::Codec cricket_codec = cricket::CreateAudioCodec(50, "foo", 22222, 4);
|
||||||
cricket::CreateAudioCodec(50, "foo", 22222, 4);
|
|
||||||
cricket_codec.params["foo"] = "bar";
|
cricket_codec.params["foo"] = "bar";
|
||||||
cricket_codec.feedback_params.Add(cricket::FeedbackParam("transport-cc"));
|
cricket_codec.feedback_params.Add(cricket::FeedbackParam("transport-cc"));
|
||||||
RtpCodecCapability codec = ToRtpCodecCapability(cricket_codec);
|
RtpCodecCapability codec = ToRtpCodecCapability(cricket_codec);
|
||||||
|
@ -416,7 +415,7 @@ TEST(RtpParametersConversionTest, ToAudioRtpCodecCapability) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RtpParametersConversionTest, ToVideoRtpCodecCapability) {
|
TEST(RtpParametersConversionTest, ToVideoRtpCodecCapability) {
|
||||||
cricket::VideoCodec cricket_codec = cricket::CreateVideoCodec(101, "VID");
|
cricket::Codec cricket_codec = cricket::CreateVideoCodec(101, "VID");
|
||||||
cricket_codec.clockrate = 80000;
|
cricket_codec.clockrate = 80000;
|
||||||
cricket_codec.params["foo"] = "bar";
|
cricket_codec.params["foo"] = "bar";
|
||||||
cricket_codec.params["ANOTHER"] = "param";
|
cricket_codec.params["ANOTHER"] = "param";
|
||||||
|
@ -464,8 +463,7 @@ TEST(RtpParametersConversionTest, ToRtpEncodingsWithMultipleStreamParams) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RtpParametersConversionTest, ToAudioRtpCodecParameters) {
|
TEST(RtpParametersConversionTest, ToAudioRtpCodecParameters) {
|
||||||
cricket::AudioCodec cricket_codec =
|
cricket::Codec cricket_codec = cricket::CreateAudioCodec(50, "foo", 22222, 4);
|
||||||
cricket::CreateAudioCodec(50, "foo", 22222, 4);
|
|
||||||
cricket_codec.params["foo"] = "bar";
|
cricket_codec.params["foo"] = "bar";
|
||||||
cricket_codec.feedback_params.Add(cricket::FeedbackParam("transport-cc"));
|
cricket_codec.feedback_params.Add(cricket::FeedbackParam("transport-cc"));
|
||||||
RtpCodecParameters codec = ToRtpCodecParameters(cricket_codec);
|
RtpCodecParameters codec = ToRtpCodecParameters(cricket_codec);
|
||||||
|
@ -483,7 +481,7 @@ TEST(RtpParametersConversionTest, ToAudioRtpCodecParameters) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RtpParametersConversionTest, ToVideoRtpCodecParameters) {
|
TEST(RtpParametersConversionTest, ToVideoRtpCodecParameters) {
|
||||||
cricket::VideoCodec cricket_codec = cricket::CreateVideoCodec(101, "VID");
|
cricket::Codec cricket_codec = cricket::CreateVideoCodec(101, "VID");
|
||||||
cricket_codec.clockrate = 80000;
|
cricket_codec.clockrate = 80000;
|
||||||
cricket_codec.params["foo"] = "bar";
|
cricket_codec.params["foo"] = "bar";
|
||||||
cricket_codec.params["ANOTHER"] = "param";
|
cricket_codec.params["ANOTHER"] = "param";
|
||||||
|
@ -509,8 +507,7 @@ TEST(RtpParametersConversionTest, ToVideoRtpCodecParameters) {
|
||||||
|
|
||||||
// An unknown feedback param should just be ignored.
|
// An unknown feedback param should just be ignored.
|
||||||
TEST(RtpParametersConversionTest, ToRtpCodecCapabilityUnknownFeedbackParam) {
|
TEST(RtpParametersConversionTest, ToRtpCodecCapabilityUnknownFeedbackParam) {
|
||||||
cricket::AudioCodec cricket_codec =
|
cricket::Codec cricket_codec = cricket::CreateAudioCodec(50, "foo", 22222, 4);
|
||||||
cricket::CreateAudioCodec(50, "foo", 22222, 4);
|
|
||||||
cricket_codec.params["foo"] = "bar";
|
cricket_codec.params["foo"] = "bar";
|
||||||
cricket_codec.feedback_params.Add({"unknown", "param"});
|
cricket_codec.feedback_params.Add({"unknown", "param"});
|
||||||
cricket_codec.feedback_params.Add(cricket::FeedbackParam("transport-cc"));
|
cricket_codec.feedback_params.Add(cricket::FeedbackParam("transport-cc"));
|
||||||
|
@ -525,21 +522,21 @@ TEST(RtpParametersConversionTest, ToRtpCodecCapabilityUnknownFeedbackParam) {
|
||||||
// test that the result of ToRtpCodecCapability ends up in the result, and that
|
// test that the result of ToRtpCodecCapability ends up in the result, and that
|
||||||
// the "fec" list is assembled correctly.
|
// the "fec" list is assembled correctly.
|
||||||
TEST(RtpParametersConversionTest, ToRtpCapabilities) {
|
TEST(RtpParametersConversionTest, ToRtpCapabilities) {
|
||||||
cricket::VideoCodec vp8 = cricket::CreateVideoCodec(101, "VP8");
|
cricket::Codec vp8 = cricket::CreateVideoCodec(101, "VP8");
|
||||||
vp8.clockrate = 90000;
|
vp8.clockrate = 90000;
|
||||||
|
|
||||||
cricket::VideoCodec red = cricket::CreateVideoCodec(102, "red");
|
cricket::Codec red = cricket::CreateVideoCodec(102, "red");
|
||||||
red.clockrate = 90000;
|
red.clockrate = 90000;
|
||||||
|
|
||||||
cricket::VideoCodec ulpfec = cricket::CreateVideoCodec(103, "ulpfec");
|
cricket::Codec ulpfec = cricket::CreateVideoCodec(103, "ulpfec");
|
||||||
ulpfec.clockrate = 90000;
|
ulpfec.clockrate = 90000;
|
||||||
|
|
||||||
cricket::VideoCodec flexfec = cricket::CreateVideoCodec(102, "flexfec-03");
|
cricket::Codec flexfec = cricket::CreateVideoCodec(102, "flexfec-03");
|
||||||
flexfec.clockrate = 90000;
|
flexfec.clockrate = 90000;
|
||||||
|
|
||||||
cricket::VideoCodec rtx = cricket::CreateVideoRtxCodec(014, 101);
|
cricket::Codec rtx = cricket::CreateVideoRtxCodec(014, 101);
|
||||||
|
|
||||||
cricket::VideoCodec rtx2 = cricket::CreateVideoRtxCodec(105, 109);
|
cricket::Codec rtx2 = cricket::CreateVideoRtxCodec(105, 109);
|
||||||
|
|
||||||
RtpCapabilities capabilities =
|
RtpCapabilities capabilities =
|
||||||
ToRtpCapabilities({vp8, ulpfec, rtx, rtx2}, {{"uri", 1}, {"uri2", 3}});
|
ToRtpCapabilities({vp8, ulpfec, rtx, rtx2}, {{"uri", 1}, {"uri2", 3}});
|
||||||
|
@ -570,13 +567,13 @@ TEST(RtpParametersConversionTest, ToRtpCapabilities) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RtpParametersConversionTest, ToRtpParameters) {
|
TEST(RtpParametersConversionTest, ToRtpParameters) {
|
||||||
cricket::VideoCodec vp8 = cricket::CreateVideoCodec(101, "VP8");
|
cricket::Codec vp8 = cricket::CreateVideoCodec(101, "VP8");
|
||||||
vp8.clockrate = 90000;
|
vp8.clockrate = 90000;
|
||||||
|
|
||||||
cricket::VideoCodec red = cricket::CreateVideoCodec(102, "red");
|
cricket::Codec red = cricket::CreateVideoCodec(102, "red");
|
||||||
red.clockrate = 90000;
|
red.clockrate = 90000;
|
||||||
|
|
||||||
cricket::VideoCodec ulpfec = cricket::CreateVideoCodec(103, "ulpfec");
|
cricket::Codec ulpfec = cricket::CreateVideoCodec(103, "ulpfec");
|
||||||
ulpfec.clockrate = 90000;
|
ulpfec.clockrate = 90000;
|
||||||
|
|
||||||
cricket::StreamParamsVec streams;
|
cricket::StreamParamsVec streams;
|
||||||
|
|
|
@ -174,7 +174,7 @@ class RtpSenderReceiverTest
|
||||||
// Needed to use DTMF sender.
|
// Needed to use DTMF sender.
|
||||||
void AddDtmfCodec() {
|
void AddDtmfCodec() {
|
||||||
cricket::AudioSenderParameter params;
|
cricket::AudioSenderParameter params;
|
||||||
const cricket::AudioCodec kTelephoneEventCodec =
|
const cricket::Codec kTelephoneEventCodec =
|
||||||
cricket::CreateAudioCodec(106, "telephone-event", 8000, 1);
|
cricket::CreateAudioCodec(106, "telephone-event", 8000, 1);
|
||||||
params.codecs.push_back(kTelephoneEventCodec);
|
params.codecs.push_back(kTelephoneEventCodec);
|
||||||
voice_media_send_channel()->SetSenderParameters(params);
|
voice_media_send_channel()->SetSenderParameters(params);
|
||||||
|
|
|
@ -68,10 +68,7 @@ class MockRtpSenderInternal : public RtpSenderInternal {
|
||||||
CheckCodecParameters,
|
CheckCodecParameters,
|
||||||
(const RtpParameters&),
|
(const RtpParameters&),
|
||||||
(override));
|
(override));
|
||||||
MOCK_METHOD(void,
|
MOCK_METHOD(void, SetSendCodecs, (std::vector<cricket::Codec>), (override));
|
||||||
SetSendCodecs,
|
|
||||||
(std::vector<cricket::VideoCodec>),
|
|
||||||
(override));
|
|
||||||
MOCK_METHOD(rtc::scoped_refptr<DtmfSenderInterface>,
|
MOCK_METHOD(rtc::scoped_refptr<DtmfSenderInterface>,
|
||||||
GetDtmfSender,
|
GetDtmfSender,
|
||||||
(),
|
(),
|
||||||
|
|
|
@ -3633,7 +3633,7 @@ bool ParseRtpmapAttribute(absl::string_view line,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (media_type == cricket::MEDIA_TYPE_VIDEO) {
|
if (media_type == cricket::MEDIA_TYPE_VIDEO) {
|
||||||
for (const cricket::VideoCodec& existing_codec : media_desc->codecs()) {
|
for (const cricket::Codec& existing_codec : media_desc->codecs()) {
|
||||||
if (!existing_codec.name.empty() && payload_type == existing_codec.id &&
|
if (!existing_codec.name.empty() && payload_type == existing_codec.id &&
|
||||||
(!absl::EqualsIgnoreCase(encoding_name, existing_codec.name) ||
|
(!absl::EqualsIgnoreCase(encoding_name, existing_codec.name) ||
|
||||||
clock_rate != existing_codec.clockrate)) {
|
clock_rate != existing_codec.clockrate)) {
|
||||||
|
@ -3664,7 +3664,7 @@ bool ParseRtpmapAttribute(absl::string_view line,
|
||||||
return ParseFailed(line, "At most 24 channels are supported.", error);
|
return ParseFailed(line, "At most 24 channels are supported.", error);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const cricket::AudioCodec& existing_codec : media_desc->codecs()) {
|
for (const cricket::Codec& existing_codec : media_desc->codecs()) {
|
||||||
// TODO(crbug.com/1338902) re-add checks for clockrate and number of
|
// TODO(crbug.com/1338902) re-add checks for clockrate and number of
|
||||||
// channels.
|
// channels.
|
||||||
if (!existing_codec.name.empty() && payload_type == existing_codec.id &&
|
if (!existing_codec.name.empty() && payload_type == existing_codec.id &&
|
||||||
|
|
|
@ -1880,15 +1880,15 @@ class WebRtcSdpTest : public ::testing::Test {
|
||||||
GetFirstVideoContentDescription(jdesc_output->description());
|
GetFirstVideoContentDescription(jdesc_output->description());
|
||||||
ASSERT_TRUE(vcd);
|
ASSERT_TRUE(vcd);
|
||||||
ASSERT_FALSE(vcd->codecs().empty());
|
ASSERT_FALSE(vcd->codecs().empty());
|
||||||
cricket::VideoCodec vp8 = vcd->codecs()[0];
|
cricket::Codec vp8 = vcd->codecs()[0];
|
||||||
EXPECT_EQ("VP8", vp8.name);
|
EXPECT_EQ("VP8", vp8.name);
|
||||||
EXPECT_EQ(99, vp8.id);
|
EXPECT_EQ(99, vp8.id);
|
||||||
cricket::VideoCodec rtx = vcd->codecs()[1];
|
cricket::Codec rtx = vcd->codecs()[1];
|
||||||
EXPECT_EQ("RTX", rtx.name);
|
EXPECT_EQ("RTX", rtx.name);
|
||||||
EXPECT_EQ(95, rtx.id);
|
EXPECT_EQ(95, rtx.id);
|
||||||
VerifyCodecParameter(rtx.params, "apt", vp8.id);
|
VerifyCodecParameter(rtx.params, "apt", vp8.id);
|
||||||
// VP9 is listed last in the m= line so should come after VP8 and RTX.
|
// VP9 is listed last in the m= line so should come after VP8 and RTX.
|
||||||
cricket::VideoCodec vp9 = vcd->codecs()[2];
|
cricket::Codec vp9 = vcd->codecs()[2];
|
||||||
EXPECT_EQ("VP9", vp9.name);
|
EXPECT_EQ("VP9", vp9.name);
|
||||||
EXPECT_EQ(96, vp9.id);
|
EXPECT_EQ(96, vp9.id);
|
||||||
}
|
}
|
||||||
|
@ -1935,7 +1935,7 @@ class WebRtcSdpTest : public ::testing::Test {
|
||||||
GetFirstVideoContentDescription(jdesc_output->description());
|
GetFirstVideoContentDescription(jdesc_output->description());
|
||||||
ASSERT_TRUE(vcd);
|
ASSERT_TRUE(vcd);
|
||||||
ASSERT_FALSE(vcd->codecs().empty());
|
ASSERT_FALSE(vcd->codecs().empty());
|
||||||
cricket::VideoCodec vp8 = vcd->codecs()[0];
|
cricket::Codec vp8 = vcd->codecs()[0];
|
||||||
EXPECT_EQ(vp8.name, "VP8");
|
EXPECT_EQ(vp8.name, "VP8");
|
||||||
EXPECT_EQ(101, vp8.id);
|
EXPECT_EQ(101, vp8.id);
|
||||||
EXPECT_TRUE(vp8.HasFeedbackParam(cricket::FeedbackParam(
|
EXPECT_TRUE(vp8.HasFeedbackParam(cricket::FeedbackParam(
|
||||||
|
@ -2280,7 +2280,7 @@ TEST_F(WebRtcSdpTest, ParseSslTcpCandidate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithH264) {
|
TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithH264) {
|
||||||
cricket::VideoCodec h264_codec = cricket::CreateVideoCodec("H264");
|
cricket::Codec h264_codec = cricket::CreateVideoCodec("H264");
|
||||||
h264_codec.SetParam("profile-level-id", "42e01f");
|
h264_codec.SetParam("profile-level-id", "42e01f");
|
||||||
h264_codec.SetParam("level-asymmetry-allowed", "1");
|
h264_codec.SetParam("level-asymmetry-allowed", "1");
|
||||||
h264_codec.SetParam("packetization-mode", "1");
|
h264_codec.SetParam("packetization-mode", "1");
|
||||||
|
@ -2368,7 +2368,7 @@ TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithoutRtpmap) {
|
||||||
EXPECT_TRUE(SdpDeserialize(kSdpNoRtpmapString, &jdesc));
|
EXPECT_TRUE(SdpDeserialize(kSdpNoRtpmapString, &jdesc));
|
||||||
cricket::AudioContentDescription* audio =
|
cricket::AudioContentDescription* audio =
|
||||||
cricket::GetFirstAudioContentDescription(jdesc.description());
|
cricket::GetFirstAudioContentDescription(jdesc.description());
|
||||||
cricket::AudioCodecs ref_codecs;
|
cricket::Codecs ref_codecs;
|
||||||
// The codecs in the AudioContentDescription should be in the same order as
|
// The codecs in the AudioContentDescription should be in the same order as
|
||||||
// the payload types (<fmt>s) on the m= line.
|
// the payload types (<fmt>s) on the m= line.
|
||||||
ref_codecs.push_back(cricket::CreateAudioCodec(0, "PCMU", 8000, 1));
|
ref_codecs.push_back(cricket::CreateAudioCodec(0, "PCMU", 8000, 1));
|
||||||
|
@ -3232,7 +3232,7 @@ TEST_F(WebRtcSdpTest, DeserializeVideoFmtp) {
|
||||||
GetFirstVideoContentDescription(jdesc_output.description());
|
GetFirstVideoContentDescription(jdesc_output.description());
|
||||||
ASSERT_TRUE(vcd);
|
ASSERT_TRUE(vcd);
|
||||||
ASSERT_FALSE(vcd->codecs().empty());
|
ASSERT_FALSE(vcd->codecs().empty());
|
||||||
cricket::VideoCodec vp8 = vcd->codecs()[0];
|
cricket::Codec vp8 = vcd->codecs()[0];
|
||||||
EXPECT_EQ("VP8", vp8.name);
|
EXPECT_EQ("VP8", vp8.name);
|
||||||
EXPECT_EQ(120, vp8.id);
|
EXPECT_EQ(120, vp8.id);
|
||||||
webrtc::CodecParameterMap::iterator found =
|
webrtc::CodecParameterMap::iterator found =
|
||||||
|
@ -3266,7 +3266,7 @@ TEST_F(WebRtcSdpTest, DeserializeVideoFmtpWithSprops) {
|
||||||
GetFirstVideoContentDescription(jdesc_output.description());
|
GetFirstVideoContentDescription(jdesc_output.description());
|
||||||
ASSERT_TRUE(vcd);
|
ASSERT_TRUE(vcd);
|
||||||
ASSERT_FALSE(vcd->codecs().empty());
|
ASSERT_FALSE(vcd->codecs().empty());
|
||||||
cricket::VideoCodec h264 = vcd->codecs()[0];
|
cricket::Codec h264 = vcd->codecs()[0];
|
||||||
EXPECT_EQ("H264", h264.name);
|
EXPECT_EQ("H264", h264.name);
|
||||||
EXPECT_EQ(98, h264.id);
|
EXPECT_EQ(98, h264.id);
|
||||||
webrtc::CodecParameterMap::const_iterator found =
|
webrtc::CodecParameterMap::const_iterator found =
|
||||||
|
@ -3299,7 +3299,7 @@ TEST_F(WebRtcSdpTest, DeserializeVideoFmtpWithSpace) {
|
||||||
GetFirstVideoContentDescription(jdesc_output.description());
|
GetFirstVideoContentDescription(jdesc_output.description());
|
||||||
ASSERT_TRUE(vcd);
|
ASSERT_TRUE(vcd);
|
||||||
ASSERT_FALSE(vcd->codecs().empty());
|
ASSERT_FALSE(vcd->codecs().empty());
|
||||||
cricket::VideoCodec vp8 = vcd->codecs()[0];
|
cricket::Codec vp8 = vcd->codecs()[0];
|
||||||
EXPECT_EQ("VP8", vp8.name);
|
EXPECT_EQ("VP8", vp8.name);
|
||||||
EXPECT_EQ(120, vp8.id);
|
EXPECT_EQ(120, vp8.id);
|
||||||
webrtc::CodecParameterMap::iterator found =
|
webrtc::CodecParameterMap::iterator found =
|
||||||
|
@ -3345,15 +3345,15 @@ TEST_F(WebRtcSdpTest, DeserializePacketizationAttributeWithIllegalValue) {
|
||||||
GetFirstVideoContentDescription(jdesc_output.description());
|
GetFirstVideoContentDescription(jdesc_output.description());
|
||||||
ASSERT_TRUE(vcd);
|
ASSERT_TRUE(vcd);
|
||||||
ASSERT_THAT(vcd->codecs(), testing::SizeIs(3));
|
ASSERT_THAT(vcd->codecs(), testing::SizeIs(3));
|
||||||
cricket::VideoCodec vp8 = vcd->codecs()[0];
|
cricket::Codec vp8 = vcd->codecs()[0];
|
||||||
EXPECT_EQ(vp8.name, "VP8");
|
EXPECT_EQ(vp8.name, "VP8");
|
||||||
EXPECT_EQ(vp8.id, 120);
|
EXPECT_EQ(vp8.id, 120);
|
||||||
EXPECT_EQ(vp8.packetization, "raw");
|
EXPECT_EQ(vp8.packetization, "raw");
|
||||||
cricket::VideoCodec vp9 = vcd->codecs()[1];
|
cricket::Codec vp9 = vcd->codecs()[1];
|
||||||
EXPECT_EQ(vp9.name, "VP9");
|
EXPECT_EQ(vp9.name, "VP9");
|
||||||
EXPECT_EQ(vp9.id, 121);
|
EXPECT_EQ(vp9.id, 121);
|
||||||
EXPECT_EQ(vp9.packetization, absl::nullopt);
|
EXPECT_EQ(vp9.packetization, absl::nullopt);
|
||||||
cricket::VideoCodec h264 = vcd->codecs()[2];
|
cricket::Codec h264 = vcd->codecs()[2];
|
||||||
EXPECT_EQ(h264.name, "H264");
|
EXPECT_EQ(h264.name, "H264");
|
||||||
EXPECT_EQ(h264.id, 122);
|
EXPECT_EQ(h264.id, 122);
|
||||||
EXPECT_EQ(h264.packetization, absl::nullopt);
|
EXPECT_EQ(h264.packetization, absl::nullopt);
|
||||||
|
@ -3362,7 +3362,7 @@ TEST_F(WebRtcSdpTest, DeserializePacketizationAttributeWithIllegalValue) {
|
||||||
TEST_F(WebRtcSdpTest, SerializeAudioFmtpWithUnknownParameter) {
|
TEST_F(WebRtcSdpTest, SerializeAudioFmtpWithUnknownParameter) {
|
||||||
AudioContentDescription* acd = GetFirstAudioContentDescription(&desc_);
|
AudioContentDescription* acd = GetFirstAudioContentDescription(&desc_);
|
||||||
|
|
||||||
cricket::AudioCodecs codecs = acd->codecs();
|
cricket::Codecs codecs = acd->codecs();
|
||||||
codecs[0].params["unknown-future-parameter"] = "SomeFutureValue";
|
codecs[0].params["unknown-future-parameter"] = "SomeFutureValue";
|
||||||
acd->set_codecs(codecs);
|
acd->set_codecs(codecs);
|
||||||
|
|
||||||
|
@ -3379,7 +3379,7 @@ TEST_F(WebRtcSdpTest, SerializeAudioFmtpWithUnknownParameter) {
|
||||||
TEST_F(WebRtcSdpTest, SerializeAudioFmtpWithKnownFmtpParameter) {
|
TEST_F(WebRtcSdpTest, SerializeAudioFmtpWithKnownFmtpParameter) {
|
||||||
AudioContentDescription* acd = GetFirstAudioContentDescription(&desc_);
|
AudioContentDescription* acd = GetFirstAudioContentDescription(&desc_);
|
||||||
|
|
||||||
cricket::AudioCodecs codecs = acd->codecs();
|
cricket::Codecs codecs = acd->codecs();
|
||||||
codecs[0].params["stereo"] = "1";
|
codecs[0].params["stereo"] = "1";
|
||||||
acd->set_codecs(codecs);
|
acd->set_codecs(codecs);
|
||||||
|
|
||||||
|
@ -3395,7 +3395,7 @@ TEST_F(WebRtcSdpTest, SerializeAudioFmtpWithKnownFmtpParameter) {
|
||||||
TEST_F(WebRtcSdpTest, SerializeAudioFmtpWithPTimeAndMaxPTime) {
|
TEST_F(WebRtcSdpTest, SerializeAudioFmtpWithPTimeAndMaxPTime) {
|
||||||
AudioContentDescription* acd = GetFirstAudioContentDescription(&desc_);
|
AudioContentDescription* acd = GetFirstAudioContentDescription(&desc_);
|
||||||
|
|
||||||
cricket::AudioCodecs codecs = acd->codecs();
|
cricket::Codecs codecs = acd->codecs();
|
||||||
codecs[0].params["ptime"] = "20";
|
codecs[0].params["ptime"] = "20";
|
||||||
codecs[0].params["maxptime"] = "120";
|
codecs[0].params["maxptime"] = "120";
|
||||||
acd->set_codecs(codecs);
|
acd->set_codecs(codecs);
|
||||||
|
@ -3414,7 +3414,7 @@ TEST_F(WebRtcSdpTest, SerializeAudioFmtpWithPTimeAndMaxPTime) {
|
||||||
TEST_F(WebRtcSdpTest, SerializeAudioFmtpWithTelephoneEvent) {
|
TEST_F(WebRtcSdpTest, SerializeAudioFmtpWithTelephoneEvent) {
|
||||||
AudioContentDescription* acd = GetFirstAudioContentDescription(&desc_);
|
AudioContentDescription* acd = GetFirstAudioContentDescription(&desc_);
|
||||||
|
|
||||||
cricket::AudioCodecs codecs = acd->codecs();
|
cricket::Codecs codecs = acd->codecs();
|
||||||
cricket::Codec dtmf =
|
cricket::Codec dtmf =
|
||||||
cricket::CreateAudioCodec(105, "telephone-event", 8000, 1);
|
cricket::CreateAudioCodec(105, "telephone-event", 8000, 1);
|
||||||
dtmf.params[""] = "0-15";
|
dtmf.params[""] = "0-15";
|
||||||
|
@ -3437,7 +3437,7 @@ TEST_F(WebRtcSdpTest, SerializeAudioFmtpWithTelephoneEvent) {
|
||||||
TEST_F(WebRtcSdpTest, SerializeVideoFmtp) {
|
TEST_F(WebRtcSdpTest, SerializeVideoFmtp) {
|
||||||
VideoContentDescription* vcd = GetFirstVideoContentDescription(&desc_);
|
VideoContentDescription* vcd = GetFirstVideoContentDescription(&desc_);
|
||||||
|
|
||||||
cricket::VideoCodecs codecs = vcd->codecs();
|
cricket::Codecs codecs = vcd->codecs();
|
||||||
codecs[0].params["x-google-min-bitrate"] = "10";
|
codecs[0].params["x-google-min-bitrate"] = "10";
|
||||||
vcd->set_codecs(codecs);
|
vcd->set_codecs(codecs);
|
||||||
|
|
||||||
|
@ -3453,7 +3453,7 @@ TEST_F(WebRtcSdpTest, SerializeVideoFmtp) {
|
||||||
TEST_F(WebRtcSdpTest, SerializeVideoPacketizationAttribute) {
|
TEST_F(WebRtcSdpTest, SerializeVideoPacketizationAttribute) {
|
||||||
VideoContentDescription* vcd = GetFirstVideoContentDescription(&desc_);
|
VideoContentDescription* vcd = GetFirstVideoContentDescription(&desc_);
|
||||||
|
|
||||||
cricket::VideoCodecs codecs = vcd->codecs();
|
cricket::Codecs codecs = vcd->codecs();
|
||||||
codecs[0].packetization = "raw";
|
codecs[0].packetization = "raw";
|
||||||
vcd->set_codecs(codecs);
|
vcd->set_codecs(codecs);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue