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

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

Issue 11783059: Ensures that WebRTC works for device selection using a different sample rate than default (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix after review from Chris Created 7 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/webaudio_capturer_source.h" 5 #include "content/renderer/media/webaudio_capturer_source.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/renderer/media/webrtc_audio_capturer.h" 8 #include "content/renderer/media/webrtc_audio_capturer.h"
9 9
10 using media::AudioBus; 10 using media::AudioBus;
(...skipping 12 matching lines...) Expand all
23 set_format_channels_(0), 23 set_format_channels_(0),
24 callback_(0), 24 callback_(0),
25 started_(false) { 25 started_(false) {
26 } 26 }
27 27
28 WebAudioCapturerSource::~WebAudioCapturerSource() { 28 WebAudioCapturerSource::~WebAudioCapturerSource() {
29 } 29 }
30 30
31 void WebAudioCapturerSource::setFormat( 31 void WebAudioCapturerSource::setFormat(
32 size_t number_of_channels, float sample_rate) { 32 size_t number_of_channels, float sample_rate) {
33 DVLOG(1) << "WebAudioCapturerSource::setFormat(sample_rate="
34 << sample_rate << ")";
33 if (number_of_channels <= 2) { 35 if (number_of_channels <= 2) {
34 set_format_channels_ = number_of_channels; 36 set_format_channels_ = number_of_channels;
35 ChannelLayout channel_layout = 37 ChannelLayout channel_layout =
36 number_of_channels == 1 ? CHANNEL_LAYOUT_MONO : CHANNEL_LAYOUT_STEREO; 38 number_of_channels == 1 ? CHANNEL_LAYOUT_MONO : CHANNEL_LAYOUT_STEREO;
37 capturer_->SetCapturerSource(this, channel_layout, sample_rate); 39 capturer_->SetCapturerSource(this, channel_layout, sample_rate);
38 capturer_->Start(); 40 capturer_->Start();
39 } else { 41 } else {
40 // TODO(crogers): Handle more than just the mono and stereo cases. 42 // TODO(crogers): Handle more than just the mono and stereo cases.
41 LOG(WARNING) << "WebAudioCapturerSource::setFormat() : unhandled format."; 43 LOG(WARNING) << "WebAudioCapturerSource::setFormat() : unhandled format.";
42 } 44 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 95
94 fifo_->Push(wrapper_bus_.get()); 96 fifo_->Push(wrapper_bus_.get());
95 int capture_frames = params_.frames_per_buffer(); 97 int capture_frames = params_.frames_per_buffer();
96 while (fifo_->frames() >= capture_frames) { 98 while (fifo_->frames() >= capture_frames) {
97 fifo_->Consume(capture_bus_.get(), 0, capture_frames); 99 fifo_->Consume(capture_bus_.get(), 0, capture_frames);
98 callback_->Capture(capture_bus_.get(), 0, 1.0); 100 callback_->Capture(capture_bus_.get(), 0, 1.0);
99 } 101 }
100 } 102 }
101 103
102 } // namespace content 104 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/mock_media_stream_dependency_factory.cc ('k') | content/renderer/media/webrtc_audio_capturer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698