win-dshow: Fix hwdevice_ctx leak
This commit is contained in:
parent
490c6214f0
commit
c7c52a59f9
@ -64,6 +64,7 @@ static void init_hw_decoder(struct ffmpeg_decode *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hw_ctx) {
|
if (hw_ctx) {
|
||||||
|
d->hw_device_ctx = hw_ctx;
|
||||||
d->decoder->hw_device_ctx = av_buffer_ref(hw_ctx);
|
d->decoder->hw_device_ctx = av_buffer_ref(hw_ctx);
|
||||||
d->hw = true;
|
d->hw = true;
|
||||||
}
|
}
|
||||||
@ -118,6 +119,9 @@ void ffmpeg_decode_free(struct ffmpeg_decode *decode)
|
|||||||
if (decode->frame)
|
if (decode->frame)
|
||||||
av_frame_free(&decode->frame);
|
av_frame_free(&decode->frame);
|
||||||
|
|
||||||
|
if (decode->hw_device_ctx)
|
||||||
|
av_buffer_unref(&decode->hw_device_ctx);
|
||||||
|
|
||||||
if (decode->packet_buffer)
|
if (decode->packet_buffer)
|
||||||
bfree(decode->packet_buffer);
|
bfree(decode->packet_buffer);
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct ffmpeg_decode {
|
struct ffmpeg_decode {
|
||||||
|
AVBufferRef *hw_device_ctx;
|
||||||
AVCodecContext *decoder;
|
AVCodecContext *decoder;
|
||||||
AVCodec *codec;
|
AVCodec *codec;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user