NetEq: Add codec name and RTP timestamp rate to DecoderInfo

The new fields are default-populated for built-in decoders, but for
external decoders, the name can now be given when registering the
decoder.

BUG=webrtc:3520

Review URL: https://codereview.webrtc.org/1484343003

Cr-Commit-Position: refs/heads/master@{#10952}
This commit is contained in:
henrik.lundin
2015-12-09 06:20:58 -08:00
committed by Commit bot
parent 3980d46960
commit 4cf61dd116
26 changed files with 232 additions and 151 deletions

View File

@ -29,8 +29,9 @@ NetEqExternalDecoderTest::NetEqExternalDecoderTest(NetEqDecoder codec,
}
void NetEqExternalDecoderTest::Init() {
ASSERT_EQ(NetEq::kOK, neteq_->RegisterExternalDecoder(
decoder_, codec_, kPayloadType, sample_rate_hz_));
ASSERT_EQ(NetEq::kOK,
neteq_->RegisterExternalDecoder(decoder_, codec_, name_,
kPayloadType, sample_rate_hz_));
}
void NetEqExternalDecoderTest::InsertPacket(

View File

@ -11,6 +11,8 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_NETEQ_EXTERNAL_DECODER_TEST_H_
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_NETEQ_EXTERNAL_DECODER_TEST_H_
#include <string>
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
#include "webrtc/modules/audio_coding/neteq/include/neteq.h"
@ -49,6 +51,7 @@ class NetEqExternalDecoderTest {
private:
NetEqDecoder codec_;
std::string name_ = "dummy name";
AudioDecoder* decoder_;
int sample_rate_hz_;
int channels_;

View File

@ -34,6 +34,7 @@ int64_t NetEqPerformanceTest::Run(int runtime_ms,
const int kSampRateHz = 32000;
const webrtc::NetEqDecoder kDecoderType =
webrtc::NetEqDecoder::kDecoderPCM16Bswb32kHz;
const std::string kDecoderName = "pcm16-swb32";
const int kPayloadType = 95;
// Initialize NetEq instance.
@ -41,7 +42,7 @@ int64_t NetEqPerformanceTest::Run(int runtime_ms,
config.sample_rate_hz = kSampRateHz;
NetEq* neteq = NetEq::Create(config);
// Register decoder in |neteq|.
if (neteq->RegisterPayloadType(kDecoderType, kPayloadType) != 0)
if (neteq->RegisterPayloadType(kDecoderType, kDecoderName, kPayloadType) != 0)
return -1;
// Set up AudioLoop object.

View File

@ -292,7 +292,8 @@ bool GilbertElliotLoss::Lost() {
}
void NetEqQualityTest::SetUp() {
ASSERT_EQ(0, neteq_->RegisterPayloadType(decoder_type_, kPayloadType));
ASSERT_EQ(0,
neteq_->RegisterPayloadType(decoder_type_, "noname", kPayloadType));
rtp_generator_->set_drift_factor(drift_factor_);
int units = block_duration_ms_ / kPacketLossTimeUnitMs;

View File

@ -189,8 +189,9 @@ std::string CodecName(webrtc::NetEqDecoder codec) {
void RegisterPayloadType(NetEq* neteq,
webrtc::NetEqDecoder codec,
const std::string& name,
google::int32 flag) {
if (neteq->RegisterPayloadType(codec, static_cast<uint8_t>(flag))) {
if (neteq->RegisterPayloadType(codec, name, static_cast<uint8_t>(flag))) {
std::cerr << "Cannot register payload type " << flag << " as "
<< CodecName(codec) << std::endl;
exit(1);
@ -200,30 +201,40 @@ void RegisterPayloadType(NetEq* neteq,
// Registers all decoders in |neteq|.
void RegisterPayloadTypes(NetEq* neteq) {
assert(neteq);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderPCMu, FLAGS_pcmu);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderPCMa, FLAGS_pcma);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderILBC, FLAGS_ilbc);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderISAC, FLAGS_isac);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderISACswb,
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderPCMu, "pcmu",
FLAGS_pcmu);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderPCMa, "pcma",
FLAGS_pcma);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderILBC, "ilbc",
FLAGS_ilbc);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderISAC, "isac",
FLAGS_isac);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderISACswb, "isac-swb",
FLAGS_isac_swb);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderOpus, FLAGS_opus);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderPCM16B,
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderOpus, "opus",
FLAGS_opus);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderPCM16B, "pcm16-nb",
FLAGS_pcm16b);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderPCM16Bwb,
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderPCM16Bwb, "pcm16-wb",
FLAGS_pcm16b_wb);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderPCM16Bswb32kHz,
FLAGS_pcm16b_swb32);
"pcm16-swb32", FLAGS_pcm16b_swb32);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderPCM16Bswb48kHz,
FLAGS_pcm16b_swb48);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderG722, FLAGS_g722);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderAVT, FLAGS_avt);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderRED, FLAGS_red);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderCNGnb, FLAGS_cn_nb);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderCNGwb, FLAGS_cn_wb);
"pcm16-swb48", FLAGS_pcm16b_swb48);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderG722, "g722",
FLAGS_g722);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderAVT, "avt",
FLAGS_avt);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderRED, "red",
FLAGS_red);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderCNGnb, "cng-nb",
FLAGS_cn_nb);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderCNGwb, "cng-wb",
FLAGS_cn_wb);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderCNGswb32kHz,
FLAGS_cn_swb32);
"cng-swb32", FLAGS_cn_swb32);
RegisterPayloadType(neteq, webrtc::NetEqDecoder::kDecoderCNGswb48kHz,
FLAGS_cn_swb48);
"cng-swb48", FLAGS_cn_swb48);
}
void PrintCodecMappingEntry(webrtc::NetEqDecoder codec, google::int32 flag) {