| 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/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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
| 45 #include "base/win/scoped_com_initializer.h" | 45 #include "base/win/scoped_com_initializer.h" |
| 46 #endif | 46 #endif |
| 47 | 47 |
| 48 namespace content { | 48 namespace content { |
| 49 | 49 |
| 50 // Forward declaration of DeviceMonitorMac and its only useable method. | 50 // Forward declaration of DeviceMonitorMac and its only useable method. |
| 51 class DeviceMonitorMac { | 51 class DeviceMonitorMac { |
| 52 public: | 52 public: |
| 53 void StartMonitoring(); | 53 void StartMonitoring( |
| 54 const scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner); |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 namespace { | 57 namespace { |
| 57 // Creates a random label used to identify requests. | 58 // Creates a random label used to identify requests. |
| 58 std::string RandomLabel() { | 59 std::string RandomLabel() { |
| 59 // An earlier PeerConnection spec, | 60 // An earlier PeerConnection spec, |
| 60 // http://dev.w3.org/2011/webrtc/editor/webrtc.html, specified the | 61 // http://dev.w3.org/2011/webrtc/editor/webrtc.html, specified the |
| 61 // MediaStream::label alphabet as containing 36 characters from | 62 // MediaStream::label alphabet as containing 36 characters from |
| 62 // range: U+0021, U+0023 to U+0027, U+002A to U+002B, U+002D to U+002E, | 63 // range: U+0021, U+0023 to U+0027, U+002A to U+002B, U+002D to U+002E, |
| 63 // U+0030 to U+0039, U+0041 to U+005A, U+005E to U+007E. | 64 // U+0030 to U+0039, U+0041 to U+005A, U+005E to U+007E. |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 BrowserThread::UI, FROM_HERE, | 831 BrowserThread::UI, FROM_HERE, |
| 831 base::Bind(&MediaStreamManager::StartMonitoringOnUIThread, | 832 base::Bind(&MediaStreamManager::StartMonitoringOnUIThread, |
| 832 base::Unretained(this))); | 833 base::Unretained(this))); |
| 833 #endif | 834 #endif |
| 834 } | 835 } |
| 835 | 836 |
| 836 #if defined(OS_MACOSX) | 837 #if defined(OS_MACOSX) |
| 837 void MediaStreamManager::StartMonitoringOnUIThread() { | 838 void MediaStreamManager::StartMonitoringOnUIThread() { |
| 838 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 839 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 839 BrowserMainLoop* browser_main_loop = content::BrowserMainLoop::GetInstance(); | 840 BrowserMainLoop* browser_main_loop = content::BrowserMainLoop::GetInstance(); |
| 840 if (browser_main_loop) | 841 if (browser_main_loop) { |
| 841 browser_main_loop->device_monitor_mac()->StartMonitoring(); | 842 browser_main_loop->device_monitor_mac() |
| 843 ->StartMonitoring(audio_manager_->GetWorkerTaskRunner()); |
| 844 } |
| 842 } | 845 } |
| 843 #endif | 846 #endif |
| 844 | 847 |
| 845 void MediaStreamManager::StopMonitoring() { | 848 void MediaStreamManager::StopMonitoring() { |
| 846 DCHECK_EQ(base::MessageLoop::current(), io_loop_); | 849 DCHECK_EQ(base::MessageLoop::current(), io_loop_); |
| 847 if (monitoring_started_) { | 850 if (monitoring_started_) { |
| 848 base::SystemMonitor::Get()->RemoveDevicesChangedObserver(this); | 851 base::SystemMonitor::Get()->RemoveDevicesChangedObserver(this); |
| 849 monitoring_started_ = false; | 852 monitoring_started_ = false; |
| 850 ClearEnumerationCache(&audio_enumeration_cache_); | 853 ClearEnumerationCache(&audio_enumeration_cache_); |
| 851 ClearEnumerationCache(&video_enumeration_cache_); | 854 ClearEnumerationCache(&video_enumeration_cache_); |
| (...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1930 if (it->device.type == MEDIA_DESKTOP_VIDEO_CAPTURE) { | 1933 if (it->device.type == MEDIA_DESKTOP_VIDEO_CAPTURE) { |
| 1931 video_capture_manager_->SetDesktopCaptureWindowId(it->session_id, | 1934 video_capture_manager_->SetDesktopCaptureWindowId(it->session_id, |
| 1932 window_id); | 1935 window_id); |
| 1933 break; | 1936 break; |
| 1934 } | 1937 } |
| 1935 } | 1938 } |
| 1936 } | 1939 } |
| 1937 } | 1940 } |
| 1938 | 1941 |
| 1939 } // namespace content | 1942 } // namespace content |
| OLD | NEW |