Commit Graph

7 Commits

Author SHA1 Message Date
Aaron Levinson f125c54b7a avutil/hwcontext_dxva2: Don't improperly free IDirect3DSurface9 objects
Add dxva2_pool_release_dummy() and use it in call to
av_buffer_create() in dxva2_pool_alloc().

Prior to this change, av_buffer_create() was called with NULL for the
third argument, which indicates that av_buffer_default_free() should
be used to free the buffer's data.  Eventually, it gets to
buffer_pool_free() and calls buf->free() on a surface object (which is
av_buffer_default_free()).

This can result in a crash when the debug version of the C-runtime is
used on Windows.  While it doesn't appear to result in a crash when
the release version of the C-runtime is used on Windows, it likely
results in memory corruption, since av_free() is being called on
memory that was allocated using
IDirectXVideoAccelerationService::CreateSurface().

Signed-off-by: Aaron Levinson <alevinsn@aracnet.com>
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Reviewed-by: Mark Thompson <sw@jkqxz.net>
(cherry picked from commit 0c1c514643)
2017-05-16 22:04:49 +01:00
Hendrik Leppkes 06a0e18435 hwcontext_dxva2: Use GetDesktopWindow instead of GetShellWindow
Improves compatibility with some MinGW variants,
see 771537edcf
2016-06-26 15:34:40 +02:00
Hendrik Leppkes 162370b473 Merge commit '8e70385a8ed06f96f1e9e35cf7b6788a5c56eded'
* commit '8e70385a8ed06f96f1e9e35cf7b6788a5c56eded':
  hwcontext_dxva2: implement device creation

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-06-26 15:25:24 +02:00
Hendrik Leppkes 0c312a4562 hwcontext_dxva2: support P010 10-bit surfaces 2016-06-22 23:28:47 +02:00
Hendrik Leppkes 3689efea3d Merge commit 'c46db38cde8e8fd8ecb1c6602f10ec0e002f29a8'
* commit 'c46db38cde8e8fd8ecb1c6602f10ec0e002f29a8':
  hwcontext: add a dxva2 implementation

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-06-22 22:38:49 +02:00
Anton Khirnov 8e70385a8e hwcontext_dxva2: implement device creation 2016-05-26 15:40:33 +02:00
Anton Khirnov c46db38cde hwcontext: add a dxva2 implementation 2016-05-17 09:11:25 +02:00