Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(745)

Side by Side Diff: webrtc/modules/audio_coding/acm2/acm_receiver.cc

Issue 2341293002: Add new decoding statistics for muted output (Closed)
Patch Set: Updates after reviews Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 << static_cast<int>(header->payloadType) 128 << static_cast<int>(header->payloadType)
129 << " Failed to insert packet"; 129 << " Failed to insert packet";
130 return -1; 130 return -1;
131 } 131 }
132 return 0; 132 return 0;
133 } 133 }
134 134
135 int AcmReceiver::GetAudio(int desired_freq_hz, 135 int AcmReceiver::GetAudio(int desired_freq_hz,
136 AudioFrame* audio_frame, 136 AudioFrame* audio_frame,
137 bool* muted) { 137 bool* muted) {
138 RTC_DCHECK(muted);
138 // Accessing members, take the lock. 139 // Accessing members, take the lock.
139 rtc::CritScope lock(&crit_sect_); 140 rtc::CritScope lock(&crit_sect_);
140 141
141 if (neteq_->GetAudio(audio_frame, muted) != NetEq::kOK) { 142 if (neteq_->GetAudio(audio_frame, muted) != NetEq::kOK) {
142 LOG(LERROR) << "AcmReceiver::GetAudio - NetEq Failed."; 143 LOG(LERROR) << "AcmReceiver::GetAudio - NetEq Failed.";
143 return -1; 144 return -1;
144 } 145 }
145 146
146 const int current_sample_rate_hz = neteq_->last_output_sample_rate_hz(); 147 const int current_sample_rate_hz = neteq_->last_output_sample_rate_hz();
147 148
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } else { 185 } else {
185 resampled_last_output_frame_ = false; 186 resampled_last_output_frame_ = false;
186 // We might end up here ONLY if codec is changed. 187 // We might end up here ONLY if codec is changed.
187 } 188 }
188 189
189 // Store current audio in |last_audio_buffer_| for next time. 190 // Store current audio in |last_audio_buffer_| for next time.
190 memcpy(last_audio_buffer_.get(), audio_frame->data_, 191 memcpy(last_audio_buffer_.get(), audio_frame->data_,
191 sizeof(int16_t) * audio_frame->samples_per_channel_ * 192 sizeof(int16_t) * audio_frame->samples_per_channel_ *
192 audio_frame->num_channels_); 193 audio_frame->num_channels_);
193 194
194 call_stats_.DecodedByNetEq(audio_frame->speech_type_); 195 call_stats_.DecodedByNetEq(audio_frame->speech_type_, *muted);
195 return 0; 196 return 0;
196 } 197 }
197 198
198 int32_t AcmReceiver::AddCodec(int acm_codec_id, 199 int32_t AcmReceiver::AddCodec(int acm_codec_id,
199 uint8_t payload_type, 200 uint8_t payload_type,
200 size_t channels, 201 size_t channels,
201 int sample_rate_hz, 202 int sample_rate_hz,
202 AudioDecoder* audio_decoder, 203 AudioDecoder* audio_decoder,
203 const std::string& name) { 204 const std::string& name) {
204 const auto neteq_decoder = [acm_codec_id, channels]() -> NetEqDecoder { 205 const auto neteq_decoder = [acm_codec_id, channels]() -> NetEqDecoder {
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 416
416 void AcmReceiver::GetDecodingCallStatistics( 417 void AcmReceiver::GetDecodingCallStatistics(
417 AudioDecodingCallStats* stats) const { 418 AudioDecodingCallStats* stats) const {
418 rtc::CritScope lock(&crit_sect_); 419 rtc::CritScope lock(&crit_sect_);
419 *stats = call_stats_.GetDecodingStatistics(); 420 *stats = call_stats_.GetDecodingStatistics();
420 } 421 }
421 422
422 } // namespace acm2 423 } // namespace acm2
423 424
424 } // namespace webrtc 425 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698