Revert of Remove various IDs (patchset #7 id:120001 of https://codereview.webrtc.org/3019543002/ )
Reason for revert: Breaks downstream Original issue's description: > Remove various IDs: > > - AudioFrame > - AudioCodingModule > > BUG=webrtc:4690 > TBR=kwiberg@webrtc.org > > Review-Url: https://codereview.webrtc.org/3019543002 > Cr-Commit-Position: refs/heads/master@{#20005} > Committed: https://webrtc.googlesource.com/src/+/2d0f77585d556d8b11d6269d35149ae9ca14c472 TBR=henrik.lundin@webrtc.org,kwiberg@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:4690 Review-Url: https://codereview.webrtc.org/3014683002 Cr-Commit-Position: refs/heads/master@{#20008}
This commit is contained in:
@ -110,6 +110,7 @@ AudioCodingModule::Config MakeAcmConfig(
|
||||
Clock* clock,
|
||||
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory) {
|
||||
AudioCodingModule::Config config;
|
||||
config.id = 0;
|
||||
config.clock = clock;
|
||||
config.decoder_factory = std::move(decoder_factory);
|
||||
return config;
|
||||
|
||||
@ -28,7 +28,7 @@ AcmSendTestOldApi::AcmSendTestOldApi(InputAudioFile* audio_source,
|
||||
int source_rate_hz,
|
||||
int test_duration_ms)
|
||||
: clock_(0),
|
||||
acm_(webrtc::AudioCodingModule::Create(&clock_)),
|
||||
acm_(webrtc::AudioCodingModule::Create(0, &clock_)),
|
||||
audio_source_(audio_source),
|
||||
source_rate_hz_(source_rate_hz),
|
||||
input_block_size_samples_(
|
||||
|
||||
@ -269,6 +269,7 @@ class AudioCodingModuleImpl final : public AudioCodingModule {
|
||||
|
||||
rtc::CriticalSection acm_crit_sect_;
|
||||
rtc::Buffer encode_buffer_ RTC_GUARDED_BY(acm_crit_sect_);
|
||||
int id_; // TODO(henrik.lundin) Make const.
|
||||
uint32_t expected_codec_ts_ RTC_GUARDED_BY(acm_crit_sect_);
|
||||
uint32_t expected_in_ts_ RTC_GUARDED_BY(acm_crit_sect_);
|
||||
acm2::ACMResampler resampler_ RTC_GUARDED_BY(acm_crit_sect_);
|
||||
@ -455,7 +456,8 @@ void AudioCodingModuleImpl::ChangeLogger::MaybeLog(int value) {
|
||||
|
||||
AudioCodingModuleImpl::AudioCodingModuleImpl(
|
||||
const AudioCodingModule::Config& config)
|
||||
: expected_codec_ts_(0xD87F3F9F),
|
||||
: id_(config.id),
|
||||
expected_codec_ts_(0xD87F3F9F),
|
||||
expected_in_ts_(0xD87F3F9F),
|
||||
receiver_(config),
|
||||
bitrate_logger_("WebRTC.Audio.TargetBitrateInKbps"),
|
||||
@ -1118,6 +1120,7 @@ int AudioCodingModuleImpl::PlayoutData10Ms(int desired_freq_hz,
|
||||
LOG(LS_ERROR) << "PlayoutData failed, RecOut Failed";
|
||||
return -1;
|
||||
}
|
||||
audio_frame->id_ = id_;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1283,7 +1286,7 @@ ANAStats AudioCodingModuleImpl::GetANAStats() const {
|
||||
} // namespace
|
||||
|
||||
AudioCodingModule::Config::Config()
|
||||
: neteq_config(), clock(Clock::GetRealTimeClock()) {
|
||||
: id(0), neteq_config(), clock(Clock::GetRealTimeClock()) {
|
||||
// Post-decode VAD is disabled by default in NetEq, however, Audio
|
||||
// Conference Mixer relies on VAD decisions and fails without them.
|
||||
neteq_config.enable_post_decode_vad = true;
|
||||
@ -1293,15 +1296,17 @@ AudioCodingModule::Config::Config(const Config&) = default;
|
||||
AudioCodingModule::Config::~Config() = default;
|
||||
|
||||
// Create module
|
||||
AudioCodingModule* AudioCodingModule::Create() {
|
||||
AudioCodingModule* AudioCodingModule::Create(int id) {
|
||||
Config config;
|
||||
config.id = id;
|
||||
config.clock = Clock::GetRealTimeClock();
|
||||
config.decoder_factory = CreateBuiltinAudioDecoderFactory();
|
||||
return Create(config);
|
||||
}
|
||||
|
||||
AudioCodingModule* AudioCodingModule::Create(Clock* clock) {
|
||||
AudioCodingModule* AudioCodingModule::Create(int id, Clock* clock) {
|
||||
Config config;
|
||||
config.id = id;
|
||||
config.clock = clock;
|
||||
config.decoder_factory = CreateBuiltinAudioDecoderFactory();
|
||||
return Create(config);
|
||||
|
||||
@ -157,7 +157,8 @@ class PacketizationCallbackStubOldApi : public AudioPacketizationCallback {
|
||||
class AudioCodingModuleTestOldApi : public ::testing::Test {
|
||||
protected:
|
||||
AudioCodingModuleTestOldApi()
|
||||
: rtp_utility_(new RtpUtility(kFrameSizeSamples, kPayloadType)),
|
||||
: id_(1),
|
||||
rtp_utility_(new RtpUtility(kFrameSizeSamples, kPayloadType)),
|
||||
clock_(Clock::GetRealTimeClock()) {}
|
||||
|
||||
~AudioCodingModuleTestOldApi() {}
|
||||
@ -165,7 +166,7 @@ class AudioCodingModuleTestOldApi : public ::testing::Test {
|
||||
void TearDown() {}
|
||||
|
||||
void SetUp() {
|
||||
acm_.reset(AudioCodingModule::Create(clock_));
|
||||
acm_.reset(AudioCodingModule::Create(id_, clock_));
|
||||
|
||||
rtp_utility_->Populate(&rtp_header_);
|
||||
|
||||
@ -229,6 +230,7 @@ class AudioCodingModuleTestOldApi : public ::testing::Test {
|
||||
VerifyEncoding();
|
||||
}
|
||||
|
||||
const int id_;
|
||||
std::unique_ptr<RtpUtility> rtp_utility_;
|
||||
std::unique_ptr<AudioCodingModule> acm_;
|
||||
PacketizationCallbackStubOldApi packet_cb_;
|
||||
@ -312,6 +314,7 @@ TEST_F(AudioCodingModuleTestOldApi, VerifyOutputFrame) {
|
||||
bool muted;
|
||||
EXPECT_EQ(0, acm_->PlayoutData10Ms(kSampleRateHz, &audio_frame, &muted));
|
||||
ASSERT_FALSE(muted);
|
||||
EXPECT_EQ(id_, audio_frame.id_);
|
||||
EXPECT_EQ(0u, audio_frame.timestamp_);
|
||||
EXPECT_GT(audio_frame.num_channels_, 0u);
|
||||
EXPECT_EQ(static_cast<size_t>(kSampleRateHz / 100),
|
||||
|
||||
@ -70,6 +70,7 @@ class AudioCodingModule {
|
||||
Config(const Config&);
|
||||
~Config();
|
||||
|
||||
int id;
|
||||
NetEq::Config neteq_config;
|
||||
Clock* clock;
|
||||
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory;
|
||||
@ -82,8 +83,8 @@ class AudioCodingModule {
|
||||
// injected into ACM. ACM will take the ownership of the object clock and
|
||||
// delete it when destroyed.
|
||||
//
|
||||
static AudioCodingModule* Create();
|
||||
static AudioCodingModule* Create(Clock* clock);
|
||||
static AudioCodingModule* Create(int id);
|
||||
static AudioCodingModule* Create(int id, Clock* clock);
|
||||
static AudioCodingModule* Create(const Config& config);
|
||||
virtual ~AudioCodingModule() = default;
|
||||
|
||||
|
||||
@ -48,8 +48,8 @@ void APITest::Wait(uint32_t waitLengthMs) {
|
||||
}
|
||||
|
||||
APITest::APITest()
|
||||
: _acmA(AudioCodingModule::Create()),
|
||||
_acmB(AudioCodingModule::Create()),
|
||||
: _acmA(AudioCodingModule::Create(1)),
|
||||
_acmB(AudioCodingModule::Create(2)),
|
||||
_channel_A2B(NULL),
|
||||
_channel_B2A(NULL),
|
||||
_writeToFile(true),
|
||||
|
||||
@ -281,7 +281,7 @@ void EncodeDecodeTest::Perform() {
|
||||
codePars[1] = 0;
|
||||
codePars[2] = 0;
|
||||
|
||||
std::unique_ptr<AudioCodingModule> acm(AudioCodingModule::Create());
|
||||
std::unique_ptr<AudioCodingModule> acm(AudioCodingModule::Create(0));
|
||||
struct CodecInst sendCodecTmp;
|
||||
numCodecs = acm->NumberOfCodecs();
|
||||
|
||||
@ -337,7 +337,7 @@ std::string EncodeDecodeTest::EncodeToFile(int fileType,
|
||||
int codeId,
|
||||
int* codePars,
|
||||
int testMode) {
|
||||
std::unique_ptr<AudioCodingModule> acm(AudioCodingModule::Create());
|
||||
std::unique_ptr<AudioCodingModule> acm(AudioCodingModule::Create(1));
|
||||
RTPFile rtpFile;
|
||||
std::string fileName = webrtc::test::TempFilename(webrtc::test::OutputPath(),
|
||||
"encode_decode_rtp");
|
||||
|
||||
@ -127,7 +127,7 @@ void PacketLossTest::Perform() {
|
||||
#ifndef WEBRTC_CODEC_OPUS
|
||||
return;
|
||||
#else
|
||||
std::unique_ptr<AudioCodingModule> acm(AudioCodingModule::Create());
|
||||
std::unique_ptr<AudioCodingModule> acm(AudioCodingModule::Create(0));
|
||||
|
||||
int codec_id = acm->Codec("opus", 48000, channels_);
|
||||
|
||||
|
||||
@ -104,8 +104,8 @@ void TestPack::reset_payload_size() {
|
||||
}
|
||||
|
||||
TestAllCodecs::TestAllCodecs(int test_mode)
|
||||
: acm_a_(AudioCodingModule::Create()),
|
||||
acm_b_(AudioCodingModule::Create()),
|
||||
: acm_a_(AudioCodingModule::Create(0)),
|
||||
acm_b_(AudioCodingModule::Create(1)),
|
||||
channel_a_to_b_(NULL),
|
||||
test_count_(0),
|
||||
packet_size_samples_(0),
|
||||
|
||||
@ -48,8 +48,8 @@ namespace {
|
||||
}
|
||||
|
||||
TestRedFec::TestRedFec()
|
||||
: _acmA(AudioCodingModule::Create()),
|
||||
_acmB(AudioCodingModule::Create()),
|
||||
: _acmA(AudioCodingModule::Create(0)),
|
||||
_acmB(AudioCodingModule::Create(1)),
|
||||
_channelA2B(NULL),
|
||||
_testCntr(0) {
|
||||
}
|
||||
|
||||
@ -108,8 +108,8 @@ void TestPackStereo::set_lost_packet(bool lost) {
|
||||
}
|
||||
|
||||
TestStereo::TestStereo(int test_mode)
|
||||
: acm_a_(AudioCodingModule::Create()),
|
||||
acm_b_(AudioCodingModule::Create()),
|
||||
: acm_a_(AudioCodingModule::Create(0)),
|
||||
acm_b_(AudioCodingModule::Create(1)),
|
||||
channel_a2b_(NULL),
|
||||
test_cntr_(0),
|
||||
pack_size_samp_(0),
|
||||
|
||||
@ -62,8 +62,8 @@ void ActivityMonitor::GetStatistics(uint32_t* counter) {
|
||||
}
|
||||
|
||||
TestVadDtx::TestVadDtx()
|
||||
: acm_send_(AudioCodingModule::Create()),
|
||||
acm_receive_(AudioCodingModule::Create()),
|
||||
: acm_send_(AudioCodingModule::Create(0)),
|
||||
acm_receive_(AudioCodingModule::Create(1)),
|
||||
channel_(new Channel),
|
||||
monitor_(new ActivityMonitor) {
|
||||
EXPECT_EQ(0, acm_send_->RegisterTransportCallback(channel_.get()));
|
||||
|
||||
@ -34,14 +34,16 @@ namespace webrtc {
|
||||
#define MAX_FILE_NAME_LENGTH_BYTE 500
|
||||
|
||||
TwoWayCommunication::TwoWayCommunication(int testMode)
|
||||
: _acmA(AudioCodingModule::Create()),
|
||||
_acmRefA(AudioCodingModule::Create()),
|
||||
: _acmA(AudioCodingModule::Create(1)),
|
||||
_acmRefA(AudioCodingModule::Create(3)),
|
||||
_testMode(testMode) {
|
||||
AudioCodingModule::Config config;
|
||||
// The clicks will be more obvious in FAX mode. TODO(henrik.lundin) Really?
|
||||
config.neteq_config.playout_mode = kPlayoutFax;
|
||||
config.id = 2;
|
||||
config.decoder_factory = CreateBuiltinAudioDecoderFactory();
|
||||
_acmB.reset(AudioCodingModule::Create(config));
|
||||
config.id = 4;
|
||||
_acmRefB.reset(AudioCodingModule::Create(config));
|
||||
}
|
||||
|
||||
@ -60,7 +62,7 @@ TwoWayCommunication::~TwoWayCommunication() {
|
||||
|
||||
void TwoWayCommunication::ChooseCodec(uint8_t* codecID_A,
|
||||
uint8_t* codecID_B) {
|
||||
std::unique_ptr<AudioCodingModule> tmpACM(AudioCodingModule::Create());
|
||||
std::unique_ptr<AudioCodingModule> tmpACM(AudioCodingModule::Create(0));
|
||||
uint8_t noCodec = tmpACM->NumberOfCodecs();
|
||||
CodecInst codecInst;
|
||||
printf("List of Supported Codecs\n");
|
||||
|
||||
@ -64,8 +64,8 @@ struct TestSettings {
|
||||
class DelayTest {
|
||||
public:
|
||||
DelayTest()
|
||||
: acm_a_(AudioCodingModule::Create()),
|
||||
acm_b_(AudioCodingModule::Create()),
|
||||
: acm_a_(AudioCodingModule::Create(0)),
|
||||
acm_b_(AudioCodingModule::Create(1)),
|
||||
channel_a2b_(new Channel),
|
||||
test_cntr_(0),
|
||||
encoding_sample_rate_hz_(8000) {}
|
||||
|
||||
@ -67,8 +67,8 @@ int16_t SetISAConfig(ACMTestISACConfig& isacConfig, AudioCodingModule* acm,
|
||||
}
|
||||
|
||||
ISACTest::ISACTest(int testMode)
|
||||
: _acmA(AudioCodingModule::Create()),
|
||||
_acmB(AudioCodingModule::Create()),
|
||||
: _acmA(AudioCodingModule::Create(1)),
|
||||
_acmB(AudioCodingModule::Create(2)),
|
||||
_testMode(testMode) {}
|
||||
|
||||
ISACTest::~ISACTest() {}
|
||||
|
||||
@ -61,8 +61,8 @@ class InsertPacketWithTiming {
|
||||
InsertPacketWithTiming()
|
||||
: sender_clock_(new SimulatedClock(0)),
|
||||
receiver_clock_(new SimulatedClock(0)),
|
||||
send_acm_(AudioCodingModule::Create(sender_clock_)),
|
||||
receive_acm_(AudioCodingModule::Create(receiver_clock_)),
|
||||
send_acm_(AudioCodingModule::Create(0, sender_clock_)),
|
||||
receive_acm_(AudioCodingModule::Create(0, receiver_clock_)),
|
||||
channel_(new Channel),
|
||||
seq_num_fid_(fopen(FLAG_seq_num, "rt")),
|
||||
send_ts_fid_(fopen(FLAG_send_ts, "rt")),
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
namespace webrtc {
|
||||
|
||||
OpusTest::OpusTest()
|
||||
: acm_receiver_(AudioCodingModule::Create()),
|
||||
: acm_receiver_(AudioCodingModule::Create(0)),
|
||||
channel_a2b_(NULL),
|
||||
counter_(0),
|
||||
payload_type_(255),
|
||||
|
||||
@ -22,7 +22,7 @@ namespace webrtc {
|
||||
|
||||
class TargetDelayTest : public ::testing::Test {
|
||||
protected:
|
||||
TargetDelayTest() : acm_(AudioCodingModule::Create()) {}
|
||||
TargetDelayTest() : acm_(AudioCodingModule::Create(0)) {}
|
||||
|
||||
~TargetDelayTest() {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user