| 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/renderer_host/media/audio_input_device_manager.h" | 19 #include "content/browser/renderer_host/media/audio_input_device_manager.h" |
| 20 #include "content/browser/renderer_host/media/device_request_message_filter.h" | 20 #include "content/browser/renderer_host/media/device_request_message_filter.h" |
| 21 #include "content/browser/renderer_host/media/media_capture_devices_impl.h" |
| 21 #include "content/browser/renderer_host/media/media_stream_requester.h" | 22 #include "content/browser/renderer_host/media/media_stream_requester.h" |
| 22 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" | 23 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" |
| 23 #include "content/browser/renderer_host/media/video_capture_manager.h" | 24 #include "content/browser/renderer_host/media/video_capture_manager.h" |
| 24 #include "content/browser/renderer_host/media/web_contents_capture_util.h" | 25 #include "content/browser/renderer_host/media/web_contents_capture_util.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" |
| (...skipping 1714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1745 return; | 1746 return; |
| 1746 | 1747 |
| 1747 // Map the devices to MediaStreamDevices. | 1748 // Map the devices to MediaStreamDevices. |
| 1748 MediaStreamDevices new_devices; | 1749 MediaStreamDevices new_devices; |
| 1749 for (StreamDeviceInfoArray::const_iterator it = devices.begin(); | 1750 for (StreamDeviceInfoArray::const_iterator it = devices.begin(); |
| 1750 it != devices.end(); ++it) { | 1751 it != devices.end(); ++it) { |
| 1751 new_devices.push_back(it->device); | 1752 new_devices.push_back(it->device); |
| 1752 } | 1753 } |
| 1753 | 1754 |
| 1754 if (IsAudioMediaType(stream_type)) { | 1755 if (IsAudioMediaType(stream_type)) { |
| 1755 media_observer->OnAudioCaptureDevicesChanged(new_devices); | 1756 MediaCaptureDevicesImpl::GetInstance()->OnAudioCaptureDevicesChanged( |
| 1757 new_devices); |
| 1758 media_observer->OnAudioCaptureDevicesChanged(); |
| 1756 } else if (IsVideoMediaType(stream_type)) { | 1759 } else if (IsVideoMediaType(stream_type)) { |
| 1757 media_observer->OnVideoCaptureDevicesChanged(new_devices); | 1760 MediaCaptureDevicesImpl::GetInstance()->OnVideoCaptureDevicesChanged( |
| 1761 new_devices); |
| 1762 media_observer->OnVideoCaptureDevicesChanged(); |
| 1758 } else { | 1763 } else { |
| 1759 NOTREACHED(); | 1764 NOTREACHED(); |
| 1760 } | 1765 } |
| 1761 } | 1766 } |
| 1762 | 1767 |
| 1763 bool MediaStreamManager::RequestDone(const DeviceRequest& request) const { | 1768 bool MediaStreamManager::RequestDone(const DeviceRequest& request) const { |
| 1764 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 1769 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 1765 | 1770 |
| 1766 const bool requested_audio = IsAudioMediaType(request.audio_type()); | 1771 const bool requested_audio = IsAudioMediaType(request.audio_type()); |
| 1767 const bool requested_video = IsVideoMediaType(request.video_type()); | 1772 const bool requested_video = IsVideoMediaType(request.video_type()); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1811 } | 1816 } |
| 1812 | 1817 |
| 1813 // Always do enumeration even though some enumeration is in progress, | 1818 // Always do enumeration even though some enumeration is in progress, |
| 1814 // because those enumeration commands could be sent before these devices | 1819 // because those enumeration commands could be sent before these devices |
| 1815 // change. | 1820 // change. |
| 1816 ++active_enumeration_ref_count_[stream_type]; | 1821 ++active_enumeration_ref_count_[stream_type]; |
| 1817 GetDeviceManager(stream_type)->EnumerateDevices(stream_type); | 1822 GetDeviceManager(stream_type)->EnumerateDevices(stream_type); |
| 1818 } | 1823 } |
| 1819 | 1824 |
| 1820 } // namespace content | 1825 } // namespace content |
| OLD | NEW |