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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 DVLOG(1) << "Got Null entry while resuming capture"; | 661 DVLOG(1) << "Got Null entry while resuming capture"; |
662 } | 662 } |
663 | 663 |
664 // Do not resume Content Video Capture devices, e.g. Tab or Screen capture. | 664 // Do not resume Content Video Capture devices, e.g. Tab or Screen capture. |
665 if (entry->stream_type != MEDIA_DEVICE_VIDEO_CAPTURE) | 665 if (entry->stream_type != MEDIA_DEVICE_VIDEO_CAPTURE) |
666 return; | 666 return; |
667 | 667 |
668 controller->ResumeClient(client_id, client_handler); | 668 controller->ResumeClient(client_id, client_handler); |
669 } | 669 } |
670 | 670 |
| 671 void VideoCaptureManager::RequestRefreshFrameForClient( |
| 672 VideoCaptureController* controller) { |
| 673 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 674 |
| 675 if (DeviceEntry* entry = GetDeviceEntryForController(controller)) { |
| 676 if (media::VideoCaptureDevice* device = entry->video_capture_device()) { |
| 677 device_task_runner_->PostTask( |
| 678 FROM_HERE, |
| 679 base::Bind(&media::VideoCaptureDevice::RequestRefreshFrame, |
| 680 // Unretained is safe to use here because |device| would be |
| 681 // null if it was scheduled for shutdown and destruction, |
| 682 // and because this task is guaranteed to run before the |
| 683 // task that destroys the |device|. |
| 684 base::Unretained(device))); |
| 685 } |
| 686 } |
| 687 } |
| 688 |
671 bool VideoCaptureManager::GetDeviceSupportedFormats( | 689 bool VideoCaptureManager::GetDeviceSupportedFormats( |
672 media::VideoCaptureSessionId capture_session_id, | 690 media::VideoCaptureSessionId capture_session_id, |
673 media::VideoCaptureFormats* supported_formats) { | 691 media::VideoCaptureFormats* supported_formats) { |
674 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 692 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
675 DCHECK(supported_formats->empty()); | 693 DCHECK(supported_formats->empty()); |
676 | 694 |
677 SessionMap::iterator it = sessions_.find(capture_session_id); | 695 SessionMap::iterator it = sessions_.find(capture_session_id); |
678 if (it == sessions_.end()) | 696 if (it == sessions_.end()) |
679 return false; | 697 return false; |
680 DVLOG(1) << "GetDeviceSupportedFormats for device: " << it->second.name; | 698 DVLOG(1) << "GetDeviceSupportedFormats for device: " << it->second.name; |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 995 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
978 BrowserThread::PostTaskAndReply( | 996 BrowserThread::PostTaskAndReply( |
979 BrowserThread::UI, FROM_HERE, | 997 BrowserThread::UI, FROM_HERE, |
980 base::Bind(&AVFoundationGlue::InitializeAVFoundation), | 998 base::Bind(&AVFoundationGlue::InitializeAVFoundation), |
981 base::Bind(&VideoCaptureManager::OnDeviceLayerInitialized, this, | 999 base::Bind(&VideoCaptureManager::OnDeviceLayerInitialized, this, |
982 and_then)); | 1000 and_then)); |
983 } | 1001 } |
984 #endif | 1002 #endif |
985 | 1003 |
986 } // namespace content | 1004 } // namespace content |
OLD | NEW |