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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // will fail in the call to frameForCurrentContext() otherwise. | 65 // will fail in the call to frameForCurrentContext() otherwise. |
66 // | 66 // |
67 // Therefore, we can perform look-ups to determine which RenderView is | 67 // Therefore, we can perform look-ups to determine which RenderView is |
68 // starting the audio device. The reason for all this is because the creator | 68 // starting the audio device. The reason for all this is because the creator |
69 // of the WebAudio objects might not be the actual source of the audio (e.g., | 69 // of the WebAudio objects might not be the actual source of the audio (e.g., |
70 // an extension creates a object that is passed and used within a page). | 70 // an extension creates a object that is passed and used within a page). |
71 WebLocalFrame* const web_frame = WebLocalFrame::frameForCurrentContext(); | 71 WebLocalFrame* const web_frame = WebLocalFrame::frameForCurrentContext(); |
72 RenderFrame* const render_frame = | 72 RenderFrame* const render_frame = |
73 web_frame ? RenderFrame::FromWebFrame(web_frame) : NULL; | 73 web_frame ? RenderFrame::FromWebFrame(web_frame) : NULL; |
74 sink_ = AudioDeviceFactory::NewAudioRendererSink( | 74 sink_ = AudioDeviceFactory::NewAudioRendererSink( |
75 AudioDeviceFactory::kSourceWebAudio, | 75 AudioDeviceFactory::kSourceWebAudioInteractive, |
76 render_frame ? render_frame->GetRoutingID() : MSG_ROUTING_NONE, | 76 render_frame ? render_frame->GetRoutingID() : MSG_ROUTING_NONE, |
77 session_id_, std::string(), security_origin_); | 77 session_id_, std::string(), security_origin_); |
78 sink_->Initialize(params_, this); | 78 sink_->Initialize(params_, this); |
79 sink_->Start(); | 79 sink_->Start(); |
80 sink_->Play(); | 80 sink_->Play(); |
81 start_null_audio_sink_callback_.Reset( | 81 start_null_audio_sink_callback_.Reset( |
82 base::Bind(&media::NullAudioSink::Play, null_audio_sink_)); | 82 base::Bind(&media::NullAudioSink::Play, null_audio_sink_)); |
83 // Note: Default behavior is to auto-play on start. | 83 // Note: Default behavior is to auto-play on start. |
84 } | 84 } |
85 | 85 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 } | 161 } |
162 #endif | 162 #endif |
163 return dest->frames(); | 163 return dest->frames(); |
164 } | 164 } |
165 | 165 |
166 void RendererWebAudioDeviceImpl::OnRenderError() { | 166 void RendererWebAudioDeviceImpl::OnRenderError() { |
167 // TODO(crogers): implement error handling. | 167 // TODO(crogers): implement error handling. |
168 } | 168 } |
169 | 169 |
170 } // namespace content | 170 } // namespace content |
OLD | NEW |