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

Unified Diff: content/renderer/media/webrtc_audio_capturer.cc

Issue 11369171: Add chromium support for MediaStreamAudioDestinationNode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 12 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 | « content/renderer/media/webrtc_audio_capturer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/webrtc_audio_capturer.cc
===================================================================
--- content/renderer/media/webrtc_audio_capturer.cc (revision 175011)
+++ content/renderer/media/webrtc_audio_capturer.cc (working copy)
@@ -100,7 +100,9 @@
}
void WebRtcAudioCapturer::SetCapturerSource(
- const scoped_refptr<media::AudioCapturerSource>& source) {
+ const scoped_refptr<media::AudioCapturerSource>& source,
+ media::ChannelLayout channel_layout,
+ float sample_rate) {
DVLOG(1) << "SetCapturerSource()";
scoped_refptr<media::AudioCapturerSource> old_source;
{
@@ -113,9 +115,38 @@
}
// Detach the old source from normal recording.
- if (old_source)
+ if (old_source) {
old_source->Stop();
+ // Dispatch the new parameters both to the
+ // sink(s) and to the new source. The idea is to get rid of any dependency
+ // of the microphone parameters which are used as base otherwise.
+
+ // henrika:
henrika (OOO until Aug 14) 2013/01/08 09:52:27 Guess we could clean up here now. Also, I did not
Chris Rogers 2013/01/14 23:12:14 Done.
+ // I guess we could add this info to AudioCapturerSource to enable a
+ // query here. E.g.:
+ // source->ModifyAudioParameters(&params_);
+ //
+ // crogers: we could do as you suggest, but instead I've modified
+ // SetCapturerSource() to take the |channel_layout| and |sample_rate|.
+ // Neither solution seems that great, since we just end up calling
+ // source->Initialize(params_, this, this);
+ // anyway, but we have to do something...
+
+ params_.Reset(params_.format(),
henrika (OOO until Aug 14) 2013/01/08 09:52:27 I had anticipated that the sample rate would be th
Chris Rogers 2013/01/14 23:12:14 The sample-rate will generally be the hardware sam
+ channel_layout,
+ sample_rate,
+ 16, // this value is not really used
+ 440); // requires knowledge about WebRTC @ 10ms
henrika (OOO until Aug 14) 2013/01/07 10:14:28 Chris, what range of sample rates can we expect fr
Chris Rogers 2013/01/14 23:12:14 It will be the hardware sample-rate that the Audio
+
+ buffer_.reset(new int16[params_.frames_per_buffer() * params_.channels()]);
+
+ for (SinkList::const_iterator it = sinks_.begin();
+ it != sinks_.end(); ++it) {
+ (*it)->SetCaptureFormat(params_);
+ }
+ }
+
if (source)
source->Initialize(params_, this, this);
}
@@ -212,7 +243,8 @@
// Create and configure the default audio capturing source. The |source_|
// will be overwritten if the client call the source calls
// SetCapturerSource().
- SetCapturerSource(AudioDeviceFactory::NewInputDevice());
+ SetCapturerSource(
+ AudioDeviceFactory::NewInputDevice(), channel_layout, sample_rate);
UMA_HISTOGRAM_ENUMERATION("WebRTC.AudioInputChannelLayout",
channel_layout, media::CHANNEL_LAYOUT_MAX);
« no previous file with comments | « content/renderer/media/webrtc_audio_capturer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698