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

Side by Side Diff: content/renderer/pepper_plugin_delegate_impl.cc

Issue 9129007: Work on improving PpbAudioConfig:RecommendSampleFrameCount (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ppapi/api/ppb_audio_config.idl » ('j') | ppapi/api/ppb_audio_config.idl » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_plugin_delegate_impl.h" 5 #include "content/renderer/pepper_plugin_delegate_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 18 matching lines...) Expand all
29 #include "content/common/pepper_messages.h" 29 #include "content/common/pepper_messages.h"
30 #include "content/common/quota_dispatcher.h" 30 #include "content/common/quota_dispatcher.h"
31 #include "content/common/view_messages.h" 31 #include "content/common/view_messages.h"
32 #include "content/public/common/content_switches.h" 32 #include "content/public/common/content_switches.h"
33 #include "content/public/renderer/content_renderer_client.h" 33 #include "content/public/renderer/content_renderer_client.h"
34 #include "content/renderer/gamepad_shared_memory_reader.h" 34 #include "content/renderer/gamepad_shared_memory_reader.h"
35 #include "content/renderer/gpu/command_buffer_proxy.h" 35 #include "content/renderer/gpu/command_buffer_proxy.h"
36 #include "content/renderer/gpu/gpu_channel_host.h" 36 #include "content/renderer/gpu/gpu_channel_host.h"
37 #include "content/renderer/gpu/renderer_gl_context.h" 37 #include "content/renderer/gpu/renderer_gl_context.h"
38 #include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h" 38 #include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h"
39 #include "content/renderer/media/audio_hardware.h"
39 #include "content/renderer/media/audio_input_message_filter.h" 40 #include "content/renderer/media/audio_input_message_filter.h"
40 #include "content/renderer/media/audio_message_filter.h" 41 #include "content/renderer/media/audio_message_filter.h"
41 #include "content/renderer/media/video_capture_impl_manager.h" 42 #include "content/renderer/media/video_capture_impl_manager.h"
42 #include "content/renderer/p2p/p2p_transport_impl.h" 43 #include "content/renderer/p2p/p2p_transport_impl.h"
43 #include "content/renderer/pepper_platform_context_3d_impl.h" 44 #include "content/renderer/pepper_platform_context_3d_impl.h"
44 #include "content/renderer/pepper_platform_video_decoder_impl.h" 45 #include "content/renderer/pepper_platform_video_decoder_impl.h"
45 #include "content/renderer/render_thread_impl.h" 46 #include "content/renderer/render_thread_impl.h"
46 #include "content/renderer/render_view_impl.h" 47 #include "content/renderer/render_view_impl.h"
47 #include "content/renderer/render_widget_fullscreen_pepper.h" 48 #include "content/renderer/render_widget_fullscreen_pepper.h"
48 #include "content/renderer/webplugin_delegate_proxy.h" 49 #include "content/renderer/webplugin_delegate_proxy.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // Our ID on the MessageFilter. THIS MUST ONLY BE ACCESSED ON THE I/O THREAD 225 // Our ID on the MessageFilter. THIS MUST ONLY BE ACCESSED ON THE I/O THREAD
225 // or else you could race with the initialize function which sets it. 226 // or else you could race with the initialize function which sets it.
226 int32 stream_id_; 227 int32 stream_id_;
227 228
228 base::MessageLoopProxy* main_message_loop_proxy_; 229 base::MessageLoopProxy* main_message_loop_proxy_;
229 230
230 DISALLOW_COPY_AND_ASSIGN(PlatformAudioImpl); 231 DISALLOW_COPY_AND_ASSIGN(PlatformAudioImpl);
231 }; 232 };
232 233
233 bool PlatformAudioImpl::Initialize( 234 bool PlatformAudioImpl::Initialize(
234 uint32_t sample_rate, uint32_t sample_count, 235 uint32_t sample_rate, uint32_t sample_count,
dmichael (off chromium) 2012/01/24 16:54:38 I was confused before when you asked me if we had
nfullagar 2012/01/24 19:14:58 I did try a couple of dry runs to plumb more infor
235 webkit::ppapi::PluginDelegate::PlatformAudioCommonClient* client) { 236 webkit::ppapi::PluginDelegate::PlatformAudioCommonClient* client) {
236 237
237 DCHECK(client); 238 DCHECK(client);
238 // Make sure we don't call init more than once. 239 // Make sure we don't call init more than once.
239 DCHECK_EQ(0, stream_id_); 240 DCHECK_EQ(0, stream_id_);
240 241
241 client_ = client; 242 client_ = client;
242 243
243 AudioParameters params; 244 AudioParameters params;
244 params.format = AudioParameters::AUDIO_PCM_LINEAR; 245 // Use the low latency back end if the client request is compatible.
246 if (sample_rate == audio_hardware::GetOutputSampleRate() &&
247 sample_count % audio_hardware::GetOutputBufferSize() == 0)
248 params.format = AudioParameters::AUDIO_PCM_LOW_LATENCY;
249 else
250 params.format = AudioParameters::AUDIO_PCM_LINEAR;
245 params.channels = 2; 251 params.channels = 2;
246 params.sample_rate = sample_rate; 252 params.sample_rate = sample_rate;
247 params.bits_per_sample = 16; 253 params.bits_per_sample = 16;
248 params.samples_per_packet = sample_count; 254 params.samples_per_packet = sample_count;
249 255
250 ChildProcess::current()->io_message_loop()->PostTask( 256 ChildProcess::current()->io_message_loop()->PostTask(
251 FROM_HERE, 257 FROM_HERE,
252 base::Bind(&PlatformAudioImpl::InitializeOnIOThread, this, params)); 258 base::Bind(&PlatformAudioImpl::InitializeOnIOThread, this, params));
253 return true; 259 return true;
254 } 260 }
(...skipping 1910 matching lines...) Expand 10 before | Expand all | Expand 10 after
2165 2171
2166 bool PepperPluginDelegateImpl::CanUseSocketAPIs() { 2172 bool PepperPluginDelegateImpl::CanUseSocketAPIs() {
2167 WebView* webview = render_view_->webview(); 2173 WebView* webview = render_view_->webview();
2168 WebFrame* main_frame = webview ? webview->mainFrame() : NULL; 2174 WebFrame* main_frame = webview ? webview->mainFrame() : NULL;
2169 GURL url(main_frame ? GURL(main_frame->document().url()) : GURL()); 2175 GURL url(main_frame ? GURL(main_frame->document().url()) : GURL());
2170 if (!url.is_valid()) 2176 if (!url.is_valid())
2171 return false; 2177 return false;
2172 2178
2173 return content::GetContentClient()->renderer()->AllowSocketAPI(url); 2179 return content::GetContentClient()->renderer()->AllowSocketAPI(url);
2174 } 2180 }
OLDNEW
« no previous file with comments | « no previous file | ppapi/api/ppb_audio_config.idl » ('j') | ppapi/api/ppb_audio_config.idl » ('J')

Powered by Google App Engine
This is Rietveld 408576698