Quoting Mark Thompson (2017-04-26 22:49:01)
> This was left over from an earlier version which created the new
> packet inside the current frame structure. Now it just leaks an
> unused packet, so remove the allocation entirely.
> ---
> On 26/04/17 10:41, Anton Khirnov wrote:
> > ---
> > libavcodec/vp9_raw_reorder_bsf.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/libavcodec/vp9_raw_reorder_bsf.c
> > b/libavcodec/vp9_raw_reorder_bsf.c
> > index 7f00f5f..fca1264 100644
> > --- a/libavcodec/vp9_raw_reorder_bsf.c
> > +++ b/libavcodec/vp9_raw_reorder_bsf.c
> > @@ -205,6 +205,7 @@ static int vp9_raw_reorder_make_output(AVBSFContext
> > *bsf,
> > frame->sequence, frame->pts);
> >
> > av_packet_move_ref(out, frame->packet);
> > + av_packet_free(&frame->packet);
> >
> > frame->needs_output = frame->needs_display = 0;
> > } else if (frame->needs_output) {
> > @@ -219,6 +220,7 @@ static int vp9_raw_reorder_make_output(AVBSFContext
> > *bsf,
> > }
> >
> > av_packet_move_ref(out, frame->packet);
> > + av_packet_free(&frame->packet);
> > out->pts = out->dts;
> >
> > frame->needs_output = 0;
> >
>
> How about not making the empty packet in the first place?
>
>
> libavcodec/vp9_raw_reorder_bsf.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/libavcodec/vp9_raw_reorder_bsf.c
> b/libavcodec/vp9_raw_reorder_bsf.c
> index 7f00f5f10..f5a5e49ed 100644
> --- a/libavcodec/vp9_raw_reorder_bsf.c
> +++ b/libavcodec/vp9_raw_reorder_bsf.c
> @@ -241,10 +241,6 @@ static int vp9_raw_reorder_make_output(AVBSFContext *bsf,
> "(%"PRId64") from slot %d.\n",
> frame->sequence, frame->pts, s);
>
> - frame->packet = av_packet_alloc();
> - if (!frame->packet)
> - return AVERROR(ENOMEM);
> -
> err = av_new_packet(out, 2);
> if (err < 0)
> return err;
> --
> 2.11.0
Yes, I suppose that's better. Dropping my patch then.
--
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel