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

Side by Side Diff: content/shell/renderer/layout_test/layout_test_content_renderer_client.cc

Issue 2908073002: Make OS audio buffer size limits visible. (Closed)
Patch Set: Created 3 years, 6 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) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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/shell/renderer/layout_test/layout_test_content_renderer_client .h" 5 #include "content/shell/renderer/layout_test/layout_test_content_renderer_client .h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/debugger.h" 9 #include "base/debug/debugger.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 12 matching lines...) Expand all
23 #include "content/shell/renderer/layout_test/layout_test_render_thread_observer. h" 23 #include "content/shell/renderer/layout_test/layout_test_render_thread_observer. h"
24 #include "content/shell/renderer/layout_test/test_media_stream_renderer_factory. h" 24 #include "content/shell/renderer/layout_test/test_media_stream_renderer_factory. h"
25 #include "content/shell/renderer/shell_render_view_observer.h" 25 #include "content/shell/renderer/shell_render_view_observer.h"
26 #include "content/shell/test_runner/mock_credential_manager_client.h" 26 #include "content/shell/test_runner/mock_credential_manager_client.h"
27 #include "content/shell/test_runner/web_frame_test_proxy.h" 27 #include "content/shell/test_runner/web_frame_test_proxy.h"
28 #include "content/shell/test_runner/web_test_interfaces.h" 28 #include "content/shell/test_runner/web_test_interfaces.h"
29 #include "content/shell/test_runner/web_test_runner.h" 29 #include "content/shell/test_runner/web_test_runner.h"
30 #include "content/shell/test_runner/web_view_test_proxy.h" 30 #include "content/shell/test_runner/web_view_test_proxy.h"
31 #include "content/test/mock_webclipboard_impl.h" 31 #include "content/test/mock_webclipboard_impl.h"
32 #include "gin/modules/module_registry.h" 32 #include "gin/modules/module_registry.h"
33 #include "media/audio/audio_manager.h"
33 #include "media/base/audio_latency.h" 34 #include "media/base/audio_latency.h"
34 #include "media/media_features.h" 35 #include "media/media_features.h"
35 #include "third_party/WebKit/public/platform/WebAudioLatencyHint.h" 36 #include "third_party/WebKit/public/platform/WebAudioLatencyHint.h"
36 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" 37 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h"
37 #include "third_party/WebKit/public/platform/WebRTCPeerConnectionHandler.h" 38 #include "third_party/WebKit/public/platform/WebRTCPeerConnectionHandler.h"
38 #include "third_party/WebKit/public/platform/WebRuntimeFeatures.h" 39 #include "third_party/WebKit/public/platform/WebRuntimeFeatures.h"
39 #include "third_party/WebKit/public/platform/modules/webmidi/WebMIDIAccessor.h" 40 #include "third_party/WebKit/public/platform/modules/webmidi/WebMIDIAccessor.h"
40 #include "third_party/WebKit/public/web/WebFrameWidget.h" 41 #include "third_party/WebKit/public/web/WebFrameWidget.h"
41 #include "third_party/WebKit/public/web/WebKit.h" 42 #include "third_party/WebKit/public/web/WebKit.h"
42 #include "third_party/WebKit/public/web/WebPluginParams.h" 43 #include "third_party/WebKit/public/web/WebPluginParams.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 break; 211 break;
211 case blink::WebAudioLatencyHint::kCategoryBalanced: 212 case blink::WebAudioLatencyHint::kCategoryBalanced:
212 buffer_size = 213 buffer_size =
213 media::AudioLatency::GetRtcBufferSize(hw_sample_rate, hw_buffer_size); 214 media::AudioLatency::GetRtcBufferSize(hw_sample_rate, hw_buffer_size);
214 break; 215 break;
215 case blink::WebAudioLatencyHint::kCategoryPlayback: 216 case blink::WebAudioLatencyHint::kCategoryPlayback:
216 buffer_size = 217 buffer_size =
217 media::AudioLatency::GetHighLatencyBufferSize(hw_sample_rate, 0); 218 media::AudioLatency::GetHighLatencyBufferSize(hw_sample_rate, 0);
218 break; 219 break;
219 case blink::WebAudioLatencyHint::kCategoryExact: 220 case blink::WebAudioLatencyHint::kCategoryExact:
220 // TODO(andrew.macpherson@soundtrap.com): http://crbug.com/708917
221 buffer_size = std::min( 221 buffer_size = std::min(
222 4096, media::AudioLatency::GetExactBufferSize( 222 media::AudioManager::GetMaximumAudioBufferSize(hw_sample_rate),
223 base::TimeDelta::FromSecondsD(latency_hint.Seconds()), 223 media::AudioLatency::GetExactBufferSize(
224 hw_sample_rate, hw_buffer_size)); 224 base::TimeDelta::FromSecondsD(latency_hint.Seconds()),
225 hw_sample_rate, hw_buffer_size));
225 break; 226 break;
226 default: 227 default:
227 NOTREACHED(); 228 NOTREACHED();
228 break; 229 break;
229 } 230 }
230 test_runner::WebTestInterfaces* interfaces = 231 test_runner::WebTestInterfaces* interfaces =
231 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces(); 232 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces();
232 return interfaces->CreateAudioDevice(hw_sample_rate, buffer_size); 233 return interfaces->CreateAudioDevice(hw_sample_rate, buffer_size);
233 } 234 }
234 235
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 switches::kStableReleaseMode)) { 269 switches::kStableReleaseMode)) {
269 blink::WebRuntimeFeatures::EnableTestOnlyFeatures(true); 270 blink::WebRuntimeFeatures::EnableTestOnlyFeatures(true);
270 } 271 }
271 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 272 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
272 switches::kEnableFontAntialiasing)) { 273 switches::kEnableFontAntialiasing)) {
273 blink::SetFontAntialiasingEnabledForTest(true); 274 blink::SetFontAntialiasingEnabledForTest(true);
274 } 275 }
275 } 276 }
276 277
277 } // namespace content 278 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698