Index: content/browser/browser_main_loop.cc |
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc |
index cfaddafe06bd847eb382a18ff16eefbaf1c5618f..b6a9c6df2b657b2dc9bd892f2c43f16a4f37c881 100644 |
--- a/content/browser/browser_main_loop.cc |
+++ b/content/browser/browser_main_loop.cc |
@@ -95,6 +95,7 @@ |
#include "media/audio/audio_system_impl.h" |
#include "media/base/media.h" |
#include "media/base/user_input_monitor.h" |
+#include "media/base/video_facing.h" |
#include "media/midi/midi_service.h" |
#include "mojo/edk/embedder/embedder.h" |
#include "mojo/edk/embedder/scoped_ipc_support.h" |
@@ -162,6 +163,7 @@ |
#if defined(OS_CHROMEOS) |
#include "base/memory/memory_pressure_monitor_chromeos.h" |
+#include "chromeos/audio/cras_audio_handler.h" |
#include "chromeos/chromeos_switches.h" |
#endif |
@@ -1161,6 +1163,22 @@ int BrowserMainLoop::PreMainMessageLoopRun() { |
"BrowserMainLoop::CreateThreads:PreMainMessageLoopRun"); |
parts_->PreMainMessageLoopRun(); |
+ |
+#if defined(OS_CHROMEOS) |
+ if (chromeos::CrasAudioHandler::IsInitialized()) { |
+ if (media_stream_manager_.get() != NULL) { |
nasko
2017/02/15 19:13:47
Use nullptr, no more NULL. Also, just dropping the
shenghao
2017/02/15 22:46:49
Done.
|
+ BrowserThread::PostTask( |
+ BrowserThread::IO, FROM_HERE, |
+ base::Bind(&MediaStreamManager::AddVideoCaptureObserver, |
+ base::Unretained(media_stream_manager_.get()), |
+ chromeos::CrasAudioHandler::Get())); |
+ } else { |
+ DLOG(ERROR) << "media_stream_manager_ is null."; |
nasko
2017/02/15 19:13:47
Are those DLOGs just for debugging and will be rem
shenghao
2017/02/15 22:46:49
Nope. I want to keep it here.
|
+ } |
+ } else { |
+ DLOG(ERROR) << "CrasAudioHandler is not initialized."; |
+ } |
+#endif |
} |
// If the UI thread blocks, the whole UI is unresponsive. |
@@ -1210,6 +1228,10 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { |
if (parts_) { |
TRACE_EVENT0("shutdown", |
"BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); |
+ BrowserThread::PostTask( |
+ BrowserThread::IO, FROM_HERE, |
+ base::Bind(&MediaStreamManager::RemoveAllVideoCaptureObservers, |
+ base::Unretained(media_stream_manager_.get()))); |
parts_->PostMainMessageLoopRun(); |
} |