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

Side by Side Diff: webrtc/modules/utility/source/audio_frame_operations.cc

Issue 1830713003: Remove unused stuff from AudioFrame: (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 years, 8 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
« no previous file with comments | « webrtc/modules/include/module_common_types.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 for (size_t i = 0; i < frame->samples_per_channel_ * 2; i += 2) { 73 for (size_t i = 0; i < frame->samples_per_channel_ * 2; i += 2) {
74 int16_t temp_data = frame->data_[i]; 74 int16_t temp_data = frame->data_[i];
75 frame->data_[i] = frame->data_[i + 1]; 75 frame->data_[i] = frame->data_[i + 1];
76 frame->data_[i + 1] = temp_data; 76 frame->data_[i + 1] = temp_data;
77 } 77 }
78 } 78 }
79 79
80 void AudioFrameOperations::Mute(AudioFrame* frame, bool previous_frame_muted, 80 void AudioFrameOperations::Mute(AudioFrame* frame, bool previous_frame_muted,
81 bool current_frame_muted) { 81 bool current_frame_muted) {
82 RTC_DCHECK(frame); 82 RTC_DCHECK(frame);
83 RTC_DCHECK(frame->interleaved_);
84 if (!previous_frame_muted && !current_frame_muted) { 83 if (!previous_frame_muted && !current_frame_muted) {
85 // Not muted, don't touch. 84 // Not muted, don't touch.
86 } else if (previous_frame_muted && current_frame_muted) { 85 } else if (previous_frame_muted && current_frame_muted) {
87 // Frame fully muted. 86 // Frame fully muted.
88 size_t total_samples = frame->samples_per_channel_ * frame->num_channels_; 87 size_t total_samples = frame->samples_per_channel_ * frame->num_channels_;
89 RTC_DCHECK_GE(AudioFrame::kMaxDataSizeSamples, total_samples); 88 RTC_DCHECK_GE(AudioFrame::kMaxDataSizeSamples, total_samples);
90 memset(frame->data_, 0, sizeof(frame->data_[0]) * total_samples); 89 memset(frame->data_, 0, sizeof(frame->data_[0]) * total_samples);
91 } else { 90 } else {
92 // Limit number of samples to fade, if frame isn't long enough. 91 // Limit number of samples to fade, if frame isn't long enough.
93 size_t count = kMuteFadeFrames; 92 size_t count = kMuteFadeFrames;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } else if (temp_data > 32767) { 151 } else if (temp_data > 32767) {
153 frame.data_[i] = 32767; 152 frame.data_[i] = 32767;
154 } else { 153 } else {
155 frame.data_[i] = static_cast<int16_t>(temp_data); 154 frame.data_[i] = static_cast<int16_t>(temp_data);
156 } 155 }
157 } 156 }
158 return 0; 157 return 0;
159 } 158 }
160 159
161 } // namespace webrtc 160 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/include/module_common_types.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698