diff --git a/plugins/win-dshow/ffmpeg-decode.c b/plugins/win-dshow/ffmpeg-decode.c index 4a77a4901..15f00c4d0 100644 --- a/plugins/win-dshow/ffmpeg-decode.c +++ b/plugins/win-dshow/ffmpeg-decode.c @@ -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); diff --git a/plugins/win-dshow/ffmpeg-decode.h b/plugins/win-dshow/ffmpeg-decode.h index f06c01b09..a087208b9 100644 --- a/plugins/win-dshow/ffmpeg-decode.h +++ b/plugins/win-dshow/ffmpeg-decode.h @@ -37,6 +37,7 @@ extern "C" { #endif struct ffmpeg_decode { + AVBufferRef *hw_device_ctx; AVCodecContext *decoder; AVCodec *codec;