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" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/rand_util.h" | 14 #include "base/rand_util.h" |
15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
18 #include "content/browser/browser_main_loop.h" | 18 #include "content/browser/browser_main_loop.h" |
19 #include "content/browser/media/capture/web_contents_capture_util.h" | 19 #include "content/browser/media/capture/web_contents_capture_util.h" |
20 #include "content/browser/renderer_host/media/audio_input_device_manager.h" | 20 #include "content/browser/renderer_host/media/audio_input_device_manager.h" |
21 #include "content/browser/renderer_host/media/device_request_message_filter.h" | 21 #include "content/browser/renderer_host/media/device_request_message_filter.h" |
| 22 #include "content/browser/renderer_host/media/media_capture_devices_impl.h" |
22 #include "content/browser/renderer_host/media/media_stream_requester.h" | 23 #include "content/browser/renderer_host/media/media_stream_requester.h" |
23 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" | 24 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" |
24 #include "content/browser/renderer_host/media/video_capture_manager.h" | 25 #include "content/browser/renderer_host/media/video_capture_manager.h" |
25 #include "content/browser/renderer_host/render_process_host_impl.h" | 26 #include "content/browser/renderer_host/render_process_host_impl.h" |
26 #include "content/public/browser/browser_thread.h" | 27 #include "content/public/browser/browser_thread.h" |
27 #include "content/public/browser/content_browser_client.h" | 28 #include "content/public/browser/content_browser_client.h" |
28 #include "content/public/browser/media_device_id.h" | 29 #include "content/public/browser/media_device_id.h" |
29 #include "content/public/browser/media_observer.h" | 30 #include "content/public/browser/media_observer.h" |
30 #include "content/public/browser/media_request_state.h" | 31 #include "content/public/browser/media_request_state.h" |
31 #include "content/public/browser/render_process_host.h" | 32 #include "content/public/browser/render_process_host.h" |
(...skipping 1740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1772 return; | 1773 return; |
1773 | 1774 |
1774 // Map the devices to MediaStreamDevices. | 1775 // Map the devices to MediaStreamDevices. |
1775 MediaStreamDevices new_devices; | 1776 MediaStreamDevices new_devices; |
1776 for (StreamDeviceInfoArray::const_iterator it = devices.begin(); | 1777 for (StreamDeviceInfoArray::const_iterator it = devices.begin(); |
1777 it != devices.end(); ++it) { | 1778 it != devices.end(); ++it) { |
1778 new_devices.push_back(it->device); | 1779 new_devices.push_back(it->device); |
1779 } | 1780 } |
1780 | 1781 |
1781 if (IsAudioMediaType(stream_type)) { | 1782 if (IsAudioMediaType(stream_type)) { |
1782 media_observer->OnAudioCaptureDevicesChanged(new_devices); | 1783 MediaCaptureDevicesImpl::GetInstance()->OnAudioCaptureDevicesChanged( |
| 1784 new_devices); |
| 1785 media_observer->OnAudioCaptureDevicesChanged(); |
1783 } else if (IsVideoMediaType(stream_type)) { | 1786 } else if (IsVideoMediaType(stream_type)) { |
1784 media_observer->OnVideoCaptureDevicesChanged(new_devices); | 1787 MediaCaptureDevicesImpl::GetInstance()->OnVideoCaptureDevicesChanged( |
| 1788 new_devices); |
| 1789 media_observer->OnVideoCaptureDevicesChanged(); |
1785 } else { | 1790 } else { |
1786 NOTREACHED(); | 1791 NOTREACHED(); |
1787 } | 1792 } |
1788 } | 1793 } |
1789 | 1794 |
1790 bool MediaStreamManager::RequestDone(const DeviceRequest& request) const { | 1795 bool MediaStreamManager::RequestDone(const DeviceRequest& request) const { |
1791 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 1796 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
1792 | 1797 |
1793 const bool requested_audio = IsAudioMediaType(request.audio_type()); | 1798 const bool requested_audio = IsAudioMediaType(request.audio_type()); |
1794 const bool requested_video = IsVideoMediaType(request.video_type()); | 1799 const bool requested_video = IsVideoMediaType(request.video_type()); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1838 } | 1843 } |
1839 | 1844 |
1840 // Always do enumeration even though some enumeration is in progress, | 1845 // Always do enumeration even though some enumeration is in progress, |
1841 // because those enumeration commands could be sent before these devices | 1846 // because those enumeration commands could be sent before these devices |
1842 // change. | 1847 // change. |
1843 ++active_enumeration_ref_count_[stream_type]; | 1848 ++active_enumeration_ref_count_[stream_type]; |
1844 GetDeviceManager(stream_type)->EnumerateDevices(stream_type); | 1849 GetDeviceManager(stream_type)->EnumerateDevices(stream_type); |
1845 } | 1850 } |
1846 | 1851 |
1847 } // namespace content | 1852 } // namespace content |
OLD | NEW |