Introduce NetEq::Config::ToString and use it in NetEq's constructor

R=minyue@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9279}
This commit is contained in:
Henrik Lundin 2015-05-25 16:58:41 +02:00
parent e982a70ae3
commit 905495cfaa
3 changed files with 16 additions and 0 deletions

View File

@ -13,6 +13,7 @@
#include <string.h> // Provide access to size_t.
#include <string>
#include <vector>
#include "webrtc/base/constructormagic.h"
@ -81,6 +82,8 @@ class NetEq {
background_noise_mode(kBgnOff),
playout_mode(kPlayoutOn) {}
std::string ToString() const;
int sample_rate_hz; // Initial value. Will change with input data.
bool enable_audio_classifier;
int max_packets_in_buffer;

View File

@ -10,6 +10,8 @@
#include "webrtc/modules/audio_coding/neteq/interface/neteq.h"
#include <sstream>
#include "webrtc/modules/audio_coding/neteq/accelerate.h"
#include "webrtc/modules/audio_coding/neteq/buffer_level_filter.h"
#include "webrtc/modules/audio_coding/neteq/decoder_database.h"
@ -26,6 +28,16 @@
namespace webrtc {
std::string NetEq::Config::ToString() const {
std::stringstream ss;
ss << "sample_rate_hz=" << sample_rate_hz << ", enable_audio_classifier="
<< (enable_audio_classifier ? "true" : "false")
<< ", max_packets_in_buffer=" << max_packets_in_buffer
<< ", background_noise_mode=" << background_noise_mode
<< ", playout_mode=" << playout_mode;
return ss.str();
}
// Creates all classes needed and inject them into a new NetEqImpl object.
// Return the new object.
NetEq* NetEq::Create(const NetEq::Config& config) {

View File

@ -94,6 +94,7 @@ NetEqImpl::NetEqImpl(const NetEq::Config& config,
playout_mode_(config.playout_mode),
decoded_packet_sequence_number_(-1),
decoded_packet_timestamp_(0) {
LOG(LS_INFO) << "NetEq config: " << config.ToString();
int fs = config.sample_rate_hz;
if (fs != 8000 && fs != 16000 && fs != 32000 && fs != 48000) {
LOG(LS_ERROR) << "Sample rate " << fs << " Hz not supported. " <<