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

Unified Diff: webrtc/tools/agc/activity_metric.cc

Issue 2750783004: Add mute state field to AudioFrame. (Closed)
Patch Set: Update new usages of AudioFrame::data_ Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/module_common_types_unittest.cc ('k') | webrtc/voice_engine/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/tools/agc/activity_metric.cc
diff --git a/webrtc/tools/agc/activity_metric.cc b/webrtc/tools/agc/activity_metric.cc
index 599777c3be81d757c145e559a3fa3ac1cb9e0ea9..3ccae583356dae97e66976bca43d95a227715c6d 100644
--- a/webrtc/tools/agc/activity_metric.cc
+++ b/webrtc/tools/agc/activity_metric.cc
@@ -63,11 +63,12 @@ static void DitherSilence(AudioFrame* frame) {
const double sum_squared_silence = kRmsSilence * kRmsSilence *
frame->samples_per_channel_;
double sum_squared = 0;
+ int16_t* frame_data = frame->mutable_data();
for (size_t n = 0; n < frame->samples_per_channel_; n++)
- sum_squared += frame->data_[n] * frame->data_[n];
+ sum_squared += frame_data[n] * frame_data[n];
if (sum_squared <= sum_squared_silence) {
for (size_t n = 0; n < frame->samples_per_channel_; n++)
- frame->data_[n] = (rand() & 0xF) - 8; // NOLINT: ignore non-threadsafe.
+ frame_data[n] = (rand() & 0xF) - 8; // NOLINT: ignore non-threadsafe.
}
}
@@ -104,10 +105,11 @@ class AgcStat {
return -1;
video_vad_[video_index_++] = p_video;
AudioFeatures features;
+ const int16_t* frame_data = frame.data();
audio_processing_->ExtractFeatures(
- frame.data_, frame.samples_per_channel_, &features);
+ frame_data, frame.samples_per_channel_, &features);
if (FLAG_standalone_vad) {
- standalone_vad_->AddAudio(frame.data_,
+ standalone_vad_->AddAudio(frame_data,
frame.samples_per_channel_);
}
if (features.num_frames > 0) {
@@ -252,7 +254,7 @@ void void_main(int argc, char* argv[]) {
bool in_false_positive_region = false;
int total_false_positive_duration = 0;
bool video_adapted = false;
- while (kSamplesToRead == fread(frame.data_, sizeof(int16_t),
+ while (kSamplesToRead == fread(frame.mutable_data(), sizeof(int16_t),
kSamplesToRead, pcm_fid)) {
assert(true_vad_index < kMaxNumFrames);
ASSERT_EQ(1u, fread(&true_vad[true_vad_index], sizeof(*true_vad), 1,
« no previous file with comments | « webrtc/modules/module_common_types_unittest.cc ('k') | webrtc/voice_engine/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698