Create ACM2 instance when calling AudioCodingModule::Create
BUG=2996 R=turaj@webrtc.org Review URL: https://webrtc-codereview.appspot.com/12079005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5952 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
0a035c8924
commit
0c1444c748
@ -23,6 +23,7 @@
|
|||||||
#include "webrtc/modules/audio_coding/main/acm2/nack.h"
|
#include "webrtc/modules/audio_coding/main/acm2/nack.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq4/interface/audio_decoder.h"
|
#include "webrtc/modules/audio_coding/neteq4/interface/audio_decoder.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq4/interface/neteq.h"
|
#include "webrtc/modules/audio_coding/neteq4/interface/neteq.h"
|
||||||
|
#include "webrtc/system_wrappers/interface/clock.h"
|
||||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||||
#include "webrtc/system_wrappers/interface/logging.h"
|
#include "webrtc/system_wrappers/interface/logging.h"
|
||||||
#include "webrtc/system_wrappers/interface/rw_lock_wrapper.h"
|
#include "webrtc/system_wrappers/interface/rw_lock_wrapper.h"
|
||||||
@ -116,7 +117,7 @@ bool IsCng(int codec_id) {
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
AcmReceiver::AcmReceiver()
|
AcmReceiver::AcmReceiver(Clock* clock)
|
||||||
: id_(0),
|
: id_(0),
|
||||||
neteq_config_(),
|
neteq_config_(),
|
||||||
neteq_(NetEq::Create(neteq_config_)),
|
neteq_(NetEq::Create(neteq_config_)),
|
||||||
@ -128,6 +129,7 @@ AcmReceiver::AcmReceiver()
|
|||||||
current_sample_rate_hz_(neteq_config_.sample_rate_hz),
|
current_sample_rate_hz_(neteq_config_.sample_rate_hz),
|
||||||
nack_(),
|
nack_(),
|
||||||
nack_enabled_(false),
|
nack_enabled_(false),
|
||||||
|
clock_(clock),
|
||||||
av_sync_(false),
|
av_sync_(false),
|
||||||
initial_delay_manager_(),
|
initial_delay_manager_(),
|
||||||
missing_packets_sync_stream_(),
|
missing_packets_sync_stream_(),
|
||||||
@ -817,7 +819,7 @@ uint32_t AcmReceiver::NowInTimestamp(int decoder_sampling_rate) const {
|
|||||||
// We masked 6 most significant bits of 32-bit so there is no overflow in
|
// We masked 6 most significant bits of 32-bit so there is no overflow in
|
||||||
// the conversion from milliseconds to timestamp.
|
// the conversion from milliseconds to timestamp.
|
||||||
const uint32_t now_in_ms = static_cast<uint32_t>(
|
const uint32_t now_in_ms = static_cast<uint32_t>(
|
||||||
TickTime::MillisecondTimestamp() & 0x03ffffff);
|
clock_->TimeInMilliseconds() & 0x03ffffff);
|
||||||
return static_cast<uint32_t>(
|
return static_cast<uint32_t>(
|
||||||
(decoder_sampling_rate / 1000) * now_in_ms);
|
(decoder_sampling_rate / 1000) * now_in_ms);
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
class Clock;
|
||||||
struct CodecInst;
|
struct CodecInst;
|
||||||
class CriticalSectionWrapper;
|
class CriticalSectionWrapper;
|
||||||
class RWLockWrapper;
|
class RWLockWrapper;
|
||||||
@ -47,9 +48,7 @@ class AcmReceiver {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Constructor of the class
|
// Constructor of the class
|
||||||
AcmReceiver();
|
explicit AcmReceiver(Clock* clock);
|
||||||
|
|
||||||
explicit AcmReceiver(NetEq* neteq);
|
|
||||||
|
|
||||||
// Destructor of the class.
|
// Destructor of the class.
|
||||||
~AcmReceiver();
|
~AcmReceiver();
|
||||||
@ -354,6 +353,7 @@ class AcmReceiver {
|
|||||||
int16_t audio_buffer_[AudioFrame::kMaxDataSizeSamples];
|
int16_t audio_buffer_[AudioFrame::kMaxDataSizeSamples];
|
||||||
scoped_ptr<Nack> nack_;
|
scoped_ptr<Nack> nack_;
|
||||||
bool nack_enabled_;
|
bool nack_enabled_;
|
||||||
|
Clock* clock_;
|
||||||
|
|
||||||
// Indicates if a non-zero initial delay is set, and the receiver is in
|
// Indicates if a non-zero initial delay is set, and the receiver is in
|
||||||
// AV-sync mode.
|
// AV-sync mode.
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.h"
|
#include "webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.h"
|
||||||
#include "webrtc/modules/audio_coding/main/acm2/acm_codec_database.h"
|
#include "webrtc/modules/audio_coding/main/acm2/acm_codec_database.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq4/tools/rtp_generator.h"
|
#include "webrtc/modules/audio_coding/neteq4/tools/rtp_generator.h"
|
||||||
|
#include "webrtc/system_wrappers/interface/clock.h"
|
||||||
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||||
#include "webrtc/test/test_suite.h"
|
#include "webrtc/test/test_suite.h"
|
||||||
#include "webrtc/test/testsupport/fileutils.h"
|
#include "webrtc/test/testsupport/fileutils.h"
|
||||||
@ -42,8 +43,8 @@ class AcmReceiverTest : public AudioPacketizationCallback,
|
|||||||
public ::testing::Test {
|
public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
AcmReceiverTest()
|
AcmReceiverTest()
|
||||||
: receiver_(new AcmReceiver),
|
: receiver_(new AcmReceiver(Clock::GetRealTimeClock())),
|
||||||
acm_(new AudioCodingModuleImpl(0)),
|
acm_(new AudioCodingModuleImpl(0, Clock::GetRealTimeClock())),
|
||||||
timestamp_(0),
|
timestamp_(0),
|
||||||
packet_sent_(false),
|
packet_sent_(false),
|
||||||
last_packet_send_timestamp_(timestamp_),
|
last_packet_send_timestamp_(timestamp_),
|
||||||
|
@ -24,11 +24,11 @@ const char kExperimentalAcmVersion[] = "acm2";
|
|||||||
|
|
||||||
// Create module
|
// Create module
|
||||||
AudioCodingModule* AudioCodingModule::Create(int id) {
|
AudioCodingModule* AudioCodingModule::Create(int id) {
|
||||||
return new acm1::AudioCodingModuleImpl(id, Clock::GetRealTimeClock());
|
return new acm2::AudioCodingModuleImpl(id, Clock::GetRealTimeClock());
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioCodingModule* AudioCodingModule::Create(int id, Clock* clock) {
|
AudioCodingModule* AudioCodingModule::Create(int id, Clock* clock) {
|
||||||
return new acm1::AudioCodingModuleImpl(id, clock);
|
return new acm2::AudioCodingModuleImpl(id, clock);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get number of supported codecs
|
// Get number of supported codecs
|
||||||
@ -101,7 +101,7 @@ AudioCodingModule* AudioCodingModuleFactory::Create(int id) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AudioCodingModule* NewAudioCodingModuleFactory::Create(int id) const {
|
AudioCodingModule* NewAudioCodingModuleFactory::Create(int id) const {
|
||||||
return new acm2::AudioCodingModuleImpl(id);
|
return new acm2::AudioCodingModuleImpl(id, Clock::GetRealTimeClock());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
@ -114,7 +114,7 @@ static int TimestampLessThan(uint32_t t1, uint32_t t2) {
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
AudioCodingModuleImpl::AudioCodingModuleImpl(int id)
|
AudioCodingModuleImpl::AudioCodingModuleImpl(int id, Clock* clock)
|
||||||
: packetization_callback_(NULL),
|
: packetization_callback_(NULL),
|
||||||
id_(id),
|
id_(id),
|
||||||
expected_codec_ts_(0xD87F3F9F),
|
expected_codec_ts_(0xD87F3F9F),
|
||||||
@ -131,6 +131,7 @@ AudioCodingModuleImpl::AudioCodingModuleImpl(int id)
|
|||||||
stereo_send_(false),
|
stereo_send_(false),
|
||||||
current_send_codec_idx_(-1),
|
current_send_codec_idx_(-1),
|
||||||
send_codec_registered_(false),
|
send_codec_registered_(false),
|
||||||
|
receiver_(clock),
|
||||||
acm_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
|
acm_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
vad_callback_(NULL),
|
vad_callback_(NULL),
|
||||||
is_first_red_(true),
|
is_first_red_(true),
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
class Clock;
|
||||||
class CriticalSectionWrapper;
|
class CriticalSectionWrapper;
|
||||||
class RWLockWrapper;
|
class RWLockWrapper;
|
||||||
|
|
||||||
@ -32,7 +33,7 @@ class ACMGenericCodec;
|
|||||||
|
|
||||||
class AudioCodingModuleImpl : public AudioCodingModule {
|
class AudioCodingModuleImpl : public AudioCodingModule {
|
||||||
public:
|
public:
|
||||||
explicit AudioCodingModuleImpl(int id);
|
AudioCodingModuleImpl(int id, Clock* clock);
|
||||||
~AudioCodingModuleImpl();
|
~AudioCodingModuleImpl();
|
||||||
|
|
||||||
virtual const char* Version() const;
|
virtual const char* Version() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user