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

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

Issue 2750783004: Add mute state field to AudioFrame. (Closed)
Patch Set: Third round of comments Created 3 years, 9 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
Index: webrtc/tools/agc/activity_metric.cc
diff --git a/webrtc/tools/agc/activity_metric.cc b/webrtc/tools/agc/activity_metric.cc
index a98730a3422bd1c3966f9bae0da7237a188eee7a..d95572d21429bd8d1b14ba1d3550f2d2b7cffc02 100644
--- a/webrtc/tools/agc/activity_metric.cc
+++ b/webrtc/tools/agc/activity_metric.cc
@@ -62,11 +62,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.
}
}
@@ -103,10 +104,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 (FLAGS_standalone_vad) {
- standalone_vad_->AddAudio(frame.data_,
+ standalone_vad_->AddAudio(frame_data,
frame.samples_per_channel_);
}
if (features.num_frames > 0) {
@@ -251,7 +253,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,

Powered by Google App Engine
This is Rietveld 408576698