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

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

Issue 2369983003: Win video capture: Fix capture format and frame buffer mismatch (Closed)
Patch Set: Remove VideoCaptureDeviceWin |capture_format_| 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 side-by-side diff with in-line comments
Download patch
Index: media/capture/video/win/sink_input_pin_win.cc
diff --git a/media/capture/video/win/sink_input_pin_win.cc b/media/capture/video/win/sink_input_pin_win.cc
index 0abd0a785c10cc83c3969d8de5f29502ec72f01a..6ba69e5705269660871297208339fe7ac9f346f6 100644
--- a/media/capture/video/win/sink_input_pin_win.cc
+++ b/media/capture/video/win/sink_input_pin_win.cc
@@ -193,8 +193,9 @@ HRESULT SinkInputPin::Receive(IMediaSample* sample) {
const int length = sample->GetActualDataLength();
uint8_t* buffer = NULL;
mcasas 2016/10/03 17:32:32 nit: move this to l. 202 and s/NULL/nullptr/
- if (length <= 0) {
- DLOG(WARNING) << "Media sample length is 0 or less.";
+ if (length <= 0 ||
+ static_cast<size_t>(length) < resulting_format_.ImageAllocationSize()) {
+ DLOG(WARNING) << "Wrong media sample length: " << length;
return S_FALSE;
}
@@ -208,7 +209,7 @@ HRESULT SinkInputPin::Receive(IMediaSample* sample) {
timestamp = base::TimeDelta::FromMicroseconds(start_time / 10);
}
- observer_->FrameReceived(buffer, length, timestamp);
+ observer_->FrameReceived(buffer, length, resulting_format_, timestamp);
return S_OK;
}

Powered by Google App Engine
This is Rietveld 408576698