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

Unified Diff: services/video_capture/device_factory_media_to_mojo_adapter.cc

Issue 2486543002: [Mojo Video Capture] Add test ReceiveFramesFromFakeCaptureDevice (Closed)
Patch Set: Created 4 years, 1 month 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: services/video_capture/device_factory_media_to_mojo_adapter.cc
diff --git a/services/video_capture/device_factory_media_to_mojo_adapter.cc b/services/video_capture/device_factory_media_to_mojo_adapter.cc
index c39f5c90743dc4b026daad77763c847242d048a4..e15a69c188cdc276f19fd61c4ae1106f6d5f6ba1 100644
--- a/services/video_capture/device_factory_media_to_mojo_adapter.cc
+++ b/services/video_capture/device_factory_media_to_mojo_adapter.cc
@@ -48,7 +48,22 @@ void DeviceFactoryMediaToMojoAdapter::GetSupportedFormats(
const media::VideoCaptureDeviceDescriptor& device_descriptor,
const GetSupportedFormatsCallback& callback) {
std::vector<VideoCaptureFormat> result;
- NOTIMPLEMENTED();
+ std::vector<media::VideoCaptureFormat> media_formats;
+ device_factory_->GetSupportedFormats(device_descriptor, &media_formats);
+ for (const auto& media_format : media_formats) {
+ // The Video Capture Service requires devices to deliver frames either in
+ // I420 or MJPEG formats.
+ if (media_format.pixel_format != media::PIXEL_FORMAT_I420 &&
+ media_format.pixel_format != media::PIXEL_FORMAT_MJPEG)
mcasas 2016/11/09 23:50:29 Y16 was added very recently to FakeVCD and Win [1]
chfremer 2016/11/10 00:28:48 Thanks for the heads up. I have already seen and
mcasas 2016/11/10 01:21:25 Alright. If it's in a few places (ideally, one), j
chfremer 2016/11/10 04:41:35 Done.
+ continue;
+ VideoCaptureFormat format;
+ format.frame_size = media_format.frame_size;
+ format.frame_rate = media_format.frame_rate;
+ if (std::find(std::begin(result), std::end(result), format) !=
+ std::end(result))
+ continue; // Result already contains this format
mcasas 2016/11/09 23:50:29 {} because the if() condition expands > 1 line.
chfremer 2016/11/10 00:28:48 Done.
+ result.push_back(format);
+ }
callback.Run(std::move(result));
}

Powered by Google App Engine
This is Rietveld 408576698