Chromium Code Reviews| Index: media/video/capture/win/sink_input_pin_win.cc |
| diff --git a/media/video/capture/win/sink_input_pin_win.cc b/media/video/capture/win/sink_input_pin_win.cc |
| index bf2a247a8381150a7117e03986277261f5773c32..d3fc015e0259736054424ea99802fa942a711e12 100644 |
| --- a/media/video/capture/win/sink_input_pin_win.cc |
| +++ b/media/video/capture/win/sink_input_pin_win.cc |
| @@ -45,6 +45,24 @@ bool SinkInputPin::GetValidMediaType(int index, AM_MEDIA_TYPE* media_type) { |
| media_type->formattype = FORMAT_VideoInfo; |
| media_type->bTemporalCompression = FALSE; |
| + if (requested_format_.pixel_format == PIXEL_FORMAT_MJPEG) { |
| + // If the requested pixel format is MJPEG, accept only MJPEG. |
| + // This is ok since the capabilities of the capturer have been |
| + // enumerated and we know that it is supported. |
| + if (index == 0) { |
|
magjed_chromium
2015/02/05 12:47:32
I would prefer:
if (index != 0)
return false;
|
| + pvi->bmiHeader.biCompression = MAKEFOURCC('M', 'J', 'P', 'G'); |
| + pvi->bmiHeader.biBitCount = 0; |
| + pvi->bmiHeader.biWidth = requested_format_.frame_size.width(); |
| + pvi->bmiHeader.biHeight = requested_format_.frame_size.height(); |
| + pvi->bmiHeader.biSizeImage = 0; |
| + media_type->subtype = MEDIASUBTYPE_MJPG; |
| + media_type->bFixedSizeSamples = FALSE; |
| + media_type->lSampleSize = pvi->bmiHeader.biSizeImage; |
| + return true; |
| + } |
| + return false; |
| + } |
| + |
| switch (index) { |
| case 0: { |
| pvi->bmiHeader.biCompression = MAKEFOURCC('I', '4', '2', '0'); |
| @@ -66,15 +84,6 @@ bool SinkInputPin::GetValidMediaType(int index, AM_MEDIA_TYPE* media_type) { |
| break; |
| } |
| case 2: { |
| - pvi->bmiHeader.biCompression = MAKEFOURCC('M', 'J', 'P', 'G'); |
| - pvi->bmiHeader.biBitCount = 0; |
| - pvi->bmiHeader.biWidth = requested_format_.frame_size.width(); |
| - pvi->bmiHeader.biHeight = requested_format_.frame_size.height(); |
| - pvi->bmiHeader.biSizeImage = 0; |
| - media_type->subtype = MEDIASUBTYPE_MJPG; |
| - break; |
| - } |
| - case 3: { |
| pvi->bmiHeader.biCompression = BI_RGB; |
| pvi->bmiHeader.biBitCount = 24; |
| pvi->bmiHeader.biWidth = requested_format_.frame_size.width(); |