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

Side by Side Diff: media/base/win/mf_helpers.h

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 unified diff | Download patch
« no previous file with comments | « no previous file | media/base/win/mf_helpers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
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 #ifndef MEDIA_BASE_WIN_MF_HELPERS_H_ 5 #ifndef MEDIA_BASE_WIN_MF_HELPERS_H_
6 #define MEDIA_BASE_WIN_MF_HELPERS_H_ 6 #define MEDIA_BASE_WIN_MF_HELPERS_H_
7 7
8 #include <mfapi.h> 8 #include <mfapi.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 29 matching lines...) Expand all
40 40
41 #define RETURN_AND_NOTIFY_ON_HR_FAILURE(result, log, error_code, ret) \ 41 #define RETURN_AND_NOTIFY_ON_HR_FAILURE(result, log, error_code, ret) \
42 RETURN_AND_NOTIFY_ON_FAILURE(SUCCEEDED(result), \ 42 RETURN_AND_NOTIFY_ON_FAILURE(SUCCEEDED(result), \
43 log << ", HRESULT: 0x" << std::hex << result, \ 43 log << ", HRESULT: 0x" << std::hex << result, \
44 error_code, ret); 44 error_code, ret);
45 45
46 MF_INITIALIZER_EXPORT void LogDXVAError(int line); 46 MF_INITIALIZER_EXPORT void LogDXVAError(int line);
47 47
48 // Creates a Media Foundation sample with one buffer of length |buffer_length| 48 // Creates a Media Foundation sample with one buffer of length |buffer_length|
49 // on a |align|-byte boundary. Alignment must be a perfect power of 2 or 0. 49 // on a |align|-byte boundary. Alignment must be a perfect power of 2 or 0.
50 MF_INITIALIZER_EXPORT IMFSample* CreateEmptySampleWithBuffer( 50 MF_INITIALIZER_EXPORT base::win::ScopedComPtr<IMFSample>
51 uint32_t buffer_length, 51 CreateEmptySampleWithBuffer(uint32_t buffer_length, int align);
52 int align);
53 52
54 // Provides scoped access to the underlying buffer in an IMFMediaBuffer 53 // Provides scoped access to the underlying buffer in an IMFMediaBuffer
55 // instance. 54 // instance.
56 class MF_INITIALIZER_EXPORT MediaBufferScopedPointer { 55 class MF_INITIALIZER_EXPORT MediaBufferScopedPointer {
57 public: 56 public:
58 MediaBufferScopedPointer(IMFMediaBuffer* media_buffer); 57 MediaBufferScopedPointer(IMFMediaBuffer* media_buffer);
59 ~MediaBufferScopedPointer(); 58 ~MediaBufferScopedPointer();
60 59
61 uint8_t* get() { return buffer_; } 60 uint8_t* get() { return buffer_; }
62 DWORD current_length() const { return current_length_; } 61 DWORD current_length() const { return current_length_; }
63 62
64 private: 63 private:
65 base::win::ScopedComPtr<IMFMediaBuffer> media_buffer_; 64 base::win::ScopedComPtr<IMFMediaBuffer> media_buffer_;
66 uint8_t* buffer_; 65 uint8_t* buffer_;
67 DWORD max_length_; 66 DWORD max_length_;
68 DWORD current_length_; 67 DWORD current_length_;
69 68
70 DISALLOW_COPY_AND_ASSIGN(MediaBufferScopedPointer); 69 DISALLOW_COPY_AND_ASSIGN(MediaBufferScopedPointer);
71 }; 70 };
72 71
73 } // namespace mf 72 } // namespace mf
74 73
75 } // namespace media 74 } // namespace media
76 75
77 #endif // MEDIA_BASE_WIN_MF_HELPERS_H_ 76 #endif // MEDIA_BASE_WIN_MF_HELPERS_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/win/mf_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698