Commit 9533d300 authored by Moto Hira's avatar Moto Hira Committed by Facebook GitHub Bot
Browse files

Fix GPU memory leak on StreamReader (#3186)

Summary:
Pull Request resolved: https://github.com/pytorch/audio/pull/3186

Fix the GPU memory leak introduced in https://github.com/pytorch/audio/pull/3183

The HW frames context is owned by AVCodecContext.
The removed `av_buffer_ref` call increased the ferenrence counting unnecessarily,
and prevented AVCodecContext from feeing the resource.

(Note: this ignores all push blocking failures!)

Reviewed By: nateanl

Differential Revision: D44231876

fbshipit-source-id: 9be2c33049dd02a3fa82a85271de7fb62e5b09ea
parent c5b96558
...@@ -157,7 +157,7 @@ AVCodecContextPtr get_codec_ctx( ...@@ -157,7 +157,7 @@ AVCodecContextPtr get_codec_ctx(
configure_codec_context(codec_ctx, params, device); configure_codec_context(codec_ctx, params, device);
open_codec(codec_ctx, decoder_option); open_codec(codec_ctx, decoder_option);
if (codec_ctx->hw_device_ctx) { if (codec_ctx->hw_device_ctx) {
codec_ctx->hw_frames_ctx = av_buffer_ref(get_hw_frames_ctx(codec_ctx)); codec_ctx->hw_frames_ctx = get_hw_frames_ctx(codec_ctx);
} }
return codec_ctx; return codec_ctx;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment