diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 21ad3cf049..ffbabb1061 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -2784,11 +2784,17 @@ int attribute_align_arg avcodec_send_packet(AVCodecContext *avctx, const AVPacke if (avctx->codec->send_packet) { if (avpkt) { - ret = apply_param_change(avctx, (AVPacket *)avpkt); - if (ret < 0) - return ret; + AVPacket tmp = *avpkt; + int did_split = av_packet_split_side_data(&tmp); + ret = apply_param_change(avctx, &tmp); + if (ret >= 0) + ret = avctx->codec->send_packet(avctx, &tmp); + if (did_split) + av_packet_free_side_data(&tmp); + return ret; + } else { + return avctx->codec->send_packet(avctx, NULL); } - return avctx->codec->send_packet(avctx, avpkt); } // Emulation via old API. Assume avpkt is likely not refcounted, while