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

Side by Side Diff: content/renderer/media/audio_device_factory.cc

Issue 2569183002: Speculative increase of AudioOutputDevice authorization timeout. (Closed)
Patch Set: Created 4 years 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 | no next file » | 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/audio_device_factory.h" 5 #include "content/renderer/media/audio_device_factory.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "content/common/content_constants_internal.h" 12 #include "content/common/content_constants_internal.h"
13 #include "content/renderer/media/audio_input_message_filter.h" 13 #include "content/renderer/media/audio_input_message_filter.h"
14 #include "content/renderer/media/audio_message_filter.h" 14 #include "content/renderer/media/audio_message_filter.h"
15 #include "content/renderer/media/audio_renderer_mixer_manager.h" 15 #include "content/renderer/media/audio_renderer_mixer_manager.h"
16 #include "content/renderer/render_thread_impl.h" 16 #include "content/renderer/render_thread_impl.h"
17 #include "media/audio/audio_input_device.h" 17 #include "media/audio/audio_input_device.h"
18 #include "media/audio/audio_output_device.h" 18 #include "media/audio/audio_output_device.h"
19 #include "media/base/audio_renderer_mixer_input.h" 19 #include "media/base/audio_renderer_mixer_input.h"
20 #include "media/base/media_switches.h" 20 #include "media/base/media_switches.h"
21 #include "url/origin.h" 21 #include "url/origin.h"
22 22
23 namespace content { 23 namespace content {
24 24
25 // static 25 // static
26 AudioDeviceFactory* AudioDeviceFactory::factory_ = NULL; 26 AudioDeviceFactory* AudioDeviceFactory::factory_ = NULL;
27 27
28 namespace { 28 namespace {
29 #if defined(OS_WIN) 29 #if defined(OS_WIN) || defined(OS_MACOSX)
30 // Due to driver deadlock issues on Windows (http://crbug/422522) there is a 30 // Due to driver deadlock issues on Windows (http://crbug/422522) there is a
31 // chance device authorization response is never received from the browser side. 31 // chance device authorization response is never received from the browser side.
32 // In this case we will time out, to avoid renderer hang forever waiting for 32 // In this case we will time out, to avoid renderer hang forever waiting for
33 // device authorization (http://crbug/615589). This will result in "no audio". 33 // device authorization (http://crbug/615589). This will result in "no audio".
34 const int64_t kMaxAuthorizationTimeoutMs = 1000; 34 // There are also cases when authorization takes too long on Mac.
35 #elif defined(OS_MACOSX) 35 const int64_t kMaxAuthorizationTimeoutMs = 4000;
36 const int64_t kMaxAuthorizationTimeoutMs = 2000;
37 #else 36 #else
38 const int64_t kMaxAuthorizationTimeoutMs = 0; // No timeout. 37 const int64_t kMaxAuthorizationTimeoutMs = 0; // No timeout.
39 #endif // defined(OS_WIN) 38 #endif
40 39
41 scoped_refptr<media::AudioOutputDevice> NewOutputDevice( 40 scoped_refptr<media::AudioOutputDevice> NewOutputDevice(
42 int render_frame_id, 41 int render_frame_id,
43 int session_id, 42 int session_id,
44 const std::string& device_id, 43 const std::string& device_id,
45 const url::Origin& security_origin) { 44 const url::Origin& security_origin) {
46 AudioMessageFilter* const filter = AudioMessageFilter::Get(); 45 AudioMessageFilter* const filter = AudioMessageFilter::Get();
47 scoped_refptr<media::AudioOutputDevice> device(new media::AudioOutputDevice( 46 scoped_refptr<media::AudioOutputDevice> device(new media::AudioOutputDevice(
48 filter->CreateAudioOutputIPC(render_frame_id), filter->io_task_runner(), 47 filter->CreateAudioOutputIPC(render_frame_id), filter->io_task_runner(),
49 session_id, device_id, security_origin, 48 session_id, device_id, security_origin,
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 device_id, security_origin); 214 device_id, security_origin);
216 if (sink) 215 if (sink)
217 return sink; 216 return sink;
218 } 217 }
219 218
220 return NewOutputDevice(render_frame_id, session_id, device_id, 219 return NewOutputDevice(render_frame_id, session_id, device_id,
221 security_origin); 220 security_origin);
222 } 221 }
223 222
224 } // namespace content 223 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698