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

Unified Diff: media/video/capture/win/video_capture_device_win.cc

Issue 260053003: Win DS Video Capture: do not add unsupported pixel formats to the capability list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/video/capture/win/video_capture_device_win.cc
diff --git a/media/video/capture/win/video_capture_device_win.cc b/media/video/capture/win/video_capture_device_win.cc
index f56646b3264b595905da6ca8717a4302574d87d4..e78c60450dd9bd7e2f9dba5135121109e8527dbf 100644
--- a/media/video/capture/win/video_capture_device_win.cc
+++ b/media/video/capture/win/video_capture_device_win.cc
@@ -422,17 +422,19 @@ void VideoCaptureDeviceWin::GetDeviceSupportedFormats(const Name& device,
if (media_type->majortype == MEDIATYPE_Video &&
media_type->formattype == FORMAT_VideoInfo) {
+ VideoCaptureFormat format;
+ format.pixel_format =
+ TranslateMediaSubtypeToPixelFormat(media_type->subtype);
+ if (format.pixel_format == PIXEL_FORMAT_UNKNOWN)
+ continue;
VIDEOINFOHEADER* h =
reinterpret_cast<VIDEOINFOHEADER*>(media_type->pbFormat);
- VideoCaptureFormat format;
format.frame_size.SetSize(h->bmiHeader.biWidth,
h->bmiHeader.biHeight);
// Trust the frame rate from the VIDEOINFOHEADER.
format.frame_rate = (h->AvgTimePerFrame > 0) ?
static_cast<int>(kSecondsToReferenceTime / h->AvgTimePerFrame) :
0;
- format.pixel_format =
- TranslateMediaSubtypeToPixelFormat(media_type->subtype);
formats->push_back(format);
DVLOG(1) << device.name() << " resolution: "
<< format.frame_size.ToString() << ", fps: " << format.frame_rate
@@ -705,6 +707,11 @@ bool VideoCaptureDeviceWin::CreateCapabilityMap() {
if (media_type->majortype == MEDIATYPE_Video &&
media_type->formattype == FORMAT_VideoInfo) {
VideoCaptureCapabilityWin capability(i);
+ capability.supported_format.pixel_format =
+ TranslateMediaSubtypeToPixelFormat(media_type->subtype);
+ if (capability.supported_format.pixel_format == PIXEL_FORMAT_UNKNOWN)
+ continue;
+
VIDEOINFOHEADER* h =
reinterpret_cast<VIDEOINFOHEADER*>(media_type->pbFormat);
capability.supported_format.frame_size.SetSize(h->bmiHeader.biWidth,
@@ -745,8 +752,6 @@ bool VideoCaptureDeviceWin::CreateCapabilityMap() {
capability.frame_rate_numerator = capability.supported_format.frame_rate;
capability.frame_rate_denominator = 1;
- capability.supported_format.pixel_format =
- TranslateMediaSubtypeToPixelFormat(media_type->subtype);
capabilities_.Add(capability);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698