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

Side by Side Diff: content/browser/renderer_host/media/video_capture_device_client.cc

Issue 2369983003: Win video capture: Fix capture format and frame buffer mismatch (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
mcasas 2016/09/27 14:36:02 There's no need to specify the project in the bug
magjed_chromium 2016/09/27 15:19:56 Done.
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_device_client.h" 5 #include "content/browser/renderer_host/media/video_capture_device_client.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 break; 210 break;
211 case media::PIXEL_FORMAT_MJPEG: 211 case media::PIXEL_FORMAT_MJPEG:
212 origin_colorspace = libyuv::FOURCC_MJPG; 212 origin_colorspace = libyuv::FOURCC_MJPG;
213 break; 213 break;
214 default: 214 default:
215 NOTREACHED(); 215 NOTREACHED();
216 } 216 }
217 217
218 // The input |length| can be greater than the required buffer size because of 218 // The input |length| can be greater than the required buffer size because of
219 // paddings and/or alignments, but it cannot be smaller. 219 // paddings and/or alignments, but it cannot be smaller.
220 DCHECK_GE(static_cast<size_t>(length), frame_format.ImageAllocationSize()); 220 if (static_cast<size_t>(length) < frame_format.ImageAllocationSize()) {
mcasas 2016/09/27 14:36:01 IIUC, the DCHECK has never been hit before except
magjed_chromium 2016/09/27 15:19:56 ManyCam doesn't work for the bug reporter in any b
mcasas 2016/09/28 16:39:22 I'm not sure this is the right thing to do. 1- si
magjed_chromium 2016/09/29 11:00:35 1. That's an unrelated change, but sure, I moved t
mcasas 2016/09/29 20:43:31 The crash is only present in Win, and Manycam is a
221 DLOG(WARNING) << "Frame format: "
222 << media::VideoCaptureFormat::ToString(frame_format)
223 << " requires at least " << frame_format.ImageAllocationSize()
224 << " bytes, but only " << length << " bytes was given.";
mcasas 2016/09/27 14:36:01 Who is going to read this DLOG anyway? Code in med
magjed_chromium 2016/09/27 15:19:56 I don't know if anyone will use it. We can remove
mcasas 2016/09/28 16:39:22 Yes, by all means, but probably you would revert
225 return;
226 }
221 227
222 if (external_jpeg_decoder_) { 228 if (external_jpeg_decoder_) {
223 const VideoCaptureGpuJpegDecoder::STATUS status = 229 const VideoCaptureGpuJpegDecoder::STATUS status =
224 external_jpeg_decoder_->GetStatus(); 230 external_jpeg_decoder_->GetStatus();
225 if (status == VideoCaptureGpuJpegDecoder::FAILED) { 231 if (status == VideoCaptureGpuJpegDecoder::FAILED) {
226 external_jpeg_decoder_.reset(); 232 external_jpeg_decoder_.reset();
227 } else if (status == VideoCaptureGpuJpegDecoder::INIT_PASSED && 233 } else if (status == VideoCaptureGpuJpegDecoder::INIT_PASSED &&
228 frame_format.pixel_format == media::PIXEL_FORMAT_MJPEG && 234 frame_format.pixel_format == media::PIXEL_FORMAT_MJPEG &&
229 rotation == 0 && !flip) { 235 rotation == 0 && !flip) {
230 external_jpeg_decoder_->DecodeCapturedData(data, length, frame_format, 236 external_jpeg_decoder_->DecodeCapturedData(data, length, frame_format,
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 reinterpret_cast<uint8_t*>(buffer->data(VideoFrame::kUPlane)); 412 reinterpret_cast<uint8_t*>(buffer->data(VideoFrame::kUPlane));
407 *v_plane_data = 413 *v_plane_data =
408 reinterpret_cast<uint8_t*>(buffer->data(VideoFrame::kVPlane)); 414 reinterpret_cast<uint8_t*>(buffer->data(VideoFrame::kVPlane));
409 return buffer; 415 return buffer;
410 } 416 }
411 NOTREACHED(); 417 NOTREACHED();
412 return std::unique_ptr<Buffer>(); 418 return std::unique_ptr<Buffer>();
413 } 419 }
414 420
415 } // namespace content 421 } // namespace content
OLDNEW
« 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