Remove CodecInst pt.1
Update audio_coding tests to not use CodecInst. Bug: webrtc:7626 Change-Id: I880fb8d72d7d0a915d274e67feb6106f023697c2 Reviewed-on: https://webrtc-review.googlesource.com/c/112594 Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25879}
This commit is contained in:
committed by
Commit Bot
parent
450b548cad
commit
056f9738bf
@ -30,6 +30,7 @@ void ReceiverWithPacketLoss::Setup(AudioCodingModule* acm,
|
||||
RTPStream* rtpStream,
|
||||
std::string out_file_name,
|
||||
int channels,
|
||||
int file_num,
|
||||
int loss_rate,
|
||||
int burst_length) {
|
||||
loss_rate_ = loss_rate;
|
||||
@ -37,7 +38,7 @@ void ReceiverWithPacketLoss::Setup(AudioCodingModule* acm,
|
||||
burst_lost_counter_ = burst_length_; // To prevent first packet gets lost.
|
||||
rtc::StringBuilder ss;
|
||||
ss << out_file_name << "_" << loss_rate_ << "_" << burst_length_ << "_";
|
||||
Receiver::Setup(acm, rtpStream, ss.str(), channels);
|
||||
Receiver::Setup(acm, rtpStream, ss.str(), channels, file_num);
|
||||
}
|
||||
|
||||
bool ReceiverWithPacketLoss::IncomingPacket() {
|
||||
@ -89,10 +90,11 @@ SenderWithFEC::SenderWithFEC() : expected_loss_rate_(0) {}
|
||||
void SenderWithFEC::Setup(AudioCodingModule* acm,
|
||||
RTPStream* rtpStream,
|
||||
std::string in_file_name,
|
||||
int sample_rate,
|
||||
int channels,
|
||||
int payload_type,
|
||||
SdpAudioFormat format,
|
||||
int expected_loss_rate) {
|
||||
Sender::Setup(acm, rtpStream, in_file_name, sample_rate, channels);
|
||||
Sender::Setup(acm, rtpStream, in_file_name, format.clockrate_hz, payload_type,
|
||||
format);
|
||||
EXPECT_TRUE(SetFEC(true));
|
||||
EXPECT_TRUE(SetPacketLossRate(expected_loss_rate));
|
||||
}
|
||||
@ -123,8 +125,6 @@ PacketLossTest::PacketLossTest(int channels,
|
||||
in_file_name_(channels_ == 1 ? "audio_coding/testfile32kHz"
|
||||
: "audio_coding/teststereo32kHz"),
|
||||
sample_rate_hz_(32000),
|
||||
sender_(new SenderWithFEC),
|
||||
receiver_(new ReceiverWithPacketLoss),
|
||||
expected_loss_rate_(expected_loss_rate),
|
||||
actual_loss_rate_(actual_loss_rate),
|
||||
burst_length_(burst_length) {}
|
||||
@ -133,40 +133,32 @@ void PacketLossTest::Perform() {
|
||||
#ifndef WEBRTC_CODEC_OPUS
|
||||
return;
|
||||
#else
|
||||
AudioCodingModule::Config config;
|
||||
config.decoder_factory = CreateBuiltinAudioDecoderFactory();
|
||||
std::unique_ptr<AudioCodingModule> acm(AudioCodingModule::Create(config));
|
||||
|
||||
int codec_id = acm->Codec("opus", 48000, channels_);
|
||||
|
||||
RTPFile rtpFile;
|
||||
std::unique_ptr<AudioCodingModule> acm(AudioCodingModule::Create(
|
||||
AudioCodingModule::Config(CreateBuiltinAudioDecoderFactory())));
|
||||
SdpAudioFormat send_format = SdpAudioFormat("opus", 48000, 2);
|
||||
if (channels_ == 2) {
|
||||
send_format.parameters = {{"stereo", "1"}};
|
||||
}
|
||||
|
||||
std::string fileName = webrtc::test::TempFilename(webrtc::test::OutputPath(),
|
||||
"packet_loss_test");
|
||||
|
||||
// Encode to file
|
||||
rtpFile.Open(fileName.c_str(), "wb+");
|
||||
rtpFile.WriteHeader();
|
||||
|
||||
sender_->codeId = codec_id;
|
||||
|
||||
sender_->Setup(acm.get(), &rtpFile, in_file_name_, sample_rate_hz_, channels_,
|
||||
SenderWithFEC sender;
|
||||
sender.Setup(acm.get(), &rtpFile, in_file_name_, 120, send_format,
|
||||
expected_loss_rate_);
|
||||
if (acm->SendCodec()) {
|
||||
sender_->Run();
|
||||
}
|
||||
sender_->Teardown();
|
||||
sender.Run();
|
||||
sender.Teardown();
|
||||
rtpFile.Close();
|
||||
|
||||
// Decode to file
|
||||
rtpFile.Open(fileName.c_str(), "rb");
|
||||
rtpFile.ReadHeader();
|
||||
|
||||
receiver_->codeId = codec_id;
|
||||
|
||||
receiver_->Setup(acm.get(), &rtpFile, "packetLoss_out", channels_,
|
||||
ReceiverWithPacketLoss receiver;
|
||||
receiver.Setup(acm.get(), &rtpFile, "packetLoss_out", channels_, 15,
|
||||
actual_loss_rate_, burst_length_);
|
||||
receiver_->Run();
|
||||
receiver_->Teardown();
|
||||
receiver.Run();
|
||||
receiver.Teardown();
|
||||
rtpFile.Close();
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user