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

Side by Side Diff: content/renderer/media/renderer_webaudiodevice_impl.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
« no previous file with comments | « no previous file | content/shell/renderer/layout_test/layout_test_content_renderer_client.cc » ('j') | no next file with comments »
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/media/renderer_webaudiodevice_impl.h" 5 #include "content/renderer/media/renderer_webaudiodevice_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "content/renderer/media/audio_device_factory.h" 16 #include "content/renderer/media/audio_device_factory.h"
17 #include "content/renderer/render_frame_impl.h" 17 #include "content/renderer/render_frame_impl.h"
18 #include "content/renderer/render_thread_impl.h" 18 #include "content/renderer/render_thread_impl.h"
19 #include "media/audio/audio_manager.h"
19 #include "media/base/audio_timestamp_helper.h" 20 #include "media/base/audio_timestamp_helper.h"
20 #include "media/base/silent_sink_suspender.h" 21 #include "media/base/silent_sink_suspender.h"
21 #include "third_party/WebKit/public/web/WebLocalFrame.h" 22 #include "third_party/WebKit/public/web/WebLocalFrame.h"
22 #include "third_party/WebKit/public/web/WebView.h" 23 #include "third_party/WebKit/public/web/WebView.h"
23 24
24 using blink::WebAudioDevice; 25 using blink::WebAudioDevice;
25 using blink::WebAudioLatencyHint; 26 using blink::WebAudioLatencyHint;
26 using blink::WebLocalFrame; 27 using blink::WebLocalFrame;
27 using blink::WebVector; 28 using blink::WebVector;
28 using blink::WebView; 29 using blink::WebView;
(...skipping 29 matching lines...) Expand all
58 break; 59 break;
59 case media::AudioLatency::LATENCY_RTC: 60 case media::AudioLatency::LATENCY_RTC:
60 return media::AudioLatency::GetRtcBufferSize( 61 return media::AudioLatency::GetRtcBufferSize(
61 hardware_params.sample_rate(), hardware_params.frames_per_buffer()); 62 hardware_params.sample_rate(), hardware_params.frames_per_buffer());
62 break; 63 break;
63 case media::AudioLatency::LATENCY_PLAYBACK: 64 case media::AudioLatency::LATENCY_PLAYBACK:
64 return media::AudioLatency::GetHighLatencyBufferSize( 65 return media::AudioLatency::GetHighLatencyBufferSize(
65 hardware_params.sample_rate(), 0); 66 hardware_params.sample_rate(), 0);
66 break; 67 break;
67 case media::AudioLatency::LATENCY_EXACT_MS: 68 case media::AudioLatency::LATENCY_EXACT_MS:
68 // TODO(andrew.macpherson@soundtrap.com): http://crbug.com/708917 69 return std::min(media::AudioManager::GetMaximumAudioBufferSize(
o1ka 2017/05/29 16:11:33 AudioManager is browser side only entity and canno
69 return std::min(4096, 70 hardware_params.sample_rate()),
70 media::AudioLatency::GetExactBufferSize( 71 media::AudioLatency::GetExactBufferSize(
71 base::TimeDelta::FromSecondsD(latency_hint.Seconds()), 72 base::TimeDelta::FromSecondsD(latency_hint.Seconds()),
72 hardware_params.sample_rate(), 73 hardware_params.sample_rate(),
73 hardware_params.frames_per_buffer())); 74 media::AudioManager::GetMinimumAudioBufferSize(
75 hardware_params.sample_rate())));
74 break; 76 break;
75 default: 77 default:
76 NOTREACHED(); 78 NOTREACHED();
77 } 79 }
78 return 0; 80 return 0;
79 } 81 }
80 82
81 int FrameIdFromCurrentContext() { 83 int FrameIdFromCurrentContext() {
82 // Assumption: This method is being invoked within a V8 call stack. CHECKs 84 // Assumption: This method is being invoked within a V8 call stack. CHECKs
83 // will fail in the call to frameForCurrentContext() otherwise. 85 // will fail in the call to frameForCurrentContext() otherwise.
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 const scoped_refptr<base::SingleThreadTaskRunner>& 243 const scoped_refptr<base::SingleThreadTaskRunner>&
242 RendererWebAudioDeviceImpl::GetMediaTaskRunner() { 244 RendererWebAudioDeviceImpl::GetMediaTaskRunner() {
243 if (!media_task_runner_) { 245 if (!media_task_runner_) {
244 media_task_runner_ = 246 media_task_runner_ =
245 RenderThreadImpl::current()->GetMediaThreadTaskRunner(); 247 RenderThreadImpl::current()->GetMediaThreadTaskRunner();
246 } 248 }
247 return media_task_runner_; 249 return media_task_runner_;
248 } 250 }
249 251
250 } // namespace content 252 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/shell/renderer/layout_test/layout_test_content_renderer_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698