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

Side by Side Diff: content/renderer/media/media_stream_audio_processor.cc

Issue 1377103002: Add sample rates checking in MediaStreamAudioProcessor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment addressed Created 5 years, 2 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 | « no previous file | 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/media_stream_audio_processor.h" 5 #include "content/renderer/media/media_stream_audio_processor.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 int source_frames, 130 int source_frames,
131 int destination_frames, 131 int destination_frames,
132 int sample_rate) 132 int sample_rate)
133 : source_channels_(source_channels), 133 : source_channels_(source_channels),
134 source_frames_(source_frames), 134 source_frames_(source_frames),
135 sample_rate_(sample_rate), 135 sample_rate_(sample_rate),
136 destination_( 136 destination_(
137 new MediaStreamAudioBus(destination_channels, destination_frames)), 137 new MediaStreamAudioBus(destination_channels, destination_frames)),
138 data_available_(false) { 138 data_available_(false) {
139 DCHECK_GE(source_channels, destination_channels); 139 DCHECK_GE(source_channels, destination_channels);
140 DCHECK_GT(sample_rate_, 0); 140 DCHECK_GE(sample_rate_, 8000);
141 DCHECK_LE(sample_rate_, 48000);
mcasas 2015/10/09 23:48:48 Nit: Could |sample_rate| be a |size_t| ?
Henrik Grunell 2015/10/12 08:02:57 Not sure what you're after here. Why should it be
141 142
142 if (source_channels > destination_channels) { 143 if (source_channels > destination_channels) {
143 audio_source_intermediate_ = 144 audio_source_intermediate_ =
144 media::AudioBus::CreateWrapper(destination_channels); 145 media::AudioBus::CreateWrapper(destination_channels);
145 } 146 }
146 147
147 if (source_frames != destination_frames) { 148 if (source_frames != destination_frames) {
148 // Since we require every Push to be followed by as many Consumes as 149 // Since we require every Push to be followed by as many Consumes as
149 // possible, twice the larger of the two is a (probably) loose upper bound 150 // possible, twice the larger of the two is a (probably) loose upper bound
150 // on the FIFO size. 151 // on the FIFO size.
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 if (echo_information_) { 679 if (echo_information_) {
679 echo_information_.get()->UpdateAecDelayStats(ap->echo_cancellation()); 680 echo_information_.get()->UpdateAecDelayStats(ap->echo_cancellation());
680 } 681 }
681 682
682 // Return 0 if the volume hasn't been changed, and otherwise the new volume. 683 // Return 0 if the volume hasn't been changed, and otherwise the new volume.
683 return (agc->stream_analog_level() == volume) ? 684 return (agc->stream_analog_level() == volume) ?
684 0 : agc->stream_analog_level(); 685 0 : agc->stream_analog_level();
685 } 686 }
686 687
687 } // namespace content 688 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698