Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Unified Diff: content/browser/renderer_host/media/video_capture_manager.cc

Issue 2810723002: Refactor VideoCaptureManager::GetDeviceFormatsInUse() (Closed)
Patch Set: Addressed review comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/video_capture_manager.cc
diff --git a/content/browser/renderer_host/media/video_capture_manager.cc b/content/browser/renderer_host/media/video_capture_manager.cc
index 9c58c0ffa041a90041c82ab92666431b82462636..33a0ea68b2f4cdd8352bf4930968e05316f476a5 100644
--- a/content/browser/renderer_host/media/video_capture_manager.cc
+++ b/content/browser/renderer_host/media/video_capture_manager.cc
@@ -535,23 +535,22 @@ bool VideoCaptureManager::GetDeviceFormatsInUse(
return false;
DVLOG(1) << "GetDeviceFormatsInUse for device: " << it->second.name;
- return GetDeviceFormatsInUse(it->second.type, it->second.id, formats_in_use);
+ base::Optional<media::VideoCaptureFormat> format =
+ GetDeviceFormatInUse(it->second.type, it->second.id);
+ if (format.has_value())
+ formats_in_use->push_back(format.value());
+
+ return true;
}
-bool VideoCaptureManager::GetDeviceFormatsInUse(
- MediaStreamType stream_type,
- const std::string& device_id,
- media::VideoCaptureFormats* formats_in_use) {
+base::Optional<media::VideoCaptureFormat>
+VideoCaptureManager::GetDeviceFormatInUse(MediaStreamType stream_type,
+ const std::string& device_id) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- DCHECK(formats_in_use->empty());
- // Return the currently in-use format(s) of the device, if it's started.
+ // Return the currently in-use format of the device, if it's started.
VideoCaptureController* device_in_use =
LookupControllerByMediaTypeAndDeviceId(stream_type, device_id);
- if (device_in_use) {
- // Currently only one format-in-use is supported at the VCC level.
- formats_in_use->push_back(device_in_use->GetVideoCaptureFormat());
- }
- return true;
+ return device_in_use ? device_in_use->GetVideoCaptureFormat() : base::nullopt;
}
void VideoCaptureManager::SetDesktopCaptureWindowId(

Powered by Google App Engine
This is Rietveld 408576698