You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
lavc: initialize output AVFrame before decoding.
Avoids memleaks with audio when extended_data is nontrivial and the user doesn't reset the frame. Shouldn't have any effect for video for now, but might be useful in the future.
This commit is contained in:
@@ -1305,6 +1305,8 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
|
|||||||
avctx->pkt = avpkt;
|
avctx->pkt = avpkt;
|
||||||
apply_param_change(avctx, avpkt);
|
apply_param_change(avctx, avpkt);
|
||||||
|
|
||||||
|
avcodec_get_frame_defaults(picture);
|
||||||
|
|
||||||
if ((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size || (avctx->active_thread_type & FF_THREAD_FRAME)) {
|
if ((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size || (avctx->active_thread_type & FF_THREAD_FRAME)) {
|
||||||
if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
|
if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
|
||||||
ret = ff_thread_decode_frame(avctx, picture, got_picture_ptr,
|
ret = ff_thread_decode_frame(avctx, picture, got_picture_ptr,
|
||||||
@@ -1400,6 +1402,8 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
|
|||||||
|
|
||||||
apply_param_change(avctx, avpkt);
|
apply_param_change(avctx, avpkt);
|
||||||
|
|
||||||
|
avcodec_get_frame_defaults(frame);
|
||||||
|
|
||||||
if ((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size) {
|
if ((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size) {
|
||||||
ret = avctx->codec->decode(avctx, frame, got_frame_ptr, avpkt);
|
ret = avctx->codec->decode(avctx, frame, got_frame_ptr, avpkt);
|
||||||
if (ret >= 0 && *got_frame_ptr) {
|
if (ret >= 0 && *got_frame_ptr) {
|
||||||
|
Reference in New Issue
Block a user