[FFmpeg-devel] [PATCH 09/10] fftools/ffplay: use av_packet_alloc() to allocate packets

Marton Balint cus at passwd.hu
Wed Feb 3 04:00:34 EET 2021



On Mon, 1 Feb 2021, James Almer wrote:

> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> fftools/ffplay.c | 222 ++++++++++++++++++++++++++++-------------------
> 1 file changed, 135 insertions(+), 87 deletions(-)
>
> diff --git a/fftools/ffplay.c b/fftools/ffplay.c
> index 9ff0425163..ef954772ed 100644

[...]

> -static int decoder_decode_frame(Decoder *d, AVFrame *frame, AVSubtitle *sub) {
> +static int decoder_decode_frame(Decoder *d, AVFrame *frame, AVPacket *pkt, AVSubtitle *sub) {
>     int ret = AVERROR(EAGAIN);
>
>     for (;;) {
> -        AVPacket pkt;
> -

This pkt should be kept local, because there is no need for it to be a 
parameter of decoder_decode_frame. So I suggest you add a new Decoder 
attribure tmp_pkt, and initialize pkt with it:

AVPacket *pkt = d->tmp_pkt;

Regards,
Marton


More information about the ffmpeg-devel mailing list