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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // starting the audio device. The reason for all this is because the creator | 69 // starting the audio device. The reason for all this is because the creator |
70 // of the WebAudio objects might not be the actual source of the audio (e.g., | 70 // of the WebAudio objects might not be the actual source of the audio (e.g., |
71 // an extension creates a object that is passed and used within a page). | 71 // an extension creates a object that is passed and used within a page). |
72 WebLocalFrame* const web_frame = WebLocalFrame::frameForCurrentContext(); | 72 WebLocalFrame* const web_frame = WebLocalFrame::frameForCurrentContext(); |
73 RenderFrame* const render_frame = | 73 RenderFrame* const render_frame = |
74 web_frame ? RenderFrame::FromWebFrame(web_frame) : NULL; | 74 web_frame ? RenderFrame::FromWebFrame(web_frame) : NULL; |
75 sink_ = AudioDeviceFactory::NewAudioRendererSink( | 75 sink_ = AudioDeviceFactory::NewAudioRendererSink( |
76 AudioDeviceFactory::kSourceWebAudioInteractive, | 76 AudioDeviceFactory::kSourceWebAudioInteractive, |
77 render_frame ? render_frame->GetRoutingID() : MSG_ROUTING_NONE, | 77 render_frame ? render_frame->GetRoutingID() : MSG_ROUTING_NONE, |
78 session_id_, std::string(), security_origin_); | 78 session_id_, std::string(), security_origin_); |
79 sink_->Initialize(params_, this); | 79 |
| 80 // Specify the latency info to be passed to the browser side. |
| 81 media::AudioParameters sink_params(params_); |
| 82 sink_params.set_latency_tag(AudioDeviceFactory::GetSourceLatencyType( |
| 83 AudioDeviceFactory::kSourceWebAudioInteractive)); |
| 84 |
| 85 sink_->Initialize(sink_params, this); |
80 // TODO(miu): Remove this temporary instrumentation to root-cause a memory | 86 // TODO(miu): Remove this temporary instrumentation to root-cause a memory |
81 // use-after-free issue. http://crbug.com/619463 | 87 // use-after-free issue. http://crbug.com/619463 |
82 { | 88 { |
83 CHECK(base::AtomicRefCountIsZero(&sink_is_running_)) | 89 CHECK(base::AtomicRefCountIsZero(&sink_is_running_)) |
84 << "Illegal state: sink_is_running_ should be 0."; | 90 << "Illegal state: sink_is_running_ should be 0."; |
85 base::AtomicRefCountInc(&sink_is_running_); | 91 base::AtomicRefCountInc(&sink_is_running_); |
86 } | 92 } |
87 sink_->Start(); | 93 sink_->Start(); |
88 sink_->Play(); | 94 sink_->Play(); |
89 start_null_audio_sink_callback_.Reset( | 95 start_null_audio_sink_callback_.Reset( |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 << "Race condition: stop() was called during Render() operation."; | 190 << "Race condition: stop() was called during Render() operation."; |
185 | 191 |
186 return dest->frames(); | 192 return dest->frames(); |
187 } | 193 } |
188 | 194 |
189 void RendererWebAudioDeviceImpl::OnRenderError() { | 195 void RendererWebAudioDeviceImpl::OnRenderError() { |
190 // TODO(crogers): implement error handling. | 196 // TODO(crogers): implement error handling. |
191 } | 197 } |
192 | 198 |
193 } // namespace content | 199 } // namespace content |
OLD | NEW |