From a769fa51c0ba4134cb326a4da7c14a62a03718bc Mon Sep 17 00:00:00 2001 From: "ajm@google.com" Date: Wed, 13 Jul 2011 21:57:58 +0000 Subject: [PATCH] Adding more output data checks to APM unittest. Blowing out the protobuf definition (changing the tags) since we're still in the formative stages. Later, this would be very bad. Leaving a Frame message in case we want frame-by-frame data, but we prefer to keep the output storage small in general so avoiding it thus far. Review URL: http://webrtc-codereview.appspot.com/68004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@203 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../unit_test/audio_processing_unittest.pb.cc | 640 +++++++++++----- .../unit_test/audio_processing_unittest.pb.h | 719 +++++++++++------- .../unit_test/audio_processing_unittest.proto | 32 +- .../main/test/unit_test/unit_test.cc | 146 +++- test/data/audio_processing/output_data.pb | Bin 212 -> 1244 bytes 5 files changed, 1037 insertions(+), 500 deletions(-) diff --git a/src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.pb.cc b/src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.pb.cc index c82ffdb43e..437acda89c 100644 --- a/src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.pb.cc +++ b/src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.pb.cc @@ -14,6 +14,7 @@ namespace audio_processing_unittest { void protobuf_ShutdownFile_audio_5fprocessing_5funittest_2eproto() { delete Test::default_instance_; + delete Test_Frame::default_instance_; delete Test_Statistic::default_instance_; delete Test_EchoMetrics::default_instance_; delete OutputData::default_instance_; @@ -26,10 +27,12 @@ void protobuf_AddDesc_audio_5fprocessing_5funittest_2eproto() { GOOGLE_PROTOBUF_VERIFY_VERSION; Test::default_instance_ = new Test(); + Test_Frame::default_instance_ = new Test_Frame(); Test_Statistic::default_instance_ = new Test_Statistic(); Test_EchoMetrics::default_instance_ = new Test_EchoMetrics(); OutputData::default_instance_ = new OutputData(); Test::default_instance_->InitAsDefaultInstance(); + Test_Frame::default_instance_->InitAsDefaultInstance(); Test_Statistic::default_instance_->InitAsDefaultInstance(); Test_EchoMetrics::default_instance_->InitAsDefaultInstance(); OutputData::default_instance_->InitAsDefaultInstance(); @@ -46,6 +49,117 @@ struct StaticDescriptorInitializer_audio_5fprocessing_5funittest_2eproto { // =================================================================== +#ifndef _MSC_VER +#endif // !_MSC_VER + +Test_Frame::Test_Frame() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void Test_Frame::InitAsDefaultInstance() { +} + +Test_Frame::Test_Frame(const Test_Frame& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void Test_Frame::SharedCtor() { + _cached_size_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +Test_Frame::~Test_Frame() { + SharedDtor(); +} + +void Test_Frame::SharedDtor() { + if (this != default_instance_) { + } +} + +void Test_Frame::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const Test_Frame& Test_Frame::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_audio_5fprocessing_5funittest_2eproto(); return *default_instance_; +} + +Test_Frame* Test_Frame::default_instance_ = NULL; + +Test_Frame* Test_Frame::New() const { + return new Test_Frame; +} + +void Test_Frame::Clear() { + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool Test_Frame::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, NULL)); + } + return true; +#undef DO_ +} + +void Test_Frame::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { +} + +int Test_Frame::ByteSize() const { + int total_size = 0; + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void Test_Frame::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void Test_Frame::MergeFrom(const Test_Frame& from) { + GOOGLE_CHECK_NE(&from, this); +} + +void Test_Frame::CopyFrom(const Test_Frame& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Test_Frame::IsInitialized() const { + + return true; +} + +void Test_Frame::Swap(Test_Frame* other) { + if (other != this) { + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string Test_Frame::GetTypeName() const { + return "audio_processing_unittest.Test.Frame"; +} + + +// ------------------------------------------------------------------- + #ifndef _MSC_VER const int Test_Statistic::kInstantFieldNumber; const int Test_Statistic::kAverageFieldNumber; @@ -322,10 +436,10 @@ Test_EchoMetrics::Test_EchoMetrics() } void Test_EchoMetrics::InitAsDefaultInstance() { - residualechoreturnloss_ = const_cast< ::audio_processing_unittest::Test_Statistic*>(&::audio_processing_unittest::Test_Statistic::default_instance()); - echoreturnloss_ = const_cast< ::audio_processing_unittest::Test_Statistic*>(&::audio_processing_unittest::Test_Statistic::default_instance()); - echoreturnlossenhancement_ = const_cast< ::audio_processing_unittest::Test_Statistic*>(&::audio_processing_unittest::Test_Statistic::default_instance()); - anlp_ = const_cast< ::audio_processing_unittest::Test_Statistic*>(&::audio_processing_unittest::Test_Statistic::default_instance()); + residual_echo_return_loss_ = const_cast< ::audio_processing_unittest::Test_Statistic*>(&::audio_processing_unittest::Test_Statistic::default_instance()); + echo_return_loss_ = const_cast< ::audio_processing_unittest::Test_Statistic*>(&::audio_processing_unittest::Test_Statistic::default_instance()); + echo_return_loss_enhancement_ = const_cast< ::audio_processing_unittest::Test_Statistic*>(&::audio_processing_unittest::Test_Statistic::default_instance()); + a_nlp_ = const_cast< ::audio_processing_unittest::Test_Statistic*>(&::audio_processing_unittest::Test_Statistic::default_instance()); } Test_EchoMetrics::Test_EchoMetrics(const Test_EchoMetrics& from) @@ -336,10 +450,10 @@ Test_EchoMetrics::Test_EchoMetrics(const Test_EchoMetrics& from) void Test_EchoMetrics::SharedCtor() { _cached_size_ = 0; - residualechoreturnloss_ = NULL; - echoreturnloss_ = NULL; - echoreturnlossenhancement_ = NULL; - anlp_ = NULL; + residual_echo_return_loss_ = NULL; + echo_return_loss_ = NULL; + echo_return_loss_enhancement_ = NULL; + a_nlp_ = NULL; ::memset(_has_bits_, 0, sizeof(_has_bits_)); } @@ -349,10 +463,10 @@ Test_EchoMetrics::~Test_EchoMetrics() { void Test_EchoMetrics::SharedDtor() { if (this != default_instance_) { - delete residualechoreturnloss_; - delete echoreturnloss_; - delete echoreturnlossenhancement_; - delete anlp_; + delete residual_echo_return_loss_; + delete echo_return_loss_; + delete echo_return_loss_enhancement_; + delete a_nlp_; } } @@ -373,17 +487,17 @@ Test_EchoMetrics* Test_EchoMetrics::New() const { void Test_EchoMetrics::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (has_residualechoreturnloss()) { - if (residualechoreturnloss_ != NULL) residualechoreturnloss_->::audio_processing_unittest::Test_Statistic::Clear(); + if (has_residual_echo_return_loss()) { + if (residual_echo_return_loss_ != NULL) residual_echo_return_loss_->::audio_processing_unittest::Test_Statistic::Clear(); } - if (has_echoreturnloss()) { - if (echoreturnloss_ != NULL) echoreturnloss_->::audio_processing_unittest::Test_Statistic::Clear(); + if (has_echo_return_loss()) { + if (echo_return_loss_ != NULL) echo_return_loss_->::audio_processing_unittest::Test_Statistic::Clear(); } - if (has_echoreturnlossenhancement()) { - if (echoreturnlossenhancement_ != NULL) echoreturnlossenhancement_->::audio_processing_unittest::Test_Statistic::Clear(); + if (has_echo_return_loss_enhancement()) { + if (echo_return_loss_enhancement_ != NULL) echo_return_loss_enhancement_->::audio_processing_unittest::Test_Statistic::Clear(); } - if (has_anlp()) { - if (anlp_ != NULL) anlp_->::audio_processing_unittest::Test_Statistic::Clear(); + if (has_a_nlp()) { + if (a_nlp_ != NULL) a_nlp_->::audio_processing_unittest::Test_Statistic::Clear(); } } ::memset(_has_bits_, 0, sizeof(_has_bits_)); @@ -395,54 +509,54 @@ bool Test_EchoMetrics::MergePartialFromCodedStream( ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional .audio_processing_unittest.Test.Statistic residualEchoReturnLoss = 1; + // optional .audio_processing_unittest.Test.Statistic residual_echo_return_loss = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_residualechoreturnloss())); + input, mutable_residual_echo_return_loss())); } else { goto handle_uninterpreted; } - if (input->ExpectTag(18)) goto parse_echoReturnLoss; + if (input->ExpectTag(18)) goto parse_echo_return_loss; break; } - // optional .audio_processing_unittest.Test.Statistic echoReturnLoss = 2; + // optional .audio_processing_unittest.Test.Statistic echo_return_loss = 2; case 2: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_echoReturnLoss: + parse_echo_return_loss: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_echoreturnloss())); + input, mutable_echo_return_loss())); } else { goto handle_uninterpreted; } - if (input->ExpectTag(26)) goto parse_echoReturnLossEnhancement; + if (input->ExpectTag(26)) goto parse_echo_return_loss_enhancement; break; } - // optional .audio_processing_unittest.Test.Statistic echoReturnLossEnhancement = 3; + // optional .audio_processing_unittest.Test.Statistic echo_return_loss_enhancement = 3; case 3: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_echoReturnLossEnhancement: + parse_echo_return_loss_enhancement: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_echoreturnlossenhancement())); + input, mutable_echo_return_loss_enhancement())); } else { goto handle_uninterpreted; } - if (input->ExpectTag(34)) goto parse_aNlp; + if (input->ExpectTag(34)) goto parse_a_nlp; break; } - // optional .audio_processing_unittest.Test.Statistic aNlp = 4; + // optional .audio_processing_unittest.Test.Statistic a_nlp = 4; case 4: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_aNlp: + parse_a_nlp: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_anlp())); + input, mutable_a_nlp())); } else { goto handle_uninterpreted; } @@ -467,28 +581,28 @@ bool Test_EchoMetrics::MergePartialFromCodedStream( void Test_EchoMetrics::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { - // optional .audio_processing_unittest.Test.Statistic residualEchoReturnLoss = 1; - if (has_residualechoreturnloss()) { + // optional .audio_processing_unittest.Test.Statistic residual_echo_return_loss = 1; + if (has_residual_echo_return_loss()) { ::google::protobuf::internal::WireFormatLite::WriteMessage( - 1, this->residualechoreturnloss(), output); + 1, this->residual_echo_return_loss(), output); } - // optional .audio_processing_unittest.Test.Statistic echoReturnLoss = 2; - if (has_echoreturnloss()) { + // optional .audio_processing_unittest.Test.Statistic echo_return_loss = 2; + if (has_echo_return_loss()) { ::google::protobuf::internal::WireFormatLite::WriteMessage( - 2, this->echoreturnloss(), output); + 2, this->echo_return_loss(), output); } - // optional .audio_processing_unittest.Test.Statistic echoReturnLossEnhancement = 3; - if (has_echoreturnlossenhancement()) { + // optional .audio_processing_unittest.Test.Statistic echo_return_loss_enhancement = 3; + if (has_echo_return_loss_enhancement()) { ::google::protobuf::internal::WireFormatLite::WriteMessage( - 3, this->echoreturnlossenhancement(), output); + 3, this->echo_return_loss_enhancement(), output); } - // optional .audio_processing_unittest.Test.Statistic aNlp = 4; - if (has_anlp()) { + // optional .audio_processing_unittest.Test.Statistic a_nlp = 4; + if (has_a_nlp()) { ::google::protobuf::internal::WireFormatLite::WriteMessage( - 4, this->anlp(), output); + 4, this->a_nlp(), output); } } @@ -497,32 +611,32 @@ int Test_EchoMetrics::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // optional .audio_processing_unittest.Test.Statistic residualEchoReturnLoss = 1; - if (has_residualechoreturnloss()) { + // optional .audio_processing_unittest.Test.Statistic residual_echo_return_loss = 1; + if (has_residual_echo_return_loss()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->residualechoreturnloss()); + this->residual_echo_return_loss()); } - // optional .audio_processing_unittest.Test.Statistic echoReturnLoss = 2; - if (has_echoreturnloss()) { + // optional .audio_processing_unittest.Test.Statistic echo_return_loss = 2; + if (has_echo_return_loss()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->echoreturnloss()); + this->echo_return_loss()); } - // optional .audio_processing_unittest.Test.Statistic echoReturnLossEnhancement = 3; - if (has_echoreturnlossenhancement()) { + // optional .audio_processing_unittest.Test.Statistic echo_return_loss_enhancement = 3; + if (has_echo_return_loss_enhancement()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->echoreturnlossenhancement()); + this->echo_return_loss_enhancement()); } - // optional .audio_processing_unittest.Test.Statistic aNlp = 4; - if (has_anlp()) { + // optional .audio_processing_unittest.Test.Statistic a_nlp = 4; + if (has_a_nlp()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->anlp()); + this->a_nlp()); } } @@ -540,17 +654,17 @@ void Test_EchoMetrics::CheckTypeAndMergeFrom( void Test_EchoMetrics::MergeFrom(const Test_EchoMetrics& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_residualechoreturnloss()) { - mutable_residualechoreturnloss()->::audio_processing_unittest::Test_Statistic::MergeFrom(from.residualechoreturnloss()); + if (from.has_residual_echo_return_loss()) { + mutable_residual_echo_return_loss()->::audio_processing_unittest::Test_Statistic::MergeFrom(from.residual_echo_return_loss()); } - if (from.has_echoreturnloss()) { - mutable_echoreturnloss()->::audio_processing_unittest::Test_Statistic::MergeFrom(from.echoreturnloss()); + if (from.has_echo_return_loss()) { + mutable_echo_return_loss()->::audio_processing_unittest::Test_Statistic::MergeFrom(from.echo_return_loss()); } - if (from.has_echoreturnlossenhancement()) { - mutable_echoreturnlossenhancement()->::audio_processing_unittest::Test_Statistic::MergeFrom(from.echoreturnlossenhancement()); + if (from.has_echo_return_loss_enhancement()) { + mutable_echo_return_loss_enhancement()->::audio_processing_unittest::Test_Statistic::MergeFrom(from.echo_return_loss_enhancement()); } - if (from.has_anlp()) { - mutable_anlp()->::audio_processing_unittest::Test_Statistic::MergeFrom(from.anlp()); + if (from.has_a_nlp()) { + mutable_a_nlp()->::audio_processing_unittest::Test_Statistic::MergeFrom(from.a_nlp()); } } } @@ -568,10 +682,10 @@ bool Test_EchoMetrics::IsInitialized() const { void Test_EchoMetrics::Swap(Test_EchoMetrics* other) { if (other != this) { - std::swap(residualechoreturnloss_, other->residualechoreturnloss_); - std::swap(echoreturnloss_, other->echoreturnloss_); - std::swap(echoreturnlossenhancement_, other->echoreturnlossenhancement_); - std::swap(anlp_, other->anlp_); + std::swap(residual_echo_return_loss_, other->residual_echo_return_loss_); + std::swap(echo_return_loss_, other->echo_return_loss_); + std::swap(echo_return_loss_enhancement_, other->echo_return_loss_enhancement_); + std::swap(a_nlp_, other->a_nlp_); std::swap(_has_bits_[0], other->_has_bits_[0]); std::swap(_cached_size_, other->_cached_size_); } @@ -586,8 +700,12 @@ void Test_EchoMetrics::Swap(Test_EchoMetrics* other) { #ifndef _MSC_VER const int Test::kNumReverseChannelsFieldNumber; -const int Test::kNumChannelsFieldNumber; +const int Test::kNumInputChannelsFieldNumber; +const int Test::kNumOutputChannelsFieldNumber; const int Test::kSampleRateFieldNumber; +const int Test::kFrameFieldNumber; +const int Test::kAnalogLevelAverageFieldNumber; +const int Test::kMaxOutputAverageFieldNumber; const int Test::kHasEchoCountFieldNumber; const int Test::kHasVoiceCountFieldNumber; const int Test::kIsSaturatedCountFieldNumber; @@ -600,7 +718,7 @@ Test::Test() } void Test::InitAsDefaultInstance() { - echometrics_ = const_cast< ::audio_processing_unittest::Test_EchoMetrics*>(&::audio_processing_unittest::Test_EchoMetrics::default_instance()); + echo_metrics_ = const_cast< ::audio_processing_unittest::Test_EchoMetrics*>(&::audio_processing_unittest::Test_EchoMetrics::default_instance()); } Test::Test(const Test& from) @@ -611,13 +729,16 @@ Test::Test(const Test& from) void Test::SharedCtor() { _cached_size_ = 0; - numreversechannels_ = 0; - numchannels_ = 0; - samplerate_ = 0; - hasechocount_ = 0; - hasvoicecount_ = 0; - issaturatedcount_ = 0; - echometrics_ = NULL; + num_reverse_channels_ = 0; + num_input_channels_ = 0; + num_output_channels_ = 0; + sample_rate_ = 0; + analog_level_average_ = 0; + max_output_average_ = 0; + has_echo_count_ = 0; + has_voice_count_ = 0; + is_saturated_count_ = 0; + echo_metrics_ = NULL; ::memset(_has_bits_, 0, sizeof(_has_bits_)); } @@ -627,7 +748,7 @@ Test::~Test() { void Test::SharedDtor() { if (this != default_instance_) { - delete echometrics_; + delete echo_metrics_; } } @@ -648,16 +769,22 @@ Test* Test::New() const { void Test::Clear() { if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - numreversechannels_ = 0; - numchannels_ = 0; - samplerate_ = 0; - hasechocount_ = 0; - hasvoicecount_ = 0; - issaturatedcount_ = 0; - if (has_echometrics()) { - if (echometrics_ != NULL) echometrics_->::audio_processing_unittest::Test_EchoMetrics::Clear(); + num_reverse_channels_ = 0; + num_input_channels_ = 0; + num_output_channels_ = 0; + sample_rate_ = 0; + analog_level_average_ = 0; + max_output_average_ = 0; + has_echo_count_ = 0; + } + if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) { + has_voice_count_ = 0; + is_saturated_count_ = 0; + if (has_echo_metrics()) { + if (echo_metrics_ != NULL) echo_metrics_->::audio_processing_unittest::Test_EchoMetrics::Clear(); } } + frame_.Clear(); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } @@ -667,108 +794,171 @@ bool Test::MergePartialFromCodedStream( ::google::protobuf::uint32 tag; while ((tag = input->ReadTag()) != 0) { switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional int32 numReverseChannels = 1; + // optional int32 num_reverse_channels = 1; case 1: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, &numreversechannels_))); - set_has_numreversechannels(); + input, &num_reverse_channels_))); + set_has_num_reverse_channels(); } else { goto handle_uninterpreted; } - if (input->ExpectTag(16)) goto parse_numChannels; + if (input->ExpectTag(16)) goto parse_num_input_channels; break; } - // optional int32 numChannels = 2; + // optional int32 num_input_channels = 2; case 2: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { - parse_numChannels: + parse_num_input_channels: DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, &numchannels_))); - set_has_numchannels(); + input, &num_input_channels_))); + set_has_num_input_channels(); } else { goto handle_uninterpreted; } - if (input->ExpectTag(24)) goto parse_sampleRate; + if (input->ExpectTag(24)) goto parse_num_output_channels; break; } - // optional int32 sampleRate = 3; + // optional int32 num_output_channels = 3; case 3: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { - parse_sampleRate: + parse_num_output_channels: DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, &samplerate_))); - set_has_samplerate(); + input, &num_output_channels_))); + set_has_num_output_channels(); } else { goto handle_uninterpreted; } - if (input->ExpectTag(32)) goto parse_hasEchoCount; + if (input->ExpectTag(32)) goto parse_sample_rate; break; } - // optional int32 hasEchoCount = 4; + // optional int32 sample_rate = 4; case 4: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { - parse_hasEchoCount: + parse_sample_rate: DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, &hasechocount_))); - set_has_hasechocount(); + input, &sample_rate_))); + set_has_sample_rate(); } else { goto handle_uninterpreted; } - if (input->ExpectTag(40)) goto parse_hasVoiceCount; + if (input->ExpectTag(42)) goto parse_frame; break; } - // optional int32 hasVoiceCount = 5; + // repeated .audio_processing_unittest.Test.Frame frame = 5; case 5: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { - parse_hasVoiceCount: - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, &hasvoicecount_))); - set_has_hasvoicecount(); + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_frame: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_frame())); } else { goto handle_uninterpreted; } - if (input->ExpectTag(48)) goto parse_isSaturatedCount; + if (input->ExpectTag(42)) goto parse_frame; + if (input->ExpectTag(48)) goto parse_analog_level_average; break; } - // optional int32 isSaturatedCount = 6; + // optional int32 analog_level_average = 6; case 6: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { - parse_isSaturatedCount: + parse_analog_level_average: DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, &issaturatedcount_))); - set_has_issaturatedcount(); + input, &analog_level_average_))); + set_has_analog_level_average(); } else { goto handle_uninterpreted; } - if (input->ExpectTag(58)) goto parse_echoMetrics; + if (input->ExpectTag(56)) goto parse_max_output_average; break; } - // optional .audio_processing_unittest.Test.EchoMetrics echoMetrics = 7; + // optional int32 max_output_average = 7; case 7: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_max_output_average: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &max_output_average_))); + set_has_max_output_average(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(64)) goto parse_has_echo_count; + break; + } + + // optional int32 has_echo_count = 8; + case 8: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_has_echo_count: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &has_echo_count_))); + set_has_has_echo_count(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(72)) goto parse_has_voice_count; + break; + } + + // optional int32 has_voice_count = 9; + case 9: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_has_voice_count: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &has_voice_count_))); + set_has_has_voice_count(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(80)) goto parse_is_saturated_count; + break; + } + + // optional int32 is_saturated_count = 10; + case 10: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_is_saturated_count: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &is_saturated_count_))); + set_has_is_saturated_count(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(90)) goto parse_echo_metrics; + break; + } + + // optional .audio_processing_unittest.Test.EchoMetrics echo_metrics = 11; + case 11: { if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { - parse_echoMetrics: + parse_echo_metrics: DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_echometrics())); + input, mutable_echo_metrics())); } else { goto handle_uninterpreted; } @@ -793,40 +983,61 @@ bool Test::MergePartialFromCodedStream( void Test::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { - // optional int32 numReverseChannels = 1; - if (has_numreversechannels()) { - ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->numreversechannels(), output); + // optional int32 num_reverse_channels = 1; + if (has_num_reverse_channels()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->num_reverse_channels(), output); } - // optional int32 numChannels = 2; - if (has_numchannels()) { - ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->numchannels(), output); + // optional int32 num_input_channels = 2; + if (has_num_input_channels()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->num_input_channels(), output); } - // optional int32 sampleRate = 3; - if (has_samplerate()) { - ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->samplerate(), output); + // optional int32 num_output_channels = 3; + if (has_num_output_channels()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->num_output_channels(), output); } - // optional int32 hasEchoCount = 4; - if (has_hasechocount()) { - ::google::protobuf::internal::WireFormatLite::WriteInt32(4, this->hasechocount(), output); + // optional int32 sample_rate = 4; + if (has_sample_rate()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(4, this->sample_rate(), output); } - // optional int32 hasVoiceCount = 5; - if (has_hasvoicecount()) { - ::google::protobuf::internal::WireFormatLite::WriteInt32(5, this->hasvoicecount(), output); - } - - // optional int32 isSaturatedCount = 6; - if (has_issaturatedcount()) { - ::google::protobuf::internal::WireFormatLite::WriteInt32(6, this->issaturatedcount(), output); - } - - // optional .audio_processing_unittest.Test.EchoMetrics echoMetrics = 7; - if (has_echometrics()) { + // repeated .audio_processing_unittest.Test.Frame frame = 5; + for (int i = 0; i < this->frame_size(); i++) { ::google::protobuf::internal::WireFormatLite::WriteMessage( - 7, this->echometrics(), output); + 5, this->frame(i), output); + } + + // optional int32 analog_level_average = 6; + if (has_analog_level_average()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(6, this->analog_level_average(), output); + } + + // optional int32 max_output_average = 7; + if (has_max_output_average()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(7, this->max_output_average(), output); + } + + // optional int32 has_echo_count = 8; + if (has_has_echo_count()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(8, this->has_echo_count(), output); + } + + // optional int32 has_voice_count = 9; + if (has_has_voice_count()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(9, this->has_voice_count(), output); + } + + // optional int32 is_saturated_count = 10; + if (has_is_saturated_count()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(10, this->is_saturated_count(), output); + } + + // optional .audio_processing_unittest.Test.EchoMetrics echo_metrics = 11; + if (has_echo_metrics()) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 11, this->echo_metrics(), output); } } @@ -835,56 +1046,87 @@ int Test::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // optional int32 numReverseChannels = 1; - if (has_numreversechannels()) { + // optional int32 num_reverse_channels = 1; + if (has_num_reverse_channels()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( - this->numreversechannels()); + this->num_reverse_channels()); } - // optional int32 numChannels = 2; - if (has_numchannels()) { + // optional int32 num_input_channels = 2; + if (has_num_input_channels()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( - this->numchannels()); + this->num_input_channels()); } - // optional int32 sampleRate = 3; - if (has_samplerate()) { + // optional int32 num_output_channels = 3; + if (has_num_output_channels()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( - this->samplerate()); + this->num_output_channels()); } - // optional int32 hasEchoCount = 4; - if (has_hasechocount()) { + // optional int32 sample_rate = 4; + if (has_sample_rate()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( - this->hasechocount()); + this->sample_rate()); } - // optional int32 hasVoiceCount = 5; - if (has_hasvoicecount()) { + // optional int32 analog_level_average = 6; + if (has_analog_level_average()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( - this->hasvoicecount()); + this->analog_level_average()); } - // optional int32 isSaturatedCount = 6; - if (has_issaturatedcount()) { + // optional int32 max_output_average = 7; + if (has_max_output_average()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( - this->issaturatedcount()); + this->max_output_average()); } - // optional .audio_processing_unittest.Test.EchoMetrics echoMetrics = 7; - if (has_echometrics()) { + // optional int32 has_echo_count = 8; + if (has_has_echo_count()) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->echometrics()); + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->has_echo_count()); } } + if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) { + // optional int32 has_voice_count = 9; + if (has_has_voice_count()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->has_voice_count()); + } + + // optional int32 is_saturated_count = 10; + if (has_is_saturated_count()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->is_saturated_count()); + } + + // optional .audio_processing_unittest.Test.EchoMetrics echo_metrics = 11; + if (has_echo_metrics()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->echo_metrics()); + } + + } + // repeated .audio_processing_unittest.Test.Frame frame = 5; + total_size += 1 * this->frame_size(); + for (int i = 0; i < this->frame_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->frame(i)); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = total_size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); @@ -898,27 +1140,39 @@ void Test::CheckTypeAndMergeFrom( void Test::MergeFrom(const Test& from) { GOOGLE_CHECK_NE(&from, this); + frame_.MergeFrom(from.frame_); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_numreversechannels()) { - set_numreversechannels(from.numreversechannels()); + if (from.has_num_reverse_channels()) { + set_num_reverse_channels(from.num_reverse_channels()); } - if (from.has_numchannels()) { - set_numchannels(from.numchannels()); + if (from.has_num_input_channels()) { + set_num_input_channels(from.num_input_channels()); } - if (from.has_samplerate()) { - set_samplerate(from.samplerate()); + if (from.has_num_output_channels()) { + set_num_output_channels(from.num_output_channels()); } - if (from.has_hasechocount()) { - set_hasechocount(from.hasechocount()); + if (from.has_sample_rate()) { + set_sample_rate(from.sample_rate()); } - if (from.has_hasvoicecount()) { - set_hasvoicecount(from.hasvoicecount()); + if (from.has_analog_level_average()) { + set_analog_level_average(from.analog_level_average()); } - if (from.has_issaturatedcount()) { - set_issaturatedcount(from.issaturatedcount()); + if (from.has_max_output_average()) { + set_max_output_average(from.max_output_average()); } - if (from.has_echometrics()) { - mutable_echometrics()->::audio_processing_unittest::Test_EchoMetrics::MergeFrom(from.echometrics()); + if (from.has_has_echo_count()) { + set_has_echo_count(from.has_echo_count()); + } + } + if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) { + if (from.has_has_voice_count()) { + set_has_voice_count(from.has_voice_count()); + } + if (from.has_is_saturated_count()) { + set_is_saturated_count(from.is_saturated_count()); + } + if (from.has_echo_metrics()) { + mutable_echo_metrics()->::audio_processing_unittest::Test_EchoMetrics::MergeFrom(from.echo_metrics()); } } } @@ -936,13 +1190,17 @@ bool Test::IsInitialized() const { void Test::Swap(Test* other) { if (other != this) { - std::swap(numreversechannels_, other->numreversechannels_); - std::swap(numchannels_, other->numchannels_); - std::swap(samplerate_, other->samplerate_); - std::swap(hasechocount_, other->hasechocount_); - std::swap(hasvoicecount_, other->hasvoicecount_); - std::swap(issaturatedcount_, other->issaturatedcount_); - std::swap(echometrics_, other->echometrics_); + std::swap(num_reverse_channels_, other->num_reverse_channels_); + std::swap(num_input_channels_, other->num_input_channels_); + std::swap(num_output_channels_, other->num_output_channels_); + std::swap(sample_rate_, other->sample_rate_); + frame_.Swap(&other->frame_); + std::swap(analog_level_average_, other->analog_level_average_); + std::swap(max_output_average_, other->max_output_average_); + std::swap(has_echo_count_, other->has_echo_count_); + std::swap(has_voice_count_, other->has_voice_count_); + std::swap(is_saturated_count_, other->is_saturated_count_); + std::swap(echo_metrics_, other->echo_metrics_); std::swap(_has_bits_[0], other->_has_bits_[0]); std::swap(_cached_size_, other->_cached_size_); } diff --git a/src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.pb.h b/src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.pb.h index 34c21b2f40..094295dca2 100644 --- a/src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.pb.h +++ b/src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.pb.h @@ -32,12 +32,72 @@ void protobuf_AssignDesc_audio_5fprocessing_5funittest_2eproto(); void protobuf_ShutdownFile_audio_5fprocessing_5funittest_2eproto(); class Test; +class Test_Frame; class Test_Statistic; class Test_EchoMetrics; class OutputData; // =================================================================== +class Test_Frame : public ::google::protobuf::MessageLite { + public: + Test_Frame(); + virtual ~Test_Frame(); + + Test_Frame(const Test_Frame& from); + + inline Test_Frame& operator=(const Test_Frame& from) { + CopyFrom(from); + return *this; + } + + static const Test_Frame& default_instance(); + + void Swap(Test_Frame* other); + + // implements Message ---------------------------------------------- + + Test_Frame* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const Test_Frame& from); + void MergeFrom(const Test_Frame& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:audio_processing_unittest.Test.Frame) + private: + + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[1]; + + friend void protobuf_AddDesc_audio_5fprocessing_5funittest_2eproto(); + friend void protobuf_AssignDesc_audio_5fprocessing_5funittest_2eproto(); + friend void protobuf_ShutdownFile_audio_5fprocessing_5funittest_2eproto(); + + void InitAsDefaultInstance(); + static Test_Frame* default_instance_; +}; +// ------------------------------------------------------------------- + class Test_Statistic : public ::google::protobuf::MessageLite { public: Test_Statistic(); @@ -180,53 +240,53 @@ class Test_EchoMetrics : public ::google::protobuf::MessageLite { // accessors ------------------------------------------------------- - // optional .audio_processing_unittest.Test.Statistic residualEchoReturnLoss = 1; - inline bool has_residualechoreturnloss() const; - inline void clear_residualechoreturnloss(); + // optional .audio_processing_unittest.Test.Statistic residual_echo_return_loss = 1; + inline bool has_residual_echo_return_loss() const; + inline void clear_residual_echo_return_loss(); static const int kResidualEchoReturnLossFieldNumber = 1; - inline const ::audio_processing_unittest::Test_Statistic& residualechoreturnloss() const; - inline ::audio_processing_unittest::Test_Statistic* mutable_residualechoreturnloss(); - inline ::audio_processing_unittest::Test_Statistic* release_residualechoreturnloss(); + inline const ::audio_processing_unittest::Test_Statistic& residual_echo_return_loss() const; + inline ::audio_processing_unittest::Test_Statistic* mutable_residual_echo_return_loss(); + inline ::audio_processing_unittest::Test_Statistic* release_residual_echo_return_loss(); - // optional .audio_processing_unittest.Test.Statistic echoReturnLoss = 2; - inline bool has_echoreturnloss() const; - inline void clear_echoreturnloss(); + // optional .audio_processing_unittest.Test.Statistic echo_return_loss = 2; + inline bool has_echo_return_loss() const; + inline void clear_echo_return_loss(); static const int kEchoReturnLossFieldNumber = 2; - inline const ::audio_processing_unittest::Test_Statistic& echoreturnloss() const; - inline ::audio_processing_unittest::Test_Statistic* mutable_echoreturnloss(); - inline ::audio_processing_unittest::Test_Statistic* release_echoreturnloss(); + inline const ::audio_processing_unittest::Test_Statistic& echo_return_loss() const; + inline ::audio_processing_unittest::Test_Statistic* mutable_echo_return_loss(); + inline ::audio_processing_unittest::Test_Statistic* release_echo_return_loss(); - // optional .audio_processing_unittest.Test.Statistic echoReturnLossEnhancement = 3; - inline bool has_echoreturnlossenhancement() const; - inline void clear_echoreturnlossenhancement(); + // optional .audio_processing_unittest.Test.Statistic echo_return_loss_enhancement = 3; + inline bool has_echo_return_loss_enhancement() const; + inline void clear_echo_return_loss_enhancement(); static const int kEchoReturnLossEnhancementFieldNumber = 3; - inline const ::audio_processing_unittest::Test_Statistic& echoreturnlossenhancement() const; - inline ::audio_processing_unittest::Test_Statistic* mutable_echoreturnlossenhancement(); - inline ::audio_processing_unittest::Test_Statistic* release_echoreturnlossenhancement(); + inline const ::audio_processing_unittest::Test_Statistic& echo_return_loss_enhancement() const; + inline ::audio_processing_unittest::Test_Statistic* mutable_echo_return_loss_enhancement(); + inline ::audio_processing_unittest::Test_Statistic* release_echo_return_loss_enhancement(); - // optional .audio_processing_unittest.Test.Statistic aNlp = 4; - inline bool has_anlp() const; - inline void clear_anlp(); + // optional .audio_processing_unittest.Test.Statistic a_nlp = 4; + inline bool has_a_nlp() const; + inline void clear_a_nlp(); static const int kANlpFieldNumber = 4; - inline const ::audio_processing_unittest::Test_Statistic& anlp() const; - inline ::audio_processing_unittest::Test_Statistic* mutable_anlp(); - inline ::audio_processing_unittest::Test_Statistic* release_anlp(); + inline const ::audio_processing_unittest::Test_Statistic& a_nlp() const; + inline ::audio_processing_unittest::Test_Statistic* mutable_a_nlp(); + inline ::audio_processing_unittest::Test_Statistic* release_a_nlp(); // @@protoc_insertion_point(class_scope:audio_processing_unittest.Test.EchoMetrics) private: - inline void set_has_residualechoreturnloss(); - inline void clear_has_residualechoreturnloss(); - inline void set_has_echoreturnloss(); - inline void clear_has_echoreturnloss(); - inline void set_has_echoreturnlossenhancement(); - inline void clear_has_echoreturnlossenhancement(); - inline void set_has_anlp(); - inline void clear_has_anlp(); + inline void set_has_residual_echo_return_loss(); + inline void clear_has_residual_echo_return_loss(); + inline void set_has_echo_return_loss(); + inline void clear_has_echo_return_loss(); + inline void set_has_echo_return_loss_enhancement(); + inline void clear_has_echo_return_loss_enhancement(); + inline void set_has_a_nlp(); + inline void clear_has_a_nlp(); - ::audio_processing_unittest::Test_Statistic* residualechoreturnloss_; - ::audio_processing_unittest::Test_Statistic* echoreturnloss_; - ::audio_processing_unittest::Test_Statistic* echoreturnlossenhancement_; - ::audio_processing_unittest::Test_Statistic* anlp_; + ::audio_processing_unittest::Test_Statistic* residual_echo_return_loss_; + ::audio_processing_unittest::Test_Statistic* echo_return_loss_; + ::audio_processing_unittest::Test_Statistic* echo_return_loss_enhancement_; + ::audio_processing_unittest::Test_Statistic* a_nlp_; mutable int _cached_size_; ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32]; @@ -281,88 +341,132 @@ class Test : public ::google::protobuf::MessageLite { // nested types ---------------------------------------------------- + typedef Test_Frame Frame; typedef Test_Statistic Statistic; typedef Test_EchoMetrics EchoMetrics; // accessors ------------------------------------------------------- - // optional int32 numReverseChannels = 1; - inline bool has_numreversechannels() const; - inline void clear_numreversechannels(); + // optional int32 num_reverse_channels = 1; + inline bool has_num_reverse_channels() const; + inline void clear_num_reverse_channels(); static const int kNumReverseChannelsFieldNumber = 1; - inline ::google::protobuf::int32 numreversechannels() const; - inline void set_numreversechannels(::google::protobuf::int32 value); + inline ::google::protobuf::int32 num_reverse_channels() const; + inline void set_num_reverse_channels(::google::protobuf::int32 value); - // optional int32 numChannels = 2; - inline bool has_numchannels() const; - inline void clear_numchannels(); - static const int kNumChannelsFieldNumber = 2; - inline ::google::protobuf::int32 numchannels() const; - inline void set_numchannels(::google::protobuf::int32 value); + // optional int32 num_input_channels = 2; + inline bool has_num_input_channels() const; + inline void clear_num_input_channels(); + static const int kNumInputChannelsFieldNumber = 2; + inline ::google::protobuf::int32 num_input_channels() const; + inline void set_num_input_channels(::google::protobuf::int32 value); - // optional int32 sampleRate = 3; - inline bool has_samplerate() const; - inline void clear_samplerate(); - static const int kSampleRateFieldNumber = 3; - inline ::google::protobuf::int32 samplerate() const; - inline void set_samplerate(::google::protobuf::int32 value); + // optional int32 num_output_channels = 3; + inline bool has_num_output_channels() const; + inline void clear_num_output_channels(); + static const int kNumOutputChannelsFieldNumber = 3; + inline ::google::protobuf::int32 num_output_channels() const; + inline void set_num_output_channels(::google::protobuf::int32 value); - // optional int32 hasEchoCount = 4; - inline bool has_hasechocount() const; - inline void clear_hasechocount(); - static const int kHasEchoCountFieldNumber = 4; - inline ::google::protobuf::int32 hasechocount() const; - inline void set_hasechocount(::google::protobuf::int32 value); + // optional int32 sample_rate = 4; + inline bool has_sample_rate() const; + inline void clear_sample_rate(); + static const int kSampleRateFieldNumber = 4; + inline ::google::protobuf::int32 sample_rate() const; + inline void set_sample_rate(::google::protobuf::int32 value); - // optional int32 hasVoiceCount = 5; - inline bool has_hasvoicecount() const; - inline void clear_hasvoicecount(); - static const int kHasVoiceCountFieldNumber = 5; - inline ::google::protobuf::int32 hasvoicecount() const; - inline void set_hasvoicecount(::google::protobuf::int32 value); + // repeated .audio_processing_unittest.Test.Frame frame = 5; + inline int frame_size() const; + inline void clear_frame(); + static const int kFrameFieldNumber = 5; + inline const ::audio_processing_unittest::Test_Frame& frame(int index) const; + inline ::audio_processing_unittest::Test_Frame* mutable_frame(int index); + inline ::audio_processing_unittest::Test_Frame* add_frame(); + inline const ::google::protobuf::RepeatedPtrField< ::audio_processing_unittest::Test_Frame >& + frame() const; + inline ::google::protobuf::RepeatedPtrField< ::audio_processing_unittest::Test_Frame >* + mutable_frame(); - // optional int32 isSaturatedCount = 6; - inline bool has_issaturatedcount() const; - inline void clear_issaturatedcount(); - static const int kIsSaturatedCountFieldNumber = 6; - inline ::google::protobuf::int32 issaturatedcount() const; - inline void set_issaturatedcount(::google::protobuf::int32 value); + // optional int32 analog_level_average = 6; + inline bool has_analog_level_average() const; + inline void clear_analog_level_average(); + static const int kAnalogLevelAverageFieldNumber = 6; + inline ::google::protobuf::int32 analog_level_average() const; + inline void set_analog_level_average(::google::protobuf::int32 value); - // optional .audio_processing_unittest.Test.EchoMetrics echoMetrics = 7; - inline bool has_echometrics() const; - inline void clear_echometrics(); - static const int kEchoMetricsFieldNumber = 7; - inline const ::audio_processing_unittest::Test_EchoMetrics& echometrics() const; - inline ::audio_processing_unittest::Test_EchoMetrics* mutable_echometrics(); - inline ::audio_processing_unittest::Test_EchoMetrics* release_echometrics(); + // optional int32 max_output_average = 7; + inline bool has_max_output_average() const; + inline void clear_max_output_average(); + static const int kMaxOutputAverageFieldNumber = 7; + inline ::google::protobuf::int32 max_output_average() const; + inline void set_max_output_average(::google::protobuf::int32 value); + + // optional int32 has_echo_count = 8; + inline bool has_has_echo_count() const; + inline void clear_has_echo_count(); + static const int kHasEchoCountFieldNumber = 8; + inline ::google::protobuf::int32 has_echo_count() const; + inline void set_has_echo_count(::google::protobuf::int32 value); + + // optional int32 has_voice_count = 9; + inline bool has_has_voice_count() const; + inline void clear_has_voice_count(); + static const int kHasVoiceCountFieldNumber = 9; + inline ::google::protobuf::int32 has_voice_count() const; + inline void set_has_voice_count(::google::protobuf::int32 value); + + // optional int32 is_saturated_count = 10; + inline bool has_is_saturated_count() const; + inline void clear_is_saturated_count(); + static const int kIsSaturatedCountFieldNumber = 10; + inline ::google::protobuf::int32 is_saturated_count() const; + inline void set_is_saturated_count(::google::protobuf::int32 value); + + // optional .audio_processing_unittest.Test.EchoMetrics echo_metrics = 11; + inline bool has_echo_metrics() const; + inline void clear_echo_metrics(); + static const int kEchoMetricsFieldNumber = 11; + inline const ::audio_processing_unittest::Test_EchoMetrics& echo_metrics() const; + inline ::audio_processing_unittest::Test_EchoMetrics* mutable_echo_metrics(); + inline ::audio_processing_unittest::Test_EchoMetrics* release_echo_metrics(); // @@protoc_insertion_point(class_scope:audio_processing_unittest.Test) private: - inline void set_has_numreversechannels(); - inline void clear_has_numreversechannels(); - inline void set_has_numchannels(); - inline void clear_has_numchannels(); - inline void set_has_samplerate(); - inline void clear_has_samplerate(); - inline void set_has_hasechocount(); - inline void clear_has_hasechocount(); - inline void set_has_hasvoicecount(); - inline void clear_has_hasvoicecount(); - inline void set_has_issaturatedcount(); - inline void clear_has_issaturatedcount(); - inline void set_has_echometrics(); - inline void clear_has_echometrics(); + inline void set_has_num_reverse_channels(); + inline void clear_has_num_reverse_channels(); + inline void set_has_num_input_channels(); + inline void clear_has_num_input_channels(); + inline void set_has_num_output_channels(); + inline void clear_has_num_output_channels(); + inline void set_has_sample_rate(); + inline void clear_has_sample_rate(); + inline void set_has_analog_level_average(); + inline void clear_has_analog_level_average(); + inline void set_has_max_output_average(); + inline void clear_has_max_output_average(); + inline void set_has_has_echo_count(); + inline void clear_has_has_echo_count(); + inline void set_has_has_voice_count(); + inline void clear_has_has_voice_count(); + inline void set_has_is_saturated_count(); + inline void clear_has_is_saturated_count(); + inline void set_has_echo_metrics(); + inline void clear_has_echo_metrics(); - ::google::protobuf::int32 numreversechannels_; - ::google::protobuf::int32 numchannels_; - ::google::protobuf::int32 samplerate_; - ::google::protobuf::int32 hasechocount_; - ::google::protobuf::int32 hasvoicecount_; - ::google::protobuf::int32 issaturatedcount_; - ::audio_processing_unittest::Test_EchoMetrics* echometrics_; + ::google::protobuf::int32 num_reverse_channels_; + ::google::protobuf::int32 num_input_channels_; + ::google::protobuf::int32 num_output_channels_; + ::google::protobuf::int32 sample_rate_; + ::google::protobuf::RepeatedPtrField< ::audio_processing_unittest::Test_Frame > frame_; + ::google::protobuf::int32 analog_level_average_; + ::google::protobuf::int32 max_output_average_; + ::google::protobuf::int32 has_echo_count_; + ::google::protobuf::int32 has_voice_count_; + ::audio_processing_unittest::Test_EchoMetrics* echo_metrics_; + ::google::protobuf::int32 is_saturated_count_; mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(7 + 31) / 32]; + ::google::protobuf::uint32 _has_bits_[(11 + 31) / 32]; friend void protobuf_AddDesc_audio_5fprocessing_5funittest_2eproto(); friend void protobuf_AssignDesc_audio_5fprocessing_5funittest_2eproto(); @@ -448,6 +552,10 @@ class OutputData : public ::google::protobuf::MessageLite { // =================================================================== +// Test_Frame + +// ------------------------------------------------------------------- + // Test_Statistic // optional int32 instant = 1; @@ -542,119 +650,119 @@ inline void Test_Statistic::set_minimum(::google::protobuf::int32 value) { // Test_EchoMetrics -// optional .audio_processing_unittest.Test.Statistic residualEchoReturnLoss = 1; -inline bool Test_EchoMetrics::has_residualechoreturnloss() const { +// optional .audio_processing_unittest.Test.Statistic residual_echo_return_loss = 1; +inline bool Test_EchoMetrics::has_residual_echo_return_loss() const { return (_has_bits_[0] & 0x00000001u) != 0; } -inline void Test_EchoMetrics::set_has_residualechoreturnloss() { +inline void Test_EchoMetrics::set_has_residual_echo_return_loss() { _has_bits_[0] |= 0x00000001u; } -inline void Test_EchoMetrics::clear_has_residualechoreturnloss() { +inline void Test_EchoMetrics::clear_has_residual_echo_return_loss() { _has_bits_[0] &= ~0x00000001u; } -inline void Test_EchoMetrics::clear_residualechoreturnloss() { - if (residualechoreturnloss_ != NULL) residualechoreturnloss_->::audio_processing_unittest::Test_Statistic::Clear(); - clear_has_residualechoreturnloss(); +inline void Test_EchoMetrics::clear_residual_echo_return_loss() { + if (residual_echo_return_loss_ != NULL) residual_echo_return_loss_->::audio_processing_unittest::Test_Statistic::Clear(); + clear_has_residual_echo_return_loss(); } -inline const ::audio_processing_unittest::Test_Statistic& Test_EchoMetrics::residualechoreturnloss() const { - return residualechoreturnloss_ != NULL ? *residualechoreturnloss_ : *default_instance_->residualechoreturnloss_; +inline const ::audio_processing_unittest::Test_Statistic& Test_EchoMetrics::residual_echo_return_loss() const { + return residual_echo_return_loss_ != NULL ? *residual_echo_return_loss_ : *default_instance_->residual_echo_return_loss_; } -inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::mutable_residualechoreturnloss() { - set_has_residualechoreturnloss(); - if (residualechoreturnloss_ == NULL) residualechoreturnloss_ = new ::audio_processing_unittest::Test_Statistic; - return residualechoreturnloss_; +inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::mutable_residual_echo_return_loss() { + set_has_residual_echo_return_loss(); + if (residual_echo_return_loss_ == NULL) residual_echo_return_loss_ = new ::audio_processing_unittest::Test_Statistic; + return residual_echo_return_loss_; } -inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::release_residualechoreturnloss() { - clear_has_residualechoreturnloss(); - ::audio_processing_unittest::Test_Statistic* temp = residualechoreturnloss_; - residualechoreturnloss_ = NULL; +inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::release_residual_echo_return_loss() { + clear_has_residual_echo_return_loss(); + ::audio_processing_unittest::Test_Statistic* temp = residual_echo_return_loss_; + residual_echo_return_loss_ = NULL; return temp; } -// optional .audio_processing_unittest.Test.Statistic echoReturnLoss = 2; -inline bool Test_EchoMetrics::has_echoreturnloss() const { +// optional .audio_processing_unittest.Test.Statistic echo_return_loss = 2; +inline bool Test_EchoMetrics::has_echo_return_loss() const { return (_has_bits_[0] & 0x00000002u) != 0; } -inline void Test_EchoMetrics::set_has_echoreturnloss() { +inline void Test_EchoMetrics::set_has_echo_return_loss() { _has_bits_[0] |= 0x00000002u; } -inline void Test_EchoMetrics::clear_has_echoreturnloss() { +inline void Test_EchoMetrics::clear_has_echo_return_loss() { _has_bits_[0] &= ~0x00000002u; } -inline void Test_EchoMetrics::clear_echoreturnloss() { - if (echoreturnloss_ != NULL) echoreturnloss_->::audio_processing_unittest::Test_Statistic::Clear(); - clear_has_echoreturnloss(); +inline void Test_EchoMetrics::clear_echo_return_loss() { + if (echo_return_loss_ != NULL) echo_return_loss_->::audio_processing_unittest::Test_Statistic::Clear(); + clear_has_echo_return_loss(); } -inline const ::audio_processing_unittest::Test_Statistic& Test_EchoMetrics::echoreturnloss() const { - return echoreturnloss_ != NULL ? *echoreturnloss_ : *default_instance_->echoreturnloss_; +inline const ::audio_processing_unittest::Test_Statistic& Test_EchoMetrics::echo_return_loss() const { + return echo_return_loss_ != NULL ? *echo_return_loss_ : *default_instance_->echo_return_loss_; } -inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::mutable_echoreturnloss() { - set_has_echoreturnloss(); - if (echoreturnloss_ == NULL) echoreturnloss_ = new ::audio_processing_unittest::Test_Statistic; - return echoreturnloss_; +inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::mutable_echo_return_loss() { + set_has_echo_return_loss(); + if (echo_return_loss_ == NULL) echo_return_loss_ = new ::audio_processing_unittest::Test_Statistic; + return echo_return_loss_; } -inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::release_echoreturnloss() { - clear_has_echoreturnloss(); - ::audio_processing_unittest::Test_Statistic* temp = echoreturnloss_; - echoreturnloss_ = NULL; +inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::release_echo_return_loss() { + clear_has_echo_return_loss(); + ::audio_processing_unittest::Test_Statistic* temp = echo_return_loss_; + echo_return_loss_ = NULL; return temp; } -// optional .audio_processing_unittest.Test.Statistic echoReturnLossEnhancement = 3; -inline bool Test_EchoMetrics::has_echoreturnlossenhancement() const { +// optional .audio_processing_unittest.Test.Statistic echo_return_loss_enhancement = 3; +inline bool Test_EchoMetrics::has_echo_return_loss_enhancement() const { return (_has_bits_[0] & 0x00000004u) != 0; } -inline void Test_EchoMetrics::set_has_echoreturnlossenhancement() { +inline void Test_EchoMetrics::set_has_echo_return_loss_enhancement() { _has_bits_[0] |= 0x00000004u; } -inline void Test_EchoMetrics::clear_has_echoreturnlossenhancement() { +inline void Test_EchoMetrics::clear_has_echo_return_loss_enhancement() { _has_bits_[0] &= ~0x00000004u; } -inline void Test_EchoMetrics::clear_echoreturnlossenhancement() { - if (echoreturnlossenhancement_ != NULL) echoreturnlossenhancement_->::audio_processing_unittest::Test_Statistic::Clear(); - clear_has_echoreturnlossenhancement(); +inline void Test_EchoMetrics::clear_echo_return_loss_enhancement() { + if (echo_return_loss_enhancement_ != NULL) echo_return_loss_enhancement_->::audio_processing_unittest::Test_Statistic::Clear(); + clear_has_echo_return_loss_enhancement(); } -inline const ::audio_processing_unittest::Test_Statistic& Test_EchoMetrics::echoreturnlossenhancement() const { - return echoreturnlossenhancement_ != NULL ? *echoreturnlossenhancement_ : *default_instance_->echoreturnlossenhancement_; +inline const ::audio_processing_unittest::Test_Statistic& Test_EchoMetrics::echo_return_loss_enhancement() const { + return echo_return_loss_enhancement_ != NULL ? *echo_return_loss_enhancement_ : *default_instance_->echo_return_loss_enhancement_; } -inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::mutable_echoreturnlossenhancement() { - set_has_echoreturnlossenhancement(); - if (echoreturnlossenhancement_ == NULL) echoreturnlossenhancement_ = new ::audio_processing_unittest::Test_Statistic; - return echoreturnlossenhancement_; +inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::mutable_echo_return_loss_enhancement() { + set_has_echo_return_loss_enhancement(); + if (echo_return_loss_enhancement_ == NULL) echo_return_loss_enhancement_ = new ::audio_processing_unittest::Test_Statistic; + return echo_return_loss_enhancement_; } -inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::release_echoreturnlossenhancement() { - clear_has_echoreturnlossenhancement(); - ::audio_processing_unittest::Test_Statistic* temp = echoreturnlossenhancement_; - echoreturnlossenhancement_ = NULL; +inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::release_echo_return_loss_enhancement() { + clear_has_echo_return_loss_enhancement(); + ::audio_processing_unittest::Test_Statistic* temp = echo_return_loss_enhancement_; + echo_return_loss_enhancement_ = NULL; return temp; } -// optional .audio_processing_unittest.Test.Statistic aNlp = 4; -inline bool Test_EchoMetrics::has_anlp() const { +// optional .audio_processing_unittest.Test.Statistic a_nlp = 4; +inline bool Test_EchoMetrics::has_a_nlp() const { return (_has_bits_[0] & 0x00000008u) != 0; } -inline void Test_EchoMetrics::set_has_anlp() { +inline void Test_EchoMetrics::set_has_a_nlp() { _has_bits_[0] |= 0x00000008u; } -inline void Test_EchoMetrics::clear_has_anlp() { +inline void Test_EchoMetrics::clear_has_a_nlp() { _has_bits_[0] &= ~0x00000008u; } -inline void Test_EchoMetrics::clear_anlp() { - if (anlp_ != NULL) anlp_->::audio_processing_unittest::Test_Statistic::Clear(); - clear_has_anlp(); +inline void Test_EchoMetrics::clear_a_nlp() { + if (a_nlp_ != NULL) a_nlp_->::audio_processing_unittest::Test_Statistic::Clear(); + clear_has_a_nlp(); } -inline const ::audio_processing_unittest::Test_Statistic& Test_EchoMetrics::anlp() const { - return anlp_ != NULL ? *anlp_ : *default_instance_->anlp_; +inline const ::audio_processing_unittest::Test_Statistic& Test_EchoMetrics::a_nlp() const { + return a_nlp_ != NULL ? *a_nlp_ : *default_instance_->a_nlp_; } -inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::mutable_anlp() { - set_has_anlp(); - if (anlp_ == NULL) anlp_ = new ::audio_processing_unittest::Test_Statistic; - return anlp_; +inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::mutable_a_nlp() { + set_has_a_nlp(); + if (a_nlp_ == NULL) a_nlp_ = new ::audio_processing_unittest::Test_Statistic; + return a_nlp_; } -inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::release_anlp() { - clear_has_anlp(); - ::audio_processing_unittest::Test_Statistic* temp = anlp_; - anlp_ = NULL; +inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::release_a_nlp() { + clear_has_a_nlp(); + ::audio_processing_unittest::Test_Statistic* temp = a_nlp_; + a_nlp_ = NULL; return temp; } @@ -662,164 +770,255 @@ inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::release_an // Test -// optional int32 numReverseChannels = 1; -inline bool Test::has_numreversechannels() const { +// optional int32 num_reverse_channels = 1; +inline bool Test::has_num_reverse_channels() const { return (_has_bits_[0] & 0x00000001u) != 0; } -inline void Test::set_has_numreversechannels() { +inline void Test::set_has_num_reverse_channels() { _has_bits_[0] |= 0x00000001u; } -inline void Test::clear_has_numreversechannels() { +inline void Test::clear_has_num_reverse_channels() { _has_bits_[0] &= ~0x00000001u; } -inline void Test::clear_numreversechannels() { - numreversechannels_ = 0; - clear_has_numreversechannels(); +inline void Test::clear_num_reverse_channels() { + num_reverse_channels_ = 0; + clear_has_num_reverse_channels(); } -inline ::google::protobuf::int32 Test::numreversechannels() const { - return numreversechannels_; +inline ::google::protobuf::int32 Test::num_reverse_channels() const { + return num_reverse_channels_; } -inline void Test::set_numreversechannels(::google::protobuf::int32 value) { - set_has_numreversechannels(); - numreversechannels_ = value; +inline void Test::set_num_reverse_channels(::google::protobuf::int32 value) { + set_has_num_reverse_channels(); + num_reverse_channels_ = value; } -// optional int32 numChannels = 2; -inline bool Test::has_numchannels() const { +// optional int32 num_input_channels = 2; +inline bool Test::has_num_input_channels() const { return (_has_bits_[0] & 0x00000002u) != 0; } -inline void Test::set_has_numchannels() { +inline void Test::set_has_num_input_channels() { _has_bits_[0] |= 0x00000002u; } -inline void Test::clear_has_numchannels() { +inline void Test::clear_has_num_input_channels() { _has_bits_[0] &= ~0x00000002u; } -inline void Test::clear_numchannels() { - numchannels_ = 0; - clear_has_numchannels(); +inline void Test::clear_num_input_channels() { + num_input_channels_ = 0; + clear_has_num_input_channels(); } -inline ::google::protobuf::int32 Test::numchannels() const { - return numchannels_; +inline ::google::protobuf::int32 Test::num_input_channels() const { + return num_input_channels_; } -inline void Test::set_numchannels(::google::protobuf::int32 value) { - set_has_numchannels(); - numchannels_ = value; +inline void Test::set_num_input_channels(::google::protobuf::int32 value) { + set_has_num_input_channels(); + num_input_channels_ = value; } -// optional int32 sampleRate = 3; -inline bool Test::has_samplerate() const { +// optional int32 num_output_channels = 3; +inline bool Test::has_num_output_channels() const { return (_has_bits_[0] & 0x00000004u) != 0; } -inline void Test::set_has_samplerate() { +inline void Test::set_has_num_output_channels() { _has_bits_[0] |= 0x00000004u; } -inline void Test::clear_has_samplerate() { +inline void Test::clear_has_num_output_channels() { _has_bits_[0] &= ~0x00000004u; } -inline void Test::clear_samplerate() { - samplerate_ = 0; - clear_has_samplerate(); +inline void Test::clear_num_output_channels() { + num_output_channels_ = 0; + clear_has_num_output_channels(); } -inline ::google::protobuf::int32 Test::samplerate() const { - return samplerate_; +inline ::google::protobuf::int32 Test::num_output_channels() const { + return num_output_channels_; } -inline void Test::set_samplerate(::google::protobuf::int32 value) { - set_has_samplerate(); - samplerate_ = value; +inline void Test::set_num_output_channels(::google::protobuf::int32 value) { + set_has_num_output_channels(); + num_output_channels_ = value; } -// optional int32 hasEchoCount = 4; -inline bool Test::has_hasechocount() const { +// optional int32 sample_rate = 4; +inline bool Test::has_sample_rate() const { return (_has_bits_[0] & 0x00000008u) != 0; } -inline void Test::set_has_hasechocount() { +inline void Test::set_has_sample_rate() { _has_bits_[0] |= 0x00000008u; } -inline void Test::clear_has_hasechocount() { +inline void Test::clear_has_sample_rate() { _has_bits_[0] &= ~0x00000008u; } -inline void Test::clear_hasechocount() { - hasechocount_ = 0; - clear_has_hasechocount(); +inline void Test::clear_sample_rate() { + sample_rate_ = 0; + clear_has_sample_rate(); } -inline ::google::protobuf::int32 Test::hasechocount() const { - return hasechocount_; +inline ::google::protobuf::int32 Test::sample_rate() const { + return sample_rate_; } -inline void Test::set_hasechocount(::google::protobuf::int32 value) { - set_has_hasechocount(); - hasechocount_ = value; +inline void Test::set_sample_rate(::google::protobuf::int32 value) { + set_has_sample_rate(); + sample_rate_ = value; } -// optional int32 hasVoiceCount = 5; -inline bool Test::has_hasvoicecount() const { - return (_has_bits_[0] & 0x00000010u) != 0; +// repeated .audio_processing_unittest.Test.Frame frame = 5; +inline int Test::frame_size() const { + return frame_.size(); } -inline void Test::set_has_hasvoicecount() { - _has_bits_[0] |= 0x00000010u; +inline void Test::clear_frame() { + frame_.Clear(); } -inline void Test::clear_has_hasvoicecount() { - _has_bits_[0] &= ~0x00000010u; +inline const ::audio_processing_unittest::Test_Frame& Test::frame(int index) const { + return frame_.Get(index); } -inline void Test::clear_hasvoicecount() { - hasvoicecount_ = 0; - clear_has_hasvoicecount(); +inline ::audio_processing_unittest::Test_Frame* Test::mutable_frame(int index) { + return frame_.Mutable(index); } -inline ::google::protobuf::int32 Test::hasvoicecount() const { - return hasvoicecount_; +inline ::audio_processing_unittest::Test_Frame* Test::add_frame() { + return frame_.Add(); } -inline void Test::set_hasvoicecount(::google::protobuf::int32 value) { - set_has_hasvoicecount(); - hasvoicecount_ = value; +inline const ::google::protobuf::RepeatedPtrField< ::audio_processing_unittest::Test_Frame >& +Test::frame() const { + return frame_; +} +inline ::google::protobuf::RepeatedPtrField< ::audio_processing_unittest::Test_Frame >* +Test::mutable_frame() { + return &frame_; } -// optional int32 isSaturatedCount = 6; -inline bool Test::has_issaturatedcount() const { +// optional int32 analog_level_average = 6; +inline bool Test::has_analog_level_average() const { return (_has_bits_[0] & 0x00000020u) != 0; } -inline void Test::set_has_issaturatedcount() { +inline void Test::set_has_analog_level_average() { _has_bits_[0] |= 0x00000020u; } -inline void Test::clear_has_issaturatedcount() { +inline void Test::clear_has_analog_level_average() { _has_bits_[0] &= ~0x00000020u; } -inline void Test::clear_issaturatedcount() { - issaturatedcount_ = 0; - clear_has_issaturatedcount(); +inline void Test::clear_analog_level_average() { + analog_level_average_ = 0; + clear_has_analog_level_average(); } -inline ::google::protobuf::int32 Test::issaturatedcount() const { - return issaturatedcount_; +inline ::google::protobuf::int32 Test::analog_level_average() const { + return analog_level_average_; } -inline void Test::set_issaturatedcount(::google::protobuf::int32 value) { - set_has_issaturatedcount(); - issaturatedcount_ = value; +inline void Test::set_analog_level_average(::google::protobuf::int32 value) { + set_has_analog_level_average(); + analog_level_average_ = value; } -// optional .audio_processing_unittest.Test.EchoMetrics echoMetrics = 7; -inline bool Test::has_echometrics() const { +// optional int32 max_output_average = 7; +inline bool Test::has_max_output_average() const { return (_has_bits_[0] & 0x00000040u) != 0; } -inline void Test::set_has_echometrics() { +inline void Test::set_has_max_output_average() { _has_bits_[0] |= 0x00000040u; } -inline void Test::clear_has_echometrics() { +inline void Test::clear_has_max_output_average() { _has_bits_[0] &= ~0x00000040u; } -inline void Test::clear_echometrics() { - if (echometrics_ != NULL) echometrics_->::audio_processing_unittest::Test_EchoMetrics::Clear(); - clear_has_echometrics(); +inline void Test::clear_max_output_average() { + max_output_average_ = 0; + clear_has_max_output_average(); } -inline const ::audio_processing_unittest::Test_EchoMetrics& Test::echometrics() const { - return echometrics_ != NULL ? *echometrics_ : *default_instance_->echometrics_; +inline ::google::protobuf::int32 Test::max_output_average() const { + return max_output_average_; } -inline ::audio_processing_unittest::Test_EchoMetrics* Test::mutable_echometrics() { - set_has_echometrics(); - if (echometrics_ == NULL) echometrics_ = new ::audio_processing_unittest::Test_EchoMetrics; - return echometrics_; +inline void Test::set_max_output_average(::google::protobuf::int32 value) { + set_has_max_output_average(); + max_output_average_ = value; } -inline ::audio_processing_unittest::Test_EchoMetrics* Test::release_echometrics() { - clear_has_echometrics(); - ::audio_processing_unittest::Test_EchoMetrics* temp = echometrics_; - echometrics_ = NULL; + +// optional int32 has_echo_count = 8; +inline bool Test::has_has_echo_count() const { + return (_has_bits_[0] & 0x00000080u) != 0; +} +inline void Test::set_has_has_echo_count() { + _has_bits_[0] |= 0x00000080u; +} +inline void Test::clear_has_has_echo_count() { + _has_bits_[0] &= ~0x00000080u; +} +inline void Test::clear_has_echo_count() { + has_echo_count_ = 0; + clear_has_has_echo_count(); +} +inline ::google::protobuf::int32 Test::has_echo_count() const { + return has_echo_count_; +} +inline void Test::set_has_echo_count(::google::protobuf::int32 value) { + set_has_has_echo_count(); + has_echo_count_ = value; +} + +// optional int32 has_voice_count = 9; +inline bool Test::has_has_voice_count() const { + return (_has_bits_[0] & 0x00000100u) != 0; +} +inline void Test::set_has_has_voice_count() { + _has_bits_[0] |= 0x00000100u; +} +inline void Test::clear_has_has_voice_count() { + _has_bits_[0] &= ~0x00000100u; +} +inline void Test::clear_has_voice_count() { + has_voice_count_ = 0; + clear_has_has_voice_count(); +} +inline ::google::protobuf::int32 Test::has_voice_count() const { + return has_voice_count_; +} +inline void Test::set_has_voice_count(::google::protobuf::int32 value) { + set_has_has_voice_count(); + has_voice_count_ = value; +} + +// optional int32 is_saturated_count = 10; +inline bool Test::has_is_saturated_count() const { + return (_has_bits_[0] & 0x00000200u) != 0; +} +inline void Test::set_has_is_saturated_count() { + _has_bits_[0] |= 0x00000200u; +} +inline void Test::clear_has_is_saturated_count() { + _has_bits_[0] &= ~0x00000200u; +} +inline void Test::clear_is_saturated_count() { + is_saturated_count_ = 0; + clear_has_is_saturated_count(); +} +inline ::google::protobuf::int32 Test::is_saturated_count() const { + return is_saturated_count_; +} +inline void Test::set_is_saturated_count(::google::protobuf::int32 value) { + set_has_is_saturated_count(); + is_saturated_count_ = value; +} + +// optional .audio_processing_unittest.Test.EchoMetrics echo_metrics = 11; +inline bool Test::has_echo_metrics() const { + return (_has_bits_[0] & 0x00000400u) != 0; +} +inline void Test::set_has_echo_metrics() { + _has_bits_[0] |= 0x00000400u; +} +inline void Test::clear_has_echo_metrics() { + _has_bits_[0] &= ~0x00000400u; +} +inline void Test::clear_echo_metrics() { + if (echo_metrics_ != NULL) echo_metrics_->::audio_processing_unittest::Test_EchoMetrics::Clear(); + clear_has_echo_metrics(); +} +inline const ::audio_processing_unittest::Test_EchoMetrics& Test::echo_metrics() const { + return echo_metrics_ != NULL ? *echo_metrics_ : *default_instance_->echo_metrics_; +} +inline ::audio_processing_unittest::Test_EchoMetrics* Test::mutable_echo_metrics() { + set_has_echo_metrics(); + if (echo_metrics_ == NULL) echo_metrics_ = new ::audio_processing_unittest::Test_EchoMetrics; + return echo_metrics_; +} +inline ::audio_processing_unittest::Test_EchoMetrics* Test::release_echo_metrics() { + clear_has_echo_metrics(); + ::audio_processing_unittest::Test_EchoMetrics* temp = echo_metrics_; + echo_metrics_ = NULL; return temp; } diff --git a/src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.proto b/src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.proto index 8520e64f22..00b7add637 100644 --- a/src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.proto +++ b/src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.proto @@ -2,13 +2,23 @@ package audio_processing_unittest; option optimize_for = LITE_RUNTIME; message Test { - optional int32 numReverseChannels = 1; - optional int32 numChannels = 2; - optional int32 sampleRate = 3; + optional int32 num_reverse_channels = 1; + optional int32 num_input_channels = 2; + optional int32 num_output_channels = 3; + optional int32 sample_rate = 4; + + message Frame { + } + + repeated Frame frame = 5; + + optional int32 analog_level_average = 6; + optional int32 max_output_average = 7; + + optional int32 has_echo_count = 8; + optional int32 has_voice_count = 9; + optional int32 is_saturated_count = 10; - optional int32 hasEchoCount = 4; - optional int32 hasVoiceCount = 5; - optional int32 isSaturatedCount = 6; message Statistic { optional int32 instant = 1; @@ -18,13 +28,13 @@ message Test { } message EchoMetrics { - optional Statistic residualEchoReturnLoss = 1; - optional Statistic echoReturnLoss = 2; - optional Statistic echoReturnLossEnhancement = 3; - optional Statistic aNlp = 4; + optional Statistic residual_echo_return_loss = 1; + optional Statistic echo_return_loss = 2; + optional Statistic echo_return_loss_enhancement = 3; + optional Statistic a_nlp = 4; } - optional EchoMetrics echoMetrics = 7; + optional EchoMetrics echo_metrics = 11; } message OutputData { diff --git a/src/modules/audio_processing/main/test/unit_test/unit_test.cc b/src/modules/audio_processing/main/test/unit_test/unit_test.cc index 275ac3fdd7..6946d82271 100644 --- a/src/modules/audio_processing/main/test/unit_test/unit_test.cc +++ b/src/modules/audio_processing/main/test/unit_test/unit_test.cc @@ -61,7 +61,6 @@ class ApmTest : public ::testing::Test { webrtc::AudioFrame* revframe_; FILE* far_file_; FILE* near_file_; - bool update_output_data_; }; ApmTest::ApmTest() @@ -122,16 +121,52 @@ void ApmTest::TearDown() { apm_ = NULL; } -void MixStereoToMono(WebRtc_Word16* stereo, +void MixStereoToMono(const WebRtc_Word16* stereo, WebRtc_Word16* mono, - int numSamples) { - for (int i = 0; i < numSamples; i++) { + int num_samples) { + for (int i = 0; i < num_samples; i++) { int int32 = (static_cast(stereo[i * 2]) + static_cast(stereo[i * 2 + 1])) >> 1; mono[i] = static_cast(int32); } } +template +T MaxValue(T a, T b) { + return a > b ? a : b; +} + +template +T AbsValue(T a) { + return a > 0 ? a : -a; +} + +WebRtc_Word16 MaxAudioFrame(const AudioFrame& frame) { + const int length = frame._payloadDataLengthInSamples * frame._audioChannel; + WebRtc_Word16 max = AbsValue(frame._payloadData[0]); + for (int i = 1; i < length; i++) { + max = MaxValue(max, AbsValue(frame._payloadData[i])); + } + + return max; +} + +void TestStats(const AudioProcessing::Statistic& test, + const audio_processing_unittest::Test::Statistic& reference) { + EXPECT_EQ(reference.instant(), test.instant); + EXPECT_EQ(reference.average(), test.average); + EXPECT_EQ(reference.maximum(), test.maximum); + EXPECT_EQ(reference.minimum(), test.minimum); +} + +void WriteStatsMessage(const AudioProcessing::Statistic& output, + audio_processing_unittest::Test::Statistic* message) { + message->set_instant(output.instant); + message->set_average(output.average); + message->set_maximum(output.maximum); + message->set_minimum(output.minimum); +} + void WriteMessageLiteToFile(const char* filename, const ::google::protobuf::MessageLite& message) { assert(filename != NULL); @@ -376,16 +411,19 @@ TEST_F(ApmTest, Process) { } else { // We don't have a file; add the required tests to the protobuf. - int rev_ch[] = {1, 2}; - int ch[] = {1, 2}; - int fs[] = {8000, 16000, 32000}; - for (size_t i = 0; i < sizeof(rev_ch) / sizeof(*rev_ch); i++) { - for (size_t j = 0; j < sizeof(ch) / sizeof(*ch); j++) { - for (size_t k = 0; k < sizeof(fs) / sizeof(*fs); k++) { + // TODO(ajm): vary the output channels as well? + const int channels[] = {1, 2}; + const int channels_size = sizeof(channels) / sizeof(*channels); + const int sample_rates[] = {8000, 16000, 32000}; + const int sample_rates_size = sizeof(sample_rates) / sizeof(*sample_rates); + for (size_t i = 0; i < channels_size; i++) { + for (size_t j = 0; j < channels_size; j++) { + for (size_t k = 0; k < sample_rates_size; k++) { audio_processing_unittest::Test* test = output_data.add_test(); - test->set_numreversechannels(rev_ch[i]); - test->set_numchannels(ch[j]); - test->set_samplerate(fs[k]); + test->set_num_reverse_channels(channels[i]); + test->set_num_input_channels(channels[j]); + test->set_num_output_channels(channels[j]); + test->set_sample_rate(sample_rates[k]); } } } @@ -419,29 +457,31 @@ TEST_F(ApmTest, Process) { printf("Running test %d of %d...\n", i + 1, output_data.test_size()); audio_processing_unittest::Test* test = output_data.mutable_test(i); - const int num_samples = test->samplerate() / 100; + const int num_samples = test->sample_rate() / 100; revframe_->_payloadDataLengthInSamples = num_samples; - revframe_->_audioChannel = test->numreversechannels(); - revframe_->_frequencyInHz = test->samplerate(); + revframe_->_audioChannel = test->num_reverse_channels(); + revframe_->_frequencyInHz = test->sample_rate(); frame_->_payloadDataLengthInSamples = num_samples; - frame_->_audioChannel = test->numchannels(); - frame_->_frequencyInHz = test->samplerate(); + frame_->_audioChannel = test->num_input_channels(); + frame_->_frequencyInHz = test->sample_rate(); EXPECT_EQ(apm_->kNoError, apm_->Initialize()); - ASSERT_EQ(apm_->kNoError, apm_->set_sample_rate_hz(test->samplerate())); + ASSERT_EQ(apm_->kNoError, apm_->set_sample_rate_hz(test->sample_rate())); ASSERT_EQ(apm_->kNoError, apm_->set_num_channels(frame_->_audioChannel, frame_->_audioChannel)); ASSERT_EQ(apm_->kNoError, apm_->set_num_reverse_channels(revframe_->_audioChannel)); - + int frame_count = 0; int has_echo_count = 0; int has_voice_count = 0; int is_saturated_count = 0; + int analog_level = 127; + int analog_level_average = 0; + int max_output_average = 0; while (1) { WebRtc_Word16 temp_data[640]; - int analog_level = 127; // Read far-end frame size_t read_count = fread(temp_data, @@ -493,43 +533,73 @@ TEST_F(ApmTest, Process) { EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_)); + max_output_average += MaxAudioFrame(*frame_); + if (apm_->echo_cancellation()->stream_has_echo()) { has_echo_count++; } analog_level = apm_->gain_control()->stream_analog_level(); + analog_level_average += analog_level; if (apm_->gain_control()->stream_is_saturated()) { is_saturated_count++; } if (apm_->voice_detection()->stream_has_voice()) { has_voice_count++; } - } - //<-- Statistics --> + frame_count++; + } + max_output_average /= frame_count; + analog_level_average /= frame_count; + //LevelEstimator::Metrics far_metrics; //LevelEstimator::Metrics near_metrics; - //EchoCancellation::Metrics echo_metrics; - //LevelEstimator::Metrics far_metrics_ref_; - //LevelEstimator::Metrics near_metrics_ref_; - //EchoCancellation::Metrics echo_metrics_ref_; - //EXPECT_EQ(apm_->kNoError, - // apm_->echo_cancellation()->GetMetrics(&echo_metrics)); //EXPECT_EQ(apm_->kNoError, // apm_->level_estimator()->GetMetrics(&near_metrics, + EchoCancellation::Metrics echo_metrics; + EXPECT_EQ(apm_->kNoError, + apm_->echo_cancellation()->GetMetrics(&echo_metrics)); + // TODO(ajm): check echo metrics and output audio. if (global_read_output_data) { - EXPECT_EQ(has_echo_count, - test->hasechocount()); - EXPECT_EQ(has_voice_count, - test->hasvoicecount()); - EXPECT_EQ(is_saturated_count, - test->issaturatedcount()); + EXPECT_EQ(test->has_echo_count(), has_echo_count); + EXPECT_EQ(test->has_voice_count(), has_voice_count); + EXPECT_EQ(test->is_saturated_count(), is_saturated_count); + + EXPECT_EQ(test->analog_level_average(), analog_level_average); + EXPECT_EQ(test->max_output_average(), max_output_average); + + audio_processing_unittest::Test::EchoMetrics reference = + test->echo_metrics(); + TestStats(echo_metrics.residual_echo_return_loss, + reference.residual_echo_return_loss()); + TestStats(echo_metrics.echo_return_loss, + reference.echo_return_loss()); + TestStats(echo_metrics.echo_return_loss_enhancement, + reference.echo_return_loss_enhancement()); + TestStats(echo_metrics.a_nlp, + reference.a_nlp()); + } else { - test->set_hasechocount(has_echo_count); - test->set_hasvoicecount(has_voice_count); - test->set_issaturatedcount(is_saturated_count); + test->set_has_echo_count(has_echo_count); + test->set_has_voice_count(has_voice_count); + test->set_is_saturated_count(is_saturated_count); + + test->set_analog_level_average(analog_level_average); + test->set_max_output_average(max_output_average); + + audio_processing_unittest::Test::EchoMetrics* message = + test->mutable_echo_metrics(); + WriteStatsMessage(echo_metrics.residual_echo_return_loss, + message->mutable_residual_echo_return_loss()); + WriteStatsMessage(echo_metrics.echo_return_loss, + message->mutable_echo_return_loss()); + WriteStatsMessage(echo_metrics.echo_return_loss_enhancement, + message->mutable_echo_return_loss_enhancement()); + WriteStatsMessage(echo_metrics.a_nlp, + message->mutable_a_nlp()); } rewind(far_file_); diff --git a/test/data/audio_processing/output_data.pb b/test/data/audio_processing/output_data.pb index 16805926f8d337e3564cc058470470251481929b..fb0783cf8c89ecd307d8b447705a80f5d1fa6193 100644 GIT binary patch literal 1244 zcma)+v1=4T6o+?~%{jBXxG%ejK9fuGjEIfOm0QV_Q&?Er>wh66jS5=nDVRb?z(Nt! zLQAm|8%s%}m4b#e8WY7vXLn|2X1xTx>M<uBInEbg3C~ir%=r`yP>{#0Tp2xJ^|p|A zg?f@(ObI2HRQ?a}@DCJob=##)o6v9`+UYt!<5qHcE9Qb;kS zRCE01!#MtwzPe=E+6)}UIpRHQanQ9@F2}lSGZWUlpKv)p-QD!rjT(bGjwwOnx@It@ zYwv`7Ce;1RV!X9~Vz&F3c|2jQHSeXdW-+E~Z&UdpQEvv8lS7U<<=Wc*9DhoFXF5*V zTI+W$ZntB)HqPa(O5NzJ`4{Tf5H2Tpp*?F$Kxn!aL)SHfFy0cb5fdv%@ tb|Ap?tPNp^$N%b@#h9)=2f3N37o9Z$LjPTe135lqziXv_p~u3m{Q=2M8h-!) literal 212 zcmcb>z`(%8&%r3bC~?3}VU4iHeIWywKtrvY2=`@d~DgNdlzjE{jGFL=O|ho+-i_7lpxkKmtHL8#y)Raf9sv3jp=p mW6?Ot22}#KXOghScbFcav9$^-IW>;M^g!&n!J@GZs0RRkLMqt+