Add PeerConnection GetRtpSender/ReceiverCapabilities
Those are static functions in the spec, so implemented as member functions of the PeerConnectionFactory instead. Bug: webrtc:7577, webrtc:9441 Change-Id: Iccb24180e096e713d24e7e25ecfd5d7bbd7638f9 Reviewed-on: https://webrtc-review.googlesource.com/85341 Commit-Queue: Florent Castelli <orphis@webrtc.org> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23768}
This commit is contained in:

committed by
Commit Bot

parent
0d4070a18c
commit
72b751af0b
@ -130,6 +130,19 @@ class PeerConnectionFactoryTest : public testing::Test {
|
||||
}
|
||||
}
|
||||
|
||||
void VerifyAudioCodecCapability(const webrtc::RtpCodecCapability& codec) {
|
||||
EXPECT_EQ(codec.kind, cricket::MEDIA_TYPE_AUDIO);
|
||||
EXPECT_FALSE(codec.name.empty());
|
||||
EXPECT_GT(codec.clock_rate, 0);
|
||||
EXPECT_GT(codec.num_channels, 0);
|
||||
}
|
||||
|
||||
void VerifyVideoCodecCapability(const webrtc::RtpCodecCapability& codec) {
|
||||
EXPECT_EQ(codec.kind, cricket::MEDIA_TYPE_VIDEO);
|
||||
EXPECT_FALSE(codec.name.empty());
|
||||
EXPECT_GT(codec.clock_rate, 0);
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<PeerConnectionFactoryInterface> factory_;
|
||||
NullPeerConnectionObserver observer_;
|
||||
std::unique_ptr<cricket::FakePortAllocator> port_allocator_;
|
||||
@ -170,6 +183,72 @@ TEST(PeerConnectionFactoryTestInternal, DISABLED_CreatePCUsingInternalModules) {
|
||||
EXPECT_TRUE(pc.get() != nullptr);
|
||||
}
|
||||
|
||||
TEST_F(PeerConnectionFactoryTest, CheckRtpSenderAudioCapabilities) {
|
||||
webrtc::RtpCapabilities audio_capabilities =
|
||||
factory_->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_AUDIO);
|
||||
EXPECT_FALSE(audio_capabilities.codecs.empty());
|
||||
for (const auto& codec : audio_capabilities.codecs) {
|
||||
VerifyAudioCodecCapability(codec);
|
||||
}
|
||||
EXPECT_FALSE(audio_capabilities.header_extensions.empty());
|
||||
for (const auto& header_extension : audio_capabilities.header_extensions) {
|
||||
EXPECT_FALSE(header_extension.uri.empty());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(PeerConnectionFactoryTest, CheckRtpSenderVideoCapabilities) {
|
||||
webrtc::RtpCapabilities video_capabilities =
|
||||
factory_->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_VIDEO);
|
||||
EXPECT_FALSE(video_capabilities.codecs.empty());
|
||||
for (const auto& codec : video_capabilities.codecs) {
|
||||
VerifyVideoCodecCapability(codec);
|
||||
}
|
||||
EXPECT_FALSE(video_capabilities.header_extensions.empty());
|
||||
for (const auto& header_extension : video_capabilities.header_extensions) {
|
||||
EXPECT_FALSE(header_extension.uri.empty());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(PeerConnectionFactoryTest, CheckRtpSenderDataCapabilities) {
|
||||
webrtc::RtpCapabilities data_capabilities =
|
||||
factory_->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_DATA);
|
||||
EXPECT_TRUE(data_capabilities.codecs.empty());
|
||||
EXPECT_TRUE(data_capabilities.header_extensions.empty());
|
||||
}
|
||||
|
||||
TEST_F(PeerConnectionFactoryTest, CheckRtpReceiverAudioCapabilities) {
|
||||
webrtc::RtpCapabilities audio_capabilities =
|
||||
factory_->GetRtpReceiverCapabilities(cricket::MEDIA_TYPE_AUDIO);
|
||||
EXPECT_FALSE(audio_capabilities.codecs.empty());
|
||||
for (const auto& codec : audio_capabilities.codecs) {
|
||||
VerifyAudioCodecCapability(codec);
|
||||
}
|
||||
EXPECT_FALSE(audio_capabilities.header_extensions.empty());
|
||||
for (const auto& header_extension : audio_capabilities.header_extensions) {
|
||||
EXPECT_FALSE(header_extension.uri.empty());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(PeerConnectionFactoryTest, CheckRtpReceiverVideoCapabilities) {
|
||||
webrtc::RtpCapabilities video_capabilities =
|
||||
factory_->GetRtpReceiverCapabilities(cricket::MEDIA_TYPE_VIDEO);
|
||||
EXPECT_FALSE(video_capabilities.codecs.empty());
|
||||
for (const auto& codec : video_capabilities.codecs) {
|
||||
VerifyVideoCodecCapability(codec);
|
||||
}
|
||||
EXPECT_FALSE(video_capabilities.header_extensions.empty());
|
||||
for (const auto& header_extension : video_capabilities.header_extensions) {
|
||||
EXPECT_FALSE(header_extension.uri.empty());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(PeerConnectionFactoryTest, CheckRtpReceiverDataCapabilities) {
|
||||
webrtc::RtpCapabilities data_capabilities =
|
||||
factory_->GetRtpReceiverCapabilities(cricket::MEDIA_TYPE_DATA);
|
||||
EXPECT_TRUE(data_capabilities.codecs.empty());
|
||||
EXPECT_TRUE(data_capabilities.header_extensions.empty());
|
||||
}
|
||||
|
||||
// This test verifies creation of PeerConnection with valid STUN and TURN
|
||||
// configuration. Also verifies the URL's parsed correctly as expected.
|
||||
TEST_F(PeerConnectionFactoryTest, CreatePCUsingIceServers) {
|
||||
|
Reference in New Issue
Block a user