Commit 1e3af12f authored by huyao's avatar huyao Committed by Facebook GitHub Bot
Browse files

Fix missing PTS initialization with NVIDIA encoder (#3312)

Summary:
Fix **Failed to write packet (Invalid argument)** error when encoding FLV video streams using NVIDIA hardware encoders.

Resolve https://github.com/pytorch/audio/issues/3311

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

Reviewed By: nateanl

Differential Revision: D45611656

Pulled By: mthrok

fbshipit-source-id: 531a83a27d3b19ed9e9aedd161769c60aa0bd175
parent bfb47017
...@@ -924,6 +924,8 @@ EncodeProcess get_video_encode_process( ...@@ -924,6 +924,8 @@ EncodeProcess get_video_encode_process(
AVFramePtr frame{alloc_avframe()}; AVFramePtr frame{alloc_avframe()};
int ret = av_hwframe_get_buffer(codec_ctx->hw_frames_ctx, frame, 0); int ret = av_hwframe_get_buffer(codec_ctx->hw_frames_ctx, frame, 0);
TORCH_CHECK(ret >= 0, "Failed to fetch CUDA frame: ", av_err2string(ret)); TORCH_CHECK(ret >= 0, "Failed to fetch CUDA frame: ", av_err2string(ret));
frame->nb_samples = 1;
frame->pts = 0;
return frame; return frame;
} }
return get_video_frame(src_fmt, src_width, src_height); return get_video_frame(src_fmt, src_width, src_height);
......
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