Set NetEq playout mode through the Config struct
This change opens up the possibility to set the playout mode when
creating the NetEq object. The old methods SetPlayoutMode and
PlayoutMode are still available, but are deprecated.
BUG=3520
R=turaj@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/23869004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7381 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.cc b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
index d714733..edf618e 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
@@ -91,6 +91,7 @@
error_code_(0),
decoder_error_code_(0),
background_noise_mode_(config.background_noise_mode),
+ playout_mode_(config.playout_mode),
decoded_packet_sequence_number_(-1),
decoded_packet_timestamp_(0) {
int fs = config.sample_rate_hz;
@@ -278,18 +279,21 @@
return delay_manager_->least_required_delay_ms();
}
+// Deprecated.
+// TODO(henrik.lundin) Delete.
void NetEqImpl::SetPlayoutMode(NetEqPlayoutMode mode) {
CriticalSectionScoped lock(crit_sect_.get());
- if (!decision_logic_.get() || mode != decision_logic_->playout_mode()) {
- // The reset() method calls delete for the old object.
- CreateDecisionLogic(mode);
+ if (mode != playout_mode_) {
+ playout_mode_ = mode;
+ CreateDecisionLogic();
}
}
+// Deprecated.
+// TODO(henrik.lundin) Delete.
NetEqPlayoutMode NetEqImpl::PlayoutMode() const {
CriticalSectionScoped lock(crit_sect_.get());
- assert(decision_logic_.get());
- return decision_logic_->playout_mode();
+ return playout_mode_;
}
int NetEqImpl::NetworkStatistics(NetEqNetworkStatistics* stats) {
@@ -1904,7 +1908,7 @@
// Create DecisionLogic if it is not created yet, then communicate new sample
// rate and output size to DecisionLogic object.
if (!decision_logic_.get()) {
- CreateDecisionLogic(kPlayoutOn);
+ CreateDecisionLogic();
}
decision_logic_->SetSampleRate(fs_hz_, output_size_samples_);
}
@@ -1926,9 +1930,9 @@
}
}
-void NetEqImpl::CreateDecisionLogic(NetEqPlayoutMode mode) {
+void NetEqImpl::CreateDecisionLogic() {
decision_logic_.reset(DecisionLogic::Create(fs_hz_, output_size_samples_,
- mode,
+ playout_mode_,
decoder_database_.get(),
*packet_buffer_.get(),
delay_manager_.get(),