| 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 media::AudioParameters sink_params(params_); |
| 81 sink_params.set_latency_tag(AudioDeviceFactory::GetSourceLatencyType( |
| 82 AudioDeviceFactory::kSourceWebAudioInteractive)); |
| 83 sink_->Initialize(sink_params, this); |
| 80 // TODO(miu): Remove this temporary instrumentation to root-cause a memory | 84 // TODO(miu): Remove this temporary instrumentation to root-cause a memory |
| 81 // use-after-free issue. http://crbug.com/619463 | 85 // use-after-free issue. http://crbug.com/619463 |
| 82 { | 86 { |
| 83 CHECK(base::AtomicRefCountIsZero(&sink_is_running_)) | 87 CHECK(base::AtomicRefCountIsZero(&sink_is_running_)) |
| 84 << "Illegal state: sink_is_running_ should be 0."; | 88 << "Illegal state: sink_is_running_ should be 0."; |
| 85 base::AtomicRefCountInc(&sink_is_running_); | 89 base::AtomicRefCountInc(&sink_is_running_); |
| 86 } | 90 } |
| 87 sink_->Start(); | 91 sink_->Start(); |
| 88 sink_->Play(); | 92 sink_->Play(); |
| 89 start_null_audio_sink_callback_.Reset( | 93 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."; | 188 << "Race condition: stop() was called during Render() operation."; |
| 185 | 189 |
| 186 return dest->frames(); | 190 return dest->frames(); |
| 187 } | 191 } |
| 188 | 192 |
| 189 void RendererWebAudioDeviceImpl::OnRenderError() { | 193 void RendererWebAudioDeviceImpl::OnRenderError() { |
| 190 // TODO(crogers): implement error handling. | 194 // TODO(crogers): implement error handling. |
| 191 } | 195 } |
| 192 | 196 |
| 193 } // namespace content | 197 } // namespace content |
| OLD | NEW |