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

Side by Side Diff: content/renderer/pepper/pepper_platform_audio_output.cc

Issue 2289543003: IPC->mojo of audio_renderer_host (Closed)
Patch Set: New interface. Created 4 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/pepper/pepper_platform_audio_output.h" 5 #include "content/renderer/pepper/pepper_platform_audio_output.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
11 #include "base/threading/thread_task_runner_handle.h" 11 #include "base/threading/thread_task_runner_handle.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "content/child/child_process.h" 13 #include "content/child/child_process.h"
14 #include "content/common/media/audio_messages.h" 14 #include "content/common/media/audio_messages.h"
15 #include "content/renderer/media/audio_message_filter.h" 15 #include "content/renderer/media/audio_output_ipc_factory.h"
16 #include "content/renderer/pepper/audio_helper.h" 16 #include "content/renderer/pepper/audio_helper.h"
17 #include "content/renderer/render_thread_impl.h" 17 #include "content/renderer/render_thread_impl.h"
18 #include "media/media_features.h"
18 #include "ppapi/shared_impl/ppb_audio_config_shared.h" 19 #include "ppapi/shared_impl/ppb_audio_config_shared.h"
19 20
20 namespace content { 21 namespace content {
21 22
22 // static 23 // static
23 PepperPlatformAudioOutput* PepperPlatformAudioOutput::Create( 24 PepperPlatformAudioOutput* PepperPlatformAudioOutput::Create(
24 int sample_rate, 25 int sample_rate,
25 int frames_per_buffer, 26 int frames_per_buffer,
26 int source_render_frame_id, 27 int source_render_frame_id,
27 AudioHelper* client) { 28 AudioHelper* client) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 void PepperPlatformAudioOutput::ShutDown() { 74 void PepperPlatformAudioOutput::ShutDown() {
74 // Called on the main thread to stop all audio callbacks. We must only change 75 // Called on the main thread to stop all audio callbacks. We must only change
75 // the client on the main thread, and the delegates from the I/O thread. 76 // the client on the main thread, and the delegates from the I/O thread.
76 client_ = NULL; 77 client_ = NULL;
77 io_task_runner_->PostTask( 78 io_task_runner_->PostTask(
78 FROM_HERE, 79 FROM_HERE,
79 base::Bind(&PepperPlatformAudioOutput::ShutDownOnIOThread, this)); 80 base::Bind(&PepperPlatformAudioOutput::ShutDownOnIOThread, this));
80 } 81 }
81 82
82 void PepperPlatformAudioOutput::OnStateChanged( 83 void PepperPlatformAudioOutput::OnStateChanged(
83 media::AudioOutputIPCDelegateState state) {} 84 media::mojom::AudioOutputStreamState state) {}
84 85
85 void PepperPlatformAudioOutput::OnDeviceAuthorized( 86 void PepperPlatformAudioOutput::OnDeviceAuthorized(
86 media::OutputDeviceStatus device_status, 87 media::OutputDeviceStatus device_status,
87 const media::AudioParameters& output_params, 88 const media::AudioParameters& output_params,
88 const std::string& matched_device_id) { 89 const std::string& matched_device_id) {
89 NOTREACHED(); 90 NOTREACHED();
90 } 91 }
91 92
92 void PepperPlatformAudioOutput::OnStreamCreated( 93 void PepperPlatformAudioOutput::OnStreamCreated(
93 base::SharedMemoryHandle handle, 94 base::SharedMemoryHandle handle,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 131 }
131 132
132 bool PepperPlatformAudioOutput::Initialize(int sample_rate, 133 bool PepperPlatformAudioOutput::Initialize(int sample_rate,
133 int frames_per_buffer, 134 int frames_per_buffer,
134 int source_render_frame_id, 135 int source_render_frame_id,
135 AudioHelper* client) { 136 AudioHelper* client) {
136 DCHECK(client); 137 DCHECK(client);
137 client_ = client; 138 client_ = client;
138 139
139 RenderThreadImpl* const render_thread = RenderThreadImpl::current(); 140 RenderThreadImpl* const render_thread = RenderThreadImpl::current();
140 ipc_ = render_thread->audio_message_filter()->CreateAudioOutputIPC( 141 ipc_ = render_thread->audio_output_ipc_factory()->CreateAudioOutputIPC(
141 source_render_frame_id); 142 source_render_frame_id);
142 CHECK(ipc_); 143 CHECK(ipc_);
143 144
144 media::AudioParameters params(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, 145 media::AudioParameters params(media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
145 media::CHANNEL_LAYOUT_STEREO, 146 media::CHANNEL_LAYOUT_STEREO,
146 sample_rate, 147 sample_rate,
147 ppapi::kBitsPerAudioOutputSample, 148 ppapi::kBitsPerAudioOutputSample,
148 frames_per_buffer); 149 frames_per_buffer);
149 150
150 io_task_runner_->PostTask( 151 io_task_runner_->PostTask(
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 return; 187 return;
187 188
188 ipc_->CloseStream(); 189 ipc_->CloseStream();
189 ipc_.reset(); 190 ipc_.reset();
190 191
191 Release(); // Release for the delegate, balances out the reference taken in 192 Release(); // Release for the delegate, balances out the reference taken in
192 // PepperPlatformAudioOutput::Create. 193 // PepperPlatformAudioOutput::Create.
193 } 194 }
194 195
195 } // namespace content 196 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698