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:
@ -13,6 +13,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "modules/audio_coding/codecs/audio_format_conversion.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_receiver_audio.h"
|
||||
@ -70,10 +71,8 @@ class VerifyingAudioReceiver : public RtpData {
|
||||
|
||||
class RTPCallback : public NullRtpFeedback {
|
||||
public:
|
||||
int32_t OnInitializeDecoder(int8_t payloadType,
|
||||
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
|
||||
int frequency,
|
||||
size_t channels,
|
||||
int32_t OnInitializeDecoder(int payload_type,
|
||||
const SdpAudioFormat& audio_format,
|
||||
uint32_t rate) override {
|
||||
EXPECT_EQ(0u, rate) << "The rate should be zero";
|
||||
return 0;
|
||||
@ -129,9 +128,11 @@ class RtpRtcpAudioTest : public ::testing::Test {
|
||||
|
||||
void RegisterPayload(const CodecInst& codec) {
|
||||
EXPECT_EQ(0, module1->RegisterSendPayload(codec));
|
||||
EXPECT_EQ(0, rtp_receiver1_->RegisterReceivePayload(codec));
|
||||
EXPECT_EQ(0, rtp_receiver1_->RegisterReceivePayload(codec.pltype,
|
||||
CodecInstToSdp(codec)));
|
||||
EXPECT_EQ(0, module2->RegisterSendPayload(codec));
|
||||
EXPECT_EQ(0, rtp_receiver2_->RegisterReceivePayload(codec));
|
||||
EXPECT_EQ(0, rtp_receiver2_->RegisterReceivePayload(codec.pltype,
|
||||
CodecInstToSdp(codec)));
|
||||
}
|
||||
|
||||
VerifyingAudioReceiver data_receiver1;
|
||||
@ -210,7 +211,8 @@ TEST_F(RtpRtcpAudioTest, DTMF) {
|
||||
memcpy(voice_codec.plname, "telephone-event", 16);
|
||||
|
||||
EXPECT_EQ(0, module1->RegisterSendPayload(voice_codec));
|
||||
EXPECT_EQ(0, rtp_receiver2_->RegisterReceivePayload(voice_codec));
|
||||
EXPECT_EQ(0, rtp_receiver2_->RegisterReceivePayload(
|
||||
voice_codec.pltype, CodecInstToSdp(voice_codec)));
|
||||
|
||||
// Start DTMF test.
|
||||
int timeStamp = 160;
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "modules/audio_coding/codecs/audio_format_conversion.h"
|
||||
#include "modules/rtp_rtcp/include/receive_statistics.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
@ -133,9 +134,11 @@ class RtpRtcpRtcpTest : public ::testing::Test {
|
||||
memcpy(voice_codec.plname, "PCMU", 5);
|
||||
|
||||
EXPECT_EQ(0, module1->RegisterSendPayload(voice_codec));
|
||||
EXPECT_EQ(0, rtp_receiver1_->RegisterReceivePayload(voice_codec));
|
||||
EXPECT_EQ(0, rtp_receiver1_->RegisterReceivePayload(
|
||||
voice_codec.pltype, CodecInstToSdp(voice_codec)));
|
||||
EXPECT_EQ(0, module2->RegisterSendPayload(voice_codec));
|
||||
EXPECT_EQ(0, rtp_receiver2_->RegisterReceivePayload(voice_codec));
|
||||
EXPECT_EQ(0, rtp_receiver2_->RegisterReceivePayload(
|
||||
voice_codec.pltype, CodecInstToSdp(voice_codec)));
|
||||
|
||||
// We need to send one RTP packet to get the RTCP packet to be accepted by
|
||||
// the receiving module.
|
||||
|
||||
Reference in New Issue
Block a user