| OLD | NEW |
| 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) || defined(OS_MACOSX) | 29 #if defined(OS_WIN) || defined(OS_MACOSX) || \ |
| 30 (defined(OS_LINUX) && !defined(OS_CHROMEOS)) |
| 30 // Due to driver deadlock issues on Windows (http://crbug/422522) there is a | 31 // 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. | 32 // 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 | 33 // 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". | 34 // device authorization (http://crbug/615589). This will result in "no audio". |
| 34 // There are also cases when authorization takes too long on Mac. | 35 // There are also cases when authorization takes too long on Mac and Linux. |
| 35 const int64_t kMaxAuthorizationTimeoutMs = 10000; | 36 const int64_t kMaxAuthorizationTimeoutMs = 10000; |
| 36 #else | 37 #else |
| 37 const int64_t kMaxAuthorizationTimeoutMs = 0; // No timeout. | 38 const int64_t kMaxAuthorizationTimeoutMs = 0; // No timeout. |
| 38 #endif | 39 #endif |
| 39 | 40 |
| 40 scoped_refptr<media::AudioOutputDevice> NewOutputDevice( | 41 scoped_refptr<media::AudioOutputDevice> NewOutputDevice( |
| 41 int render_frame_id, | 42 int render_frame_id, |
| 42 int session_id, | 43 int session_id, |
| 43 const std::string& device_id, | 44 const std::string& device_id, |
| 44 const url::Origin& security_origin) { | 45 const url::Origin& security_origin) { |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 device_id, security_origin); | 215 device_id, security_origin); |
| 215 if (sink) | 216 if (sink) |
| 216 return sink; | 217 return sink; |
| 217 } | 218 } |
| 218 | 219 |
| 219 return NewOutputDevice(render_frame_id, session_id, device_id, | 220 return NewOutputDevice(render_frame_id, session_id, device_id, |
| 220 security_origin); | 221 security_origin); |
| 221 } | 222 } |
| 222 | 223 |
| 223 } // namespace content | 224 } // namespace content |
| OLD | NEW |