Add clock to ACM config struct

The purpose is to clean up the ACM interface a bit. This is a
follow-up of a comment in http://review.webrtc.org/13379004/.

R=turaj@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/16389005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6006 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrik.lundin@webrtc.org 2014-04-29 08:09:31 +00:00
parent 059488f2ea
commit 0bc9b5a5a7
7 changed files with 16 additions and 15 deletions

View File

@ -117,7 +117,7 @@ bool IsCng(int codec_id) {
} // namespace
AcmReceiver::AcmReceiver(const AudioCodingModule::Config& config, Clock* clock)
AcmReceiver::AcmReceiver(const AudioCodingModule::Config& config)
: id_(config.id),
neteq_(NetEq::Create(config.neteq_config)),
last_audio_decoder_(-1), // Invalid value.
@ -128,11 +128,12 @@ AcmReceiver::AcmReceiver(const AudioCodingModule::Config& config, Clock* clock)
current_sample_rate_hz_(config.neteq_config.sample_rate_hz),
nack_(),
nack_enabled_(false),
clock_(clock),
clock_(config.clock),
av_sync_(false),
initial_delay_manager_(),
missing_packets_sync_stream_(),
late_packets_sync_stream_() {
assert(clock_);
for (int n = 0; n < ACMCodecDB::kMaxNumCodecs; ++n) {
decoders_[n].registered = false;
}

View File

@ -27,7 +27,6 @@
namespace webrtc {
class Clock;
struct CodecInst;
class CriticalSectionWrapper;
class RWLockWrapper;
@ -48,7 +47,7 @@ class AcmReceiver {
};
// Constructor of the class
explicit AcmReceiver(const AudioCodingModule::Config& config, Clock* clock);
explicit AcmReceiver(const AudioCodingModule::Config& config);
// Destructor of the class.
~AcmReceiver();

View File

@ -48,8 +48,8 @@ class AcmReceiverTest : public AudioPacketizationCallback,
last_packet_send_timestamp_(timestamp_),
last_frame_type_(kFrameEmpty) {
AudioCodingModule::Config config;
acm_.reset(new AudioCodingModuleImpl(config, Clock::GetRealTimeClock()));
receiver_.reset(new AcmReceiver(config, Clock::GetRealTimeClock()));
acm_.reset(new AudioCodingModuleImpl(config));
receiver_.reset(new AcmReceiver(config));
}
~AcmReceiverTest() {}

View File

@ -30,7 +30,8 @@ AudioCodingModule* AudioCodingModule::Create(int id) {
AudioCodingModule* AudioCodingModule::Create(int id, Clock* clock) {
AudioCodingModule::Config config;
config.id = id;
return new acm2::AudioCodingModuleImpl(config, clock);
config.clock = clock;
return new acm2::AudioCodingModuleImpl(config);
}
// Get number of supported codecs
@ -105,7 +106,7 @@ AudioCodingModule* AudioCodingModuleFactory::Create(int id) const {
AudioCodingModule* NewAudioCodingModuleFactory::Create(int id) const {
AudioCodingModule::Config config;
config.id = id;
return new acm2::AudioCodingModuleImpl(config, Clock::GetRealTimeClock());
return new acm2::AudioCodingModuleImpl(config);
}
} // namespace webrtc

View File

@ -115,8 +115,7 @@ static int TimestampLessThan(uint32_t t1, uint32_t t2) {
} // namespace
AudioCodingModuleImpl::AudioCodingModuleImpl(
const AudioCodingModule::Config& config,
Clock* clock)
const AudioCodingModule::Config& config)
: packetization_callback_(NULL),
id_(config.id),
expected_codec_ts_(0xD87F3F9F),
@ -133,7 +132,7 @@ AudioCodingModuleImpl::AudioCodingModuleImpl(
stereo_send_(false),
current_send_codec_idx_(-1),
send_codec_registered_(false),
receiver_(config, clock),
receiver_(config),
acm_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
vad_callback_(NULL),
is_first_red_(true),

View File

@ -22,7 +22,6 @@
namespace webrtc {
class Clock;
class CriticalSectionWrapper;
class RWLockWrapper;
@ -33,7 +32,7 @@ class ACMGenericCodec;
class AudioCodingModuleImpl : public AudioCodingModule {
public:
AudioCodingModuleImpl(const AudioCodingModule::Config& config, Clock* clock);
explicit AudioCodingModuleImpl(const AudioCodingModule::Config& config);
~AudioCodingModuleImpl();
virtual const char* Version() const;

View File

@ -17,6 +17,7 @@
#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
#include "webrtc/modules/audio_coding/neteq4/interface/neteq.h"
#include "webrtc/modules/interface/module.h"
#include "webrtc/system_wrappers/interface/clock.h"
#include "webrtc/typedefs.h"
namespace webrtc {
@ -26,7 +27,6 @@ struct CodecInst;
struct WebRtcRTPHeader;
class AudioFrame;
class RTPFragmentationHeader;
class Clock;
#define WEBRTC_10MS_PCM_AUDIO 960 // 16 bits super wideband 48 kHz
@ -86,10 +86,12 @@ class AudioCodingModule: public Module {
struct Config {
Config()
: id(0),
neteq_config() {}
neteq_config(),
clock(Clock::GetRealTimeClock()) {}
int id;
NetEq::Config neteq_config;
Clock* clock;
};
///////////////////////////////////////////////////////////////////////////