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

Unified Diff: media/base/win/mf_helpers.cc

Issue 2693923003: Fix IMFSample leak in DXVAVideoDecodeAccelerator (Closed)
Patch Set: fix explicit initialization Created 3 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/base/win/mf_helpers.h ('k') | media/gpu/media_foundation_video_encode_accelerator_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/win/mf_helpers.cc
diff --git a/media/base/win/mf_helpers.cc b/media/base/win/mf_helpers.cc
index e5df966ae2c029f9eb05437cec82f3b057a0f30e..c88f57118c03cab54c3c01120b6315289769a0ae 100644
--- a/media/base/win/mf_helpers.cc
+++ b/media/base/win/mf_helpers.cc
@@ -13,12 +13,15 @@ void LogDXVAError(int line) {
<< line;
}
-IMFSample* CreateEmptySampleWithBuffer(uint32_t buffer_length, int align) {
+base::win::ScopedComPtr<IMFSample> CreateEmptySampleWithBuffer(
+ uint32_t buffer_length,
+ int align) {
CHECK_GT(buffer_length, 0U);
base::win::ScopedComPtr<IMFSample> sample;
HRESULT hr = MFCreateSample(sample.Receive());
- RETURN_ON_HR_FAILURE(hr, "MFCreateSample failed", NULL);
+ RETURN_ON_HR_FAILURE(hr, "MFCreateSample failed",
+ base::win::ScopedComPtr<IMFSample>());
base::win::ScopedComPtr<IMFMediaBuffer> buffer;
if (align == 0) {
@@ -29,13 +32,15 @@ IMFSample* CreateEmptySampleWithBuffer(uint32_t buffer_length, int align) {
hr =
MFCreateAlignedMemoryBuffer(buffer_length, align - 1, buffer.Receive());
}
- RETURN_ON_HR_FAILURE(hr, "Failed to create memory buffer for sample", NULL);
+ RETURN_ON_HR_FAILURE(hr, "Failed to create memory buffer for sample",
+ base::win::ScopedComPtr<IMFSample>());
hr = sample->AddBuffer(buffer.get());
- RETURN_ON_HR_FAILURE(hr, "Failed to add buffer to sample", NULL);
+ RETURN_ON_HR_FAILURE(hr, "Failed to add buffer to sample",
+ base::win::ScopedComPtr<IMFSample>());
buffer->SetCurrentLength(0);
- return sample.Detach();
+ return sample;
}
MediaBufferScopedPointer::MediaBufferScopedPointer(IMFMediaBuffer* media_buffer)
@@ -54,4 +59,4 @@ MediaBufferScopedPointer::~MediaBufferScopedPointer() {
} // namespace mf
-} // namespace media
+} // namespace media
« no previous file with comments | « media/base/win/mf_helpers.h ('k') | media/gpu/media_foundation_video_encode_accelerator_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698