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

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

Issue 11359196: Associate audio streams with their source/destination RenderView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Consolidate construct/init/destruct code in AudioOutputDeviceTest. Created 8 years, 1 month 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: content/renderer/media/render_audiosourceprovider.cc
diff --git a/content/renderer/media/render_audiosourceprovider.cc b/content/renderer/media/render_audiosourceprovider.cc
index 750db7fe0a47472c99bbdc50ff3ba7f612062da2..fb1295f9173d5393c69a5f2e74759ce3883ce6ad 100644
--- a/content/renderer/media/render_audiosourceprovider.cc
+++ b/content/renderer/media/render_audiosourceprovider.cc
@@ -9,9 +9,10 @@
#include "base/basictypes.h"
#include "base/command_line.h"
#include "base/logging.h"
-#include "content/renderer/media/audio_device_factory.h"
+#include "content/renderer/media/audio_message_filter.h"
#include "content/renderer/media/audio_renderer_mixer_manager.h"
#include "content/renderer/render_thread_impl.h"
+#include "media/audio/audio_output_device.h"
#include "media/base/audio_renderer_mixer_input.h"
#include "media/base/media_switches.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioSourceProviderClient.h"
@@ -21,7 +22,7 @@ using WebKit::WebVector;
namespace content {
-RenderAudioSourceProvider::RenderAudioSourceProvider()
+RenderAudioSourceProvider::RenderAudioSourceProvider(int source_render_view_id)
: is_initialized_(false),
channels_(0),
sample_rate_(0),
@@ -44,8 +45,22 @@ RenderAudioSourceProvider::RenderAudioSourceProvider()
if (use_mixing) {
default_sink_ = RenderThreadImpl::current()->
GetAudioRendererMixerManager()->CreateInput();
+ // TODO(miu): Partition mixer instances per RenderView.
} else {
- default_sink_ = AudioDeviceFactory::NewOutputDevice();
+ RenderThreadImpl* const render_thread = RenderThreadImpl::current();
tommi (sloooow) - chröme 2012/11/29 13:08:38 the convention is: const RenderThreadImpl* render_
miu 2012/11/30 02:40:35 Actually, that has totally different meaning: c
+ scoped_refptr<media::AudioOutputDevice> device =
+ new media::AudioOutputDevice(render_thread->audio_message_filter(),
+ render_thread->GetIOMessageLoopProxy());
Chris Rogers 2012/11/29 11:14:32 I don't understand why the factory has been remove
tommi (sloooow) - chröme 2012/11/29 13:08:38 Maybe I'm misunderstanding your point, but AudioOu
tommi (sloooow) - chröme 2012/11/29 15:30:38 Chris, Henrik and I just talked about this. I und
miu 2012/11/30 02:40:35 Done.
tommi (sloooow) - chröme 2012/11/30 06:51:31 I can't think of a reason for why at least the sta
+ // The RenderView creating RenderAudioSourceProvider will be the source of
+ // the audio (WebMediaPlayer is always associated with a single frame).
+ //
+ // TODO(miu): Unfortunately, there is one use case where this is not true:
+ // JavaScript code can call new Audio() and pass the object around. The
+ // RenderAudioSourceProvider is not instantiated until the "src" attribute
+ // has been set.
+ render_thread->audio_message_filter()->AssociateStreamWithProducer(
+ device->stream_id(), source_render_view_id);
+ default_sink_ = device;
}
}

Powered by Google App Engine
This is Rietveld 408576698