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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 media::VideoCaptureSessionId capture_session_id, | 528 media::VideoCaptureSessionId capture_session_id, |
529 media::VideoCaptureFormats* formats_in_use) { | 529 media::VideoCaptureFormats* formats_in_use) { |
530 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 530 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
531 DCHECK(formats_in_use->empty()); | 531 DCHECK(formats_in_use->empty()); |
532 | 532 |
533 SessionMap::iterator it = sessions_.find(capture_session_id); | 533 SessionMap::iterator it = sessions_.find(capture_session_id); |
534 if (it == sessions_.end()) | 534 if (it == sessions_.end()) |
535 return false; | 535 return false; |
536 DVLOG(1) << "GetDeviceFormatsInUse for device: " << it->second.name; | 536 DVLOG(1) << "GetDeviceFormatsInUse for device: " << it->second.name; |
537 | 537 |
538 return GetDeviceFormatsInUse(it->second.type, it->second.id, formats_in_use); | 538 base::Optional<media::VideoCaptureFormat> format = |
539 } | 539 GetDeviceFormat(it->second.type, it->second.id); |
| 540 if (format.has_value()) |
| 541 formats_in_use->push_back(format.value()); |
540 | 542 |
541 bool VideoCaptureManager::GetDeviceFormatsInUse( | |
542 MediaStreamType stream_type, | |
543 const std::string& device_id, | |
544 media::VideoCaptureFormats* formats_in_use) { | |
545 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
546 DCHECK(formats_in_use->empty()); | |
547 // Return the currently in-use format(s) of the device, if it's started. | |
548 VideoCaptureController* device_in_use = | |
549 LookupControllerByMediaTypeAndDeviceId(stream_type, device_id); | |
550 if (device_in_use) { | |
551 // Currently only one format-in-use is supported at the VCC level. | |
552 formats_in_use->push_back(device_in_use->GetVideoCaptureFormat()); | |
553 } | |
554 return true; | 543 return true; |
555 } | 544 } |
556 | 545 |
| 546 base::Optional<media::VideoCaptureFormat> VideoCaptureManager::GetDeviceFormat( |
| 547 MediaStreamType stream_type, |
| 548 const std::string& device_id) { |
| 549 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 550 // Return the currently in-use format of the device, if it's started. |
| 551 VideoCaptureController* device_in_use = |
| 552 LookupControllerByMediaTypeAndDeviceId(stream_type, device_id); |
| 553 return device_in_use ? device_in_use->GetVideoCaptureFormat() : base::nullopt; |
| 554 } |
| 555 |
557 void VideoCaptureManager::SetDesktopCaptureWindowId( | 556 void VideoCaptureManager::SetDesktopCaptureWindowId( |
558 media::VideoCaptureSessionId session_id, | 557 media::VideoCaptureSessionId session_id, |
559 gfx::NativeViewId window_id) { | 558 gfx::NativeViewId window_id) { |
560 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 559 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
561 VLOG(2) << "SetDesktopCaptureWindowId called for session " << session_id; | 560 VLOG(2) << "SetDesktopCaptureWindowId called for session " << session_id; |
562 | 561 |
563 notification_window_ids_[session_id] = window_id; | 562 notification_window_ids_[session_id] = window_id; |
564 MaybePostDesktopCaptureWindowId(session_id); | 563 MaybePostDesktopCaptureWindowId(session_id); |
565 } | 564 } |
566 | 565 |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 // Session ID is only valid for Screen capture. So we can fake it to | 865 // Session ID is only valid for Screen capture. So we can fake it to |
867 // resume video capture devices here. | 866 // resume video capture devices here. |
868 QueueStartDevice(kFakeSessionId, controller.get(), | 867 QueueStartDevice(kFakeSessionId, controller.get(), |
869 controller->parameters()); | 868 controller->parameters()); |
870 } | 869 } |
871 } | 870 } |
872 } | 871 } |
873 #endif // defined(OS_ANDROID) | 872 #endif // defined(OS_ANDROID) |
874 | 873 |
875 } // namespace content | 874 } // namespace content |
OLD | NEW |