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

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: Palmer's comments 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 <string>
8
7 #include "base/command_line.h" 9 #include "base/command_line.h"
8 #include "base/logging.h" 10 #include "base/logging.h"
9 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 12 #include "base/thread_task_runner_handle.h"
11 #include "base/time/time.h" 13 #include "base/time/time.h"
12 #include "content/renderer/media/audio_device_factory.h" 14 #include "content/renderer/media/audio_device_factory.h"
13 #include "content/renderer/render_frame_impl.h" 15 #include "content/renderer/render_frame_impl.h"
14 #include "media/audio/audio_output_device.h" 16 #include "media/audio/audio_output_device.h"
15 #include "media/audio/null_audio_sink.h" 17 #include "media/audio/null_audio_sink.h"
16 #include "media/base/media_switches.h" 18 #include "media/base/media_switches.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // will fail in the call to frameForCurrentContext() otherwise. 60 // will fail in the call to frameForCurrentContext() otherwise.
59 // 61 //
60 // Therefore, we can perform look-ups to determine which RenderView is 62 // 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 63 // 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., 64 // 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). 65 // an extension creates a object that is passed and used within a page).
64 WebLocalFrame* const web_frame = WebLocalFrame::frameForCurrentContext(); 66 WebLocalFrame* const web_frame = WebLocalFrame::frameForCurrentContext();
65 RenderFrame* const render_frame = 67 RenderFrame* const render_frame =
66 web_frame ? RenderFrame::FromWebFrame(web_frame) : NULL; 68 web_frame ? RenderFrame::FromWebFrame(web_frame) : NULL;
67 output_device_ = AudioDeviceFactory::NewOutputDevice( 69 output_device_ = AudioDeviceFactory::NewOutputDevice(
68 render_frame ? render_frame->GetRoutingID(): MSG_ROUTING_NONE); 70 render_frame ? render_frame->GetRoutingID() : MSG_ROUTING_NONE,
69 output_device_->InitializeWithSessionId(params_, this, session_id_); 71 session_id_, std::string(), url::Origin());
72 output_device_->Initialize(params_, this);
70 output_device_->Start(); 73 output_device_->Start();
71 start_null_audio_sink_callback_.Reset( 74 start_null_audio_sink_callback_.Reset(
72 base::Bind(&media::NullAudioSink::Play, null_audio_sink_)); 75 base::Bind(&media::NullAudioSink::Play, null_audio_sink_));
73 // Note: Default behavior is to auto-play on start. 76 // Note: Default behavior is to auto-play on start.
74 } 77 }
75 78
76 void RendererWebAudioDeviceImpl::stop() { 79 void RendererWebAudioDeviceImpl::stop() {
77 DCHECK(thread_checker_.CalledOnValidThread()); 80 DCHECK(thread_checker_.CalledOnValidThread());
78 81
79 if (output_device_) { 82 if (output_device_) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 149 }
147 #endif 150 #endif
148 return dest->frames(); 151 return dest->frames();
149 } 152 }
150 153
151 void RendererWebAudioDeviceImpl::OnRenderError() { 154 void RendererWebAudioDeviceImpl::OnRenderError() {
152 // TODO(crogers): implement error handling. 155 // TODO(crogers): implement error handling.
153 } 156 }
154 157
155 } // namespace content 158 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698