OLD | NEW |
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/renderer_webaudiodevice_impl.h" | 5 #include "content/renderer/media/renderer_webaudiodevice_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "content/renderer/media/audio_device_factory.h" | 9 #include "content/renderer/media/audio_device_factory.h" |
10 #include "content/renderer/render_frame_impl.h" | 10 #include "content/renderer/render_frame_impl.h" |
11 #include "content/renderer/render_view_impl.h" | 11 #include "content/renderer/render_view_impl.h" |
12 #include "media/audio/audio_output_device.h" | 12 #include "media/audio/audio_output_device.h" |
13 #include "media/base/media_switches.h" | 13 #include "media/base/media_switches.h" |
14 #include "third_party/WebKit/public/web/WebFrame.h" | 14 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
15 #include "third_party/WebKit/public/web/WebView.h" | 15 #include "third_party/WebKit/public/web/WebView.h" |
16 | 16 |
17 using blink::WebAudioDevice; | 17 using blink::WebAudioDevice; |
18 using blink::WebFrame; | 18 using blink::WebLocalFrame; |
19 using blink::WebVector; | 19 using blink::WebVector; |
20 using blink::WebView; | 20 using blink::WebView; |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 | 23 |
24 RendererWebAudioDeviceImpl::RendererWebAudioDeviceImpl( | 24 RendererWebAudioDeviceImpl::RendererWebAudioDeviceImpl( |
25 const media::AudioParameters& params, | 25 const media::AudioParameters& params, |
26 WebAudioDevice::RenderCallback* callback, | 26 WebAudioDevice::RenderCallback* callback, |
27 int session_id) | 27 int session_id) |
28 : params_(params), | 28 : params_(params), |
(...skipping 12 matching lines...) Expand all Loading... |
41 if (output_device_.get()) | 41 if (output_device_.get()) |
42 return; // Already started. | 42 return; // Already started. |
43 | 43 |
44 // Assumption: This method is being invoked within a V8 call stack. CHECKs | 44 // Assumption: This method is being invoked within a V8 call stack. CHECKs |
45 // will fail in the call to frameForCurrentContext() otherwise. | 45 // will fail in the call to frameForCurrentContext() otherwise. |
46 // | 46 // |
47 // Therefore, we can perform look-ups to determine which RenderView is | 47 // Therefore, we can perform look-ups to determine which RenderView is |
48 // starting the audio device. The reason for all this is because the creator | 48 // starting the audio device. The reason for all this is because the creator |
49 // of the WebAudio objects might not be the actual source of the audio (e.g., | 49 // of the WebAudio objects might not be the actual source of the audio (e.g., |
50 // an extension creates a object that is passed and used within a page). | 50 // an extension creates a object that is passed and used within a page). |
51 WebFrame* const web_frame = WebFrame::frameForCurrentContext(); | 51 WebLocalFrame* const web_frame = WebLocalFrame::frameForCurrentContext(); |
52 WebView* const web_view = web_frame ? web_frame->view() : NULL; | 52 WebView* const web_view = web_frame ? web_frame->view() : NULL; |
53 RenderFrame* const render_frame = | 53 RenderFrame* const render_frame = |
54 web_frame ? RenderFrame::FromWebFrame(web_frame) : NULL; | 54 web_frame ? RenderFrame::FromWebFrame(web_frame) : NULL; |
55 RenderViewImpl* const render_view = | 55 RenderViewImpl* const render_view = |
56 web_view ? RenderViewImpl::FromWebView(web_view) : NULL; | 56 web_view ? RenderViewImpl::FromWebView(web_view) : NULL; |
57 output_device_ = AudioDeviceFactory::NewOutputDevice( | 57 output_device_ = AudioDeviceFactory::NewOutputDevice( |
58 render_view ? render_view->routing_id() : MSG_ROUTING_NONE, | 58 render_view ? render_view->routing_id() : MSG_ROUTING_NONE, |
59 render_frame ? render_frame->GetRoutingID(): MSG_ROUTING_NONE); | 59 render_frame ? render_frame->GetRoutingID(): MSG_ROUTING_NONE); |
60 output_device_->InitializeUnifiedStream(params_, this, session_id_); | 60 output_device_->InitializeUnifiedStream(params_, this, session_id_); |
61 output_device_->Start(); | 61 output_device_->Start(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 web_audio_dest_data, | 103 web_audio_dest_data, |
104 dest->frames()); | 104 dest->frames()); |
105 } | 105 } |
106 } | 106 } |
107 | 107 |
108 void RendererWebAudioDeviceImpl::OnRenderError() { | 108 void RendererWebAudioDeviceImpl::OnRenderError() { |
109 // TODO(crogers): implement error handling. | 109 // TODO(crogers): implement error handling. |
110 } | 110 } |
111 | 111 |
112 } // namespace content | 112 } // namespace content |
OLD | NEW |