| 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/video_capture_manager.h" | 5 #include "content/browser/renderer_host/media/video_capture_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 device_task_runner_->PostTask( | 833 device_task_runner_->PostTask( |
| 834 FROM_HERE, | 834 FROM_HERE, |
| 835 base::Bind(&VideoCaptureManager::SetDesktopCaptureWindowIdOnDeviceThread, | 835 base::Bind(&VideoCaptureManager::SetDesktopCaptureWindowIdOnDeviceThread, |
| 836 this, | 836 this, |
| 837 existing_device->video_capture_device(), | 837 existing_device->video_capture_device(), |
| 838 window_id_it->second)); | 838 window_id_it->second)); |
| 839 | 839 |
| 840 notification_window_ids_.erase(window_id_it); | 840 notification_window_ids_.erase(window_id_it); |
| 841 } | 841 } |
| 842 | 842 |
| 843 bool VideoCaptureManager::TakePhoto( |
| 844 int session_id, |
| 845 const media::VideoCaptureDevice::TakePhotoCallback& photo_callback) { |
| 846 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 847 SessionMap::const_iterator session_it = sessions_.find(session_id); |
| 848 if (session_it == sessions_.end()) |
| 849 return false; |
| 850 |
| 851 DeviceEntry* const device_info = |
| 852 GetDeviceEntryForMediaStreamDevice(session_it->second); |
| 853 if (!device_info) |
| 854 return false; |
| 855 return device_info->video_capture_device()->TakePhoto(photo_callback); |
| 856 } |
| 857 |
| 843 void VideoCaptureManager::DoStopDeviceOnDeviceThread( | 858 void VideoCaptureManager::DoStopDeviceOnDeviceThread( |
| 844 std::unique_ptr<media::VideoCaptureDevice> device) { | 859 std::unique_ptr<media::VideoCaptureDevice> device) { |
| 845 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StopDeviceTime"); | 860 SCOPED_UMA_HISTOGRAM_TIMER("Media.VideoCaptureManager.StopDeviceTime"); |
| 846 DCHECK(IsOnDeviceThread()); | 861 DCHECK(IsOnDeviceThread()); |
| 847 device->StopAndDeAllocate(); | 862 device->StopAndDeAllocate(); |
| 848 DVLOG(3) << "DoStopDeviceOnDeviceThread"; | 863 DVLOG(3) << "DoStopDeviceOnDeviceThread"; |
| 849 } | 864 } |
| 850 | 865 |
| 851 void VideoCaptureManager::OnOpened( | 866 void VideoCaptureManager::OnOpened( |
| 852 MediaStreamType stream_type, | 867 MediaStreamType stream_type, |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1095 continue; | 1110 continue; |
| 1096 | 1111 |
| 1097 // Session ID is only valid for Screen capture. So we can fake it to resume | 1112 // Session ID is only valid for Screen capture. So we can fake it to resume |
| 1098 // video capture devices here. | 1113 // video capture devices here. |
| 1099 QueueStartDevice(kFakeSessionId, entry, entry->parameters); | 1114 QueueStartDevice(kFakeSessionId, entry, entry->parameters); |
| 1100 } | 1115 } |
| 1101 } | 1116 } |
| 1102 #endif // defined(OS_ANDROID) | 1117 #endif // defined(OS_ANDROID) |
| 1103 | 1118 |
| 1104 } // namespace content | 1119 } // namespace content |
| OLD | NEW |