win-dshow: Fix hwdevice_ctx leak

This commit is contained in:
jpark37 2022-02-27 12:48:28 -08:00 committed by Jim
parent 490c6214f0
commit c7c52a59f9
2 changed files with 5 additions and 0 deletions

View File

@ -64,6 +64,7 @@ static void init_hw_decoder(struct ffmpeg_decode *d)
}
if (hw_ctx) {
d->hw_device_ctx = hw_ctx;
d->decoder->hw_device_ctx = av_buffer_ref(hw_ctx);
d->hw = true;
}
@ -118,6 +119,9 @@ void ffmpeg_decode_free(struct ffmpeg_decode *decode)
if (decode->frame)
av_frame_free(&decode->frame);
if (decode->hw_device_ctx)
av_buffer_unref(&decode->hw_device_ctx);
if (decode->packet_buffer)
bfree(decode->packet_buffer);

View File

@ -37,6 +37,7 @@ extern "C" {
#endif
struct ffmpeg_decode {
AVBufferRef *hw_device_ctx;
AVCodecContext *decoder;
AVCodec *codec;