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

Side by Side Diff: content/browser/renderer_host/media/media_stream_manager.cc

Issue 583833008: Set keyboard mic effect if available. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « content/browser/renderer_host/media/media_stream_manager.h ('k') | media/audio/audio_manager.h » ('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/browser/renderer_host/media/media_stream_manager.h" 5 #include "content/browser/renderer_host/media/media_stream_manager.h"
6 6
7 #include <list> 7 #include <list>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 MediaStreamManager::EnumerationCache::EnumerationCache() 351 MediaStreamManager::EnumerationCache::EnumerationCache()
352 : valid(false) { 352 : valid(false) {
353 } 353 }
354 354
355 MediaStreamManager::EnumerationCache::~EnumerationCache() { 355 MediaStreamManager::EnumerationCache::~EnumerationCache() {
356 } 356 }
357 357
358 MediaStreamManager::MediaStreamManager() 358 MediaStreamManager::MediaStreamManager()
359 : audio_manager_(NULL), 359 : audio_manager_(NULL),
360 monitoring_started_(false), 360 monitoring_started_(false),
361 #if defined(OS_CHROMEOS)
362 has_checked_keyboard_mic_(false),
363 #endif
361 io_loop_(NULL), 364 io_loop_(NULL),
362 use_fake_ui_(false) {} 365 use_fake_ui_(false) {}
363 366
364 MediaStreamManager::MediaStreamManager(media::AudioManager* audio_manager) 367 MediaStreamManager::MediaStreamManager(media::AudioManager* audio_manager)
365 : audio_manager_(audio_manager), 368 : audio_manager_(audio_manager),
366 monitoring_started_(false), 369 monitoring_started_(false),
370 #if defined(OS_CHROMEOS)
371 has_checked_keyboard_mic_(false),
372 #endif
367 io_loop_(NULL), 373 io_loop_(NULL),
368 use_fake_ui_(false) { 374 use_fake_ui_(false) {
369 DCHECK(audio_manager_); 375 DCHECK(audio_manager_);
370 memset(active_enumeration_ref_count_, 0, 376 memset(active_enumeration_ref_count_, 0,
371 sizeof(active_enumeration_ref_count_)); 377 sizeof(active_enumeration_ref_count_));
372 378
373 // Some unit tests create the MSM in the IO thread and assumes the 379 // Some unit tests create the MSM in the IO thread and assumes the
374 // initialization is done synchronously. 380 // initialization is done synchronously.
375 if (BrowserThread::CurrentlyOn(BrowserThread::IO)) { 381 if (BrowserThread::CurrentlyOn(BrowserThread::IO)) {
376 InitializeDeviceManagersOnIOThread(); 382 InitializeDeviceManagersOnIOThread();
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 // If the cache isn't valid, we need to start a full enumeration. 1071 // If the cache isn't valid, we need to start a full enumeration.
1066 return !cache->valid; 1072 return !cache->valid;
1067 } 1073 }
1068 1074
1069 void MediaStreamManager::StartEnumeration(DeviceRequest* request) { 1075 void MediaStreamManager::StartEnumeration(DeviceRequest* request) {
1070 DCHECK_CURRENTLY_ON(BrowserThread::IO); 1076 DCHECK_CURRENTLY_ON(BrowserThread::IO);
1071 1077
1072 // Start monitoring the devices when doing the first enumeration. 1078 // Start monitoring the devices when doing the first enumeration.
1073 StartMonitoring(); 1079 StartMonitoring();
1074 1080
1081 #if defined(OS_CHROMEOS)
1082 if (!has_checked_keyboard_mic_) {
1083 has_checked_keyboard_mic_ = true;
1084 BrowserThread::PostTask(
1085 BrowserThread::UI, FROM_HERE,
1086 base::Bind(&MediaStreamManager::CheckKeyboardMicOnUIThread,
1087 base::Unretained(this)));
1088 }
1089 #endif
1090
1075 // Start enumeration for devices of all requested device types. 1091 // Start enumeration for devices of all requested device types.
1076 const MediaStreamType streams[] = { request->audio_type(), 1092 const MediaStreamType streams[] = { request->audio_type(),
1077 request->video_type() }; 1093 request->video_type() };
1078 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(streams); ++i) { 1094 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(streams); ++i) {
1079 if (streams[i] == MEDIA_NO_SERVICE) 1095 if (streams[i] == MEDIA_NO_SERVICE)
1080 continue; 1096 continue;
1081 request->SetState(streams[i], MEDIA_REQUEST_STATE_REQUESTED); 1097 request->SetState(streams[i], MEDIA_REQUEST_STATE_REQUESTED);
1082 DCHECK_GE(active_enumeration_ref_count_[streams[i]], 0); 1098 DCHECK_GE(active_enumeration_ref_count_[streams[i]], 0);
1083 if (active_enumeration_ref_count_[streams[i]] == 0) { 1099 if (active_enumeration_ref_count_[streams[i]] == 0) {
1084 ++active_enumeration_ref_count_[streams[i]]; 1100 ++active_enumeration_ref_count_[streams[i]];
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
2070 ++it) { 2086 ++it) {
2071 if (it->device.type == MEDIA_DESKTOP_VIDEO_CAPTURE) { 2087 if (it->device.type == MEDIA_DESKTOP_VIDEO_CAPTURE) {
2072 video_capture_manager_->SetDesktopCaptureWindowId(it->session_id, 2088 video_capture_manager_->SetDesktopCaptureWindowId(it->session_id,
2073 window_id); 2089 window_id);
2074 break; 2090 break;
2075 } 2091 }
2076 } 2092 }
2077 } 2093 }
2078 } 2094 }
2079 2095
2096 #if defined(OS_CHROMEOS)
2097 void MediaStreamManager::CheckKeyboardMicOnUIThread() {
2098 DCHECK_CURRENTLY_ON(BrowserThread::UI);
2099 if (CrasAudioHandler::Get()->HasKeyboardMic()) {
2100 audio_manager_->SetHasKeyboardMic();
Henrik Grunell 2014/09/20 15:46:43 Hmm, I guess the audio manager should be accessed
tommi (sloooow) - chröme 2014/09/20 16:00:52 Looks like |audio_manager_| is already being used
2101 }
2102 }
2103 #endif
2104
2080 } // namespace content 2105 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/media_stream_manager.h ('k') | media/audio/audio_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698