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

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

Issue 907113002: Reland:Refactored pixel format resize operations in media/video/capture into a function called Vide… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed size for VCC unittest. Created 5 years, 10 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 | « media/video/capture/video_capture_types.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 795dc75e96ac2fe82551fd0f58b71d5523c3b138..08e76a72792d0f488cf970373c18f4b22114e3f5 100644
--- a/media/video/capture/win/sink_input_pin_win.cc
+++ b/media/video/capture/win/sink_input_pin_win.cc
@@ -68,8 +68,7 @@ bool SinkInputPin::GetValidMediaType(int index, AM_MEDIA_TYPE* media_type) {
pvi->bmiHeader.biBitCount = 12; // bit per pixel
pvi->bmiHeader.biWidth = requested_info_header_.biWidth;
pvi->bmiHeader.biHeight = requested_info_header_.biHeight;
- pvi->bmiHeader.biSizeImage =
- GetArea(requested_info_header_) * 3 / 2;
+ pvi->bmiHeader.biSizeImage = GetArea(requested_info_header_) * 3 / 2;
media_type->subtype = kMediaSubTypeI420;
break;
}
@@ -151,6 +150,12 @@ bool SinkInputPin::IsMediaTypeValid(const AM_MEDIA_TYPE* media_type) {
HRESULT SinkInputPin::Receive(IMediaSample* sample) {
const int length = sample->GetActualDataLength();
uint8* buffer = NULL;
+
+ if (length <= 0) {
+ DLOG(WARNING) << "Media sample length is 0 or less.";
+ return S_FALSE;
+ }
+
if (FAILED(sample->GetPointer(&buffer)))
return S_FALSE;
« no previous file with comments | « media/video/capture/video_capture_types.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698