Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/renderer/media/renderer_audio_output_device.h" | |
| 6 | |
| 7 #include "base/bind.h" | |
| 8 #include "base/message_loop_proxy.h" | |
| 9 #include "content/renderer/media/audio_message_filter.h" | |
| 10 | |
| 11 namespace content { | |
| 12 | |
| 13 RendererAudioOutputDevice::RendererAudioOutputDevice( | |
| 14 AudioMessageFilter* message_filter, | |
| 15 const scoped_refptr<base::MessageLoopProxy>& io_loop) | |
| 16 : AudioOutputDevice(message_filter, io_loop), | |
| 17 source_render_view_id_(MSG_ROUTING_NONE), | |
| 18 is_after_stream_created_(false) { | |
| 19 } | |
| 20 | |
| 21 RendererAudioOutputDevice::~RendererAudioOutputDevice() {} | |
| 22 | |
| 23 void RendererAudioOutputDevice::Start() { | |
| 24 AudioOutputDevice::Start(); | |
| 25 message_loop()->PostTask(FROM_HERE, | |
|
DaleCurtis
2012/12/03 18:52:03
This wrapping isn't allowed, base::Bind needs to b
miu
2012/12/03 20:20:51
Done.
| |
| 26 base::Bind(&RendererAudioOutputDevice::OnStart, this)); | |
| 27 } | |
| 28 | |
| 29 void RendererAudioOutputDevice::Stop() { | |
| 30 AudioOutputDevice::Stop(); | |
| 31 message_loop()->PostTask(FROM_HERE, | |
|
DaleCurtis
2012/12/03 18:52:03
Ditto.
miu
2012/12/03 20:20:51
Done.
| |
| 32 base::Bind(&RendererAudioOutputDevice::OnStop, this)); | |
| 33 } | |
| 34 | |
| 35 void RendererAudioOutputDevice::SetSourceRenderView(int render_view_id) { | |
| 36 message_loop()->PostTask(FROM_HERE, | |
|
DaleCurtis
2012/12/03 18:52:03
Ditto.
miu
2012/12/03 20:20:51
Done.
| |
| 37 base::Bind(&RendererAudioOutputDevice::OnSourceChange, this, | |
| 38 render_view_id)); | |
| 39 } | |
| 40 | |
| 41 void RendererAudioOutputDevice::OnStart() { | |
| 42 is_after_stream_created_ = true; | |
| 43 OnSourceChange(source_render_view_id_); | |
| 44 } | |
| 45 | |
| 46 void RendererAudioOutputDevice::OnStop() { | |
| 47 is_after_stream_created_ = false; | |
| 48 } | |
| 49 | |
| 50 void RendererAudioOutputDevice::OnSourceChange(int render_view_id) { | |
| 51 source_render_view_id_ = render_view_id; | |
| 52 if (is_after_stream_created_ && source_render_view_id_ != MSG_ROUTING_NONE) { | |
| 53 AudioMessageFilter* const filter = | |
| 54 static_cast<AudioMessageFilter*>(audio_output_ipc()); | |
| 55 if (filter) | |
| 56 filter->AssociateStreamWithProducer(stream_id(), source_render_view_id_); | |
| 57 } | |
| 58 } | |
| 59 | |
| 60 } // namespace content | |
| OLD | NEW |