Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: content/renderer/media/renderer_webaudiodevice_impl.cc

Issue 1323403005: Allow AudioOutputDevice objects to be initialized with a specific hardware output device and store … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Split permissions check and device-ID translation for clarity Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // will fail in the call to frameForCurrentContext() otherwise. 58 // will fail in the call to frameForCurrentContext() otherwise.
59 // 59 //
60 // Therefore, we can perform look-ups to determine which RenderView is 60 // Therefore, we can perform look-ups to determine which RenderView is
61 // starting the audio device. The reason for all this is because the creator 61 // starting the audio device. The reason for all this is because the creator
62 // of the WebAudio objects might not be the actual source of the audio (e.g., 62 // of the WebAudio objects might not be the actual source of the audio (e.g.,
63 // an extension creates a object that is passed and used within a page). 63 // an extension creates a object that is passed and used within a page).
64 WebLocalFrame* const web_frame = WebLocalFrame::frameForCurrentContext(); 64 WebLocalFrame* const web_frame = WebLocalFrame::frameForCurrentContext();
65 RenderFrame* const render_frame = 65 RenderFrame* const render_frame =
66 web_frame ? RenderFrame::FromWebFrame(web_frame) : NULL; 66 web_frame ? RenderFrame::FromWebFrame(web_frame) : NULL;
67 output_device_ = AudioDeviceFactory::NewOutputDevice( 67 output_device_ = AudioDeviceFactory::NewOutputDevice(
68 render_frame ? render_frame->GetRoutingID(): MSG_ROUTING_NONE); 68 render_frame ? render_frame->GetRoutingID() : MSG_ROUTING_NONE,
69 output_device_->InitializeWithSessionId(params_, this, session_id_); 69 session_id_);
70 output_device_->Initialize(params_, this);
70 output_device_->Start(); 71 output_device_->Start();
71 start_null_audio_sink_callback_.Reset( 72 start_null_audio_sink_callback_.Reset(
72 base::Bind(&media::NullAudioSink::Play, null_audio_sink_)); 73 base::Bind(&media::NullAudioSink::Play, null_audio_sink_));
73 // Note: Default behavior is to auto-play on start. 74 // Note: Default behavior is to auto-play on start.
74 } 75 }
75 76
76 void RendererWebAudioDeviceImpl::stop() { 77 void RendererWebAudioDeviceImpl::stop() {
77 DCHECK(thread_checker_.CalledOnValidThread()); 78 DCHECK(thread_checker_.CalledOnValidThread());
78 79
79 if (output_device_) { 80 if (output_device_) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 147 }
147 #endif 148 #endif
148 return dest->frames(); 149 return dest->frames();
149 } 150 }
150 151
151 void RendererWebAudioDeviceImpl::OnRenderError() { 152 void RendererWebAudioDeviceImpl::OnRenderError() {
152 // TODO(crogers): implement error handling. 153 // TODO(crogers): implement error handling.
153 } 154 }
154 155
155 } // namespace content 156 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698