RTPPayloadRegistry: Use SdpAudioFormat to represent audio codecs

This is needed in the general case, now that we aim to support codecs
other than those built-in to WebRTC.

BUG=webrtc:8159

Change-Id: I40a41252bf69ad5d4d0208e3c1e8918da7394706
Reviewed-on: https://webrtc-review.googlesource.com/5380
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20136}
This commit is contained in:
Karl Wiberg
2017-10-04 12:38:53 +02:00
committed by Commit Bot
parent 83ccca1864
commit c62f6c7121
22 changed files with 205 additions and 259 deletions

View File

@ -51,12 +51,8 @@ class RtpReceiverTest : public ::testing::Test {
&mock_rtp_data_,
nullptr,
&rtp_payload_registry_)) {
CodecInst voice_codec = {};
voice_codec.pltype = kPcmuPayloadType;
voice_codec.plfreq = 8000;
voice_codec.rate = kTestRate;
memcpy(voice_codec.plname, "PCMU", 5);
rtp_receiver_->RegisterReceivePayload(voice_codec);
rtp_receiver_->RegisterReceivePayload(kPcmuPayloadType,
SdpAudioFormat("PCMU", 8000, 1));
}
~RtpReceiverTest() {}
@ -90,7 +86,8 @@ TEST_F(RtpReceiverTest, GetSources) {
header.numCSRCs = 2;
header.arrOfCSRCs[0] = kCsrc1;
header.arrOfCSRCs[1] = kCsrc2;
const PayloadUnion payload_specific{AudioPayload()};
const PayloadUnion payload_specific{
AudioPayload{SdpAudioFormat("foo", 8000, 1), 0}};
EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(
header, kTestPayload, sizeof(kTestPayload), payload_specific, !kInOrder));
@ -140,7 +137,8 @@ TEST_F(RtpReceiverTest, GetSourcesChangeSSRC) {
header.payloadType = kPcmuPayloadType;
header.ssrc = kSsrc1;
header.timestamp = rtp_timestamp(now_ms);
const PayloadUnion payload_specific{AudioPayload()};
const PayloadUnion payload_specific{
AudioPayload{SdpAudioFormat("foo", 8000, 1), 0}};
EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(
header, kTestPayload, sizeof(kTestPayload), payload_specific, !kInOrder));
@ -191,7 +189,8 @@ TEST_F(RtpReceiverTest, GetSourcesRemoveOutdatedSource) {
RTPHeader header;
header.payloadType = kPcmuPayloadType;
header.timestamp = rtp_timestamp(now_ms);
const PayloadUnion payload_specific{AudioPayload()};
const PayloadUnion payload_specific{
AudioPayload{SdpAudioFormat("foo", 8000, 1), 0}};
header.numCSRCs = 1;
size_t kSourceListSize = 20;
@ -265,7 +264,8 @@ TEST_F(RtpReceiverTest, GetSourcesContainsAudioLevelExtension) {
header.timestamp = rtp_timestamp(time1_ms);
header.extension.hasAudioLevel = true;
header.extension.audioLevel = 10;
const PayloadUnion payload_specific{AudioPayload()};
const PayloadUnion payload_specific{
AudioPayload{SdpAudioFormat("foo", 8000, 1), 0}};
EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(
header, kTestPayload, sizeof(kTestPayload), payload_specific, !kInOrder));
@ -317,7 +317,8 @@ TEST_F(RtpReceiverTest,
header.timestamp = rtp_timestamp(time1_ms);
header.extension.hasAudioLevel = true;
header.extension.audioLevel = 10;
const PayloadUnion payload_specific{AudioPayload()};
const PayloadUnion payload_specific{
AudioPayload{SdpAudioFormat("foo", 8000, 1), 0}};
EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(
header, kTestPayload, sizeof(kTestPayload), payload_specific, !kInOrder));