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

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: Revert changes to video_capture_device_client.cc 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
« no previous file with comments | « media/capture/video/win/sink_input_pin_win.h ('k') | media/capture/video/win/video_capture_device_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e55316201d0fa4b16272a523c25aa6c27bec7d46 100644
--- a/media/capture/video/win/sink_input_pin_win.cc
+++ b/media/capture/video/win/sink_input_pin_win.cc
@@ -191,13 +191,14 @@ bool SinkInputPin::GetValidMediaType(int index, AM_MEDIA_TYPE* media_type) {
HRESULT SinkInputPin::Receive(IMediaSample* sample) {
const int length = sample->GetActualDataLength();
- uint8_t* buffer = NULL;
- 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;
}
+ uint8_t* buffer = nullptr;
if (FAILED(sample->GetPointer(&buffer)))
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;
}
« no previous file with comments | « media/capture/video/win/sink_input_pin_win.h ('k') | media/capture/video/win/video_capture_device_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698