Commit c496fa8a authored by grunell's avatar grunell Committed by Commit bot

Move ensure keyboard mic check in MediaStreamManager to SetupRequest.

Since we on ChromeOS don't (always) need to enumerate devices at all.

BUG=345296
NOTRY=true

Review URL: https://codereview.chromium.org/596233003

Cr-Commit-Position: refs/heads/master@{#296420}
parent 47c9f2e6
...@@ -1082,16 +1082,6 @@ void MediaStreamManager::StartEnumeration(DeviceRequest* request) { ...@@ -1082,16 +1082,6 @@ void MediaStreamManager::StartEnumeration(DeviceRequest* request) {
// Start monitoring the devices when doing the first enumeration. // Start monitoring the devices when doing the first enumeration.
StartMonitoring(); StartMonitoring();
#if defined(OS_CHROMEOS)
if (!has_checked_keyboard_mic_) {
has_checked_keyboard_mic_ = true;
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&MediaStreamManager::CheckKeyboardMicOnUIThread,
base::Unretained(this)));
}
#endif
// Start enumeration for devices of all requested device types. // Start enumeration for devices of all requested device types.
const MediaStreamType streams[] = { request->audio_type(), const MediaStreamType streams[] = { request->audio_type(),
request->video_type() }; request->video_type() };
...@@ -1234,6 +1224,10 @@ void MediaStreamManager::SetupRequest(const std::string& label) { ...@@ -1234,6 +1224,10 @@ void MediaStreamManager::SetupRequest(const std::string& label) {
return; return;
} }
#if defined(OS_CHROMEOS)
EnsureKeyboardMicChecked();
#endif
if (!is_web_contents_capture && !is_screen_capture) { if (!is_web_contents_capture && !is_screen_capture) {
if (EnumerationRequired(&audio_enumeration_cache_, audio_type) || if (EnumerationRequired(&audio_enumeration_cache_, audio_type) ||
EnumerationRequired(&video_enumeration_cache_, video_type)) { EnumerationRequired(&video_enumeration_cache_, video_type)) {
...@@ -2098,6 +2092,17 @@ void MediaStreamManager::OnMediaStreamUIWindowId(MediaStreamType video_type, ...@@ -2098,6 +2092,17 @@ void MediaStreamManager::OnMediaStreamUIWindowId(MediaStreamType video_type,
} }
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
void MediaStreamManager::EnsureKeyboardMicChecked() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (!has_checked_keyboard_mic_) {
has_checked_keyboard_mic_ = true;
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&MediaStreamManager::CheckKeyboardMicOnUIThread,
base::Unretained(this)));
}
}
void MediaStreamManager::CheckKeyboardMicOnUIThread() { void MediaStreamManager::CheckKeyboardMicOnUIThread() {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
......
...@@ -364,6 +364,11 @@ class CONTENT_EXPORT MediaStreamManager ...@@ -364,6 +364,11 @@ class CONTENT_EXPORT MediaStreamManager
gfx::NativeViewId window_id); gfx::NativeViewId window_id);
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
// Ensures that we have checked for presence of a keyboard mic. This is only
// done once. This function should be called before posting a request on the
// UI thread.
void EnsureKeyboardMicChecked();
// Checks if the system has a keyboard mic, and if so, inform the audio // Checks if the system has a keyboard mic, and if so, inform the audio
// manager via SetKeyboardMicOnDeviceThread(). // manager via SetKeyboardMicOnDeviceThread().
void CheckKeyboardMicOnUIThread(); void CheckKeyboardMicOnUIThread();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment