[FFmpeg-devel] Can BSF delay packets?

Aleksey M hex000 at gmail.com
Wed Feb 8 10:30:59 EET 2017


Hi Ronald.

Probably I found the reason why my filter (and vp9_superframe_bsf too) is
not working.

This code in "FFMPEG.C" just overwrites "ret" value, not handling EAGAIN at
all (FFMPEG ver 3.1):

            ret = av_bsf_receive_packet(ost->bsf_ctx[idx - 1], pkt);
>
>             /* HACK! - aac_adtstoasc updates extradata after filtering the
> first frame when
>              * the api states this shouldn't happen after init().
> Propagate it here to the
>              * muxer and to the next filters in the chain to workaround
> this.
>              * TODO/FIXME - Make aac_adtstoasc use new packet side data
> instead of changing
>              * par_out->extradata and adapt muxers accordingly to get rid
> of this. */
>
>             if (!(ost->bsf_extradata_updated[idx - 1] & 1)) {
>                 ret = avcodec_parameters_copy(ost->st->codecpar,
> ost->bsf_ctx[idx - 1]->par_out);
>                 if (ret < 0)
>                     goto finish;
>                 ost->bsf_extradata_updated[idx - 1] |= 1;
>             }
>
>             if (ret == AVERROR(EAGAIN)) {
>                 ret = 0;
>                 idx--;
>                 continue;
>
>             } else if (ret < 0)
>

But in the latest version (
http://git.videolan.org/?p=ffmpeg.git;a=blob_plain;f=ffmpeg.c;hb=dfc6e30cd4b9d1817b78579c11fc6881e40b9733
)
I see the bug is already corrected, that's why we couldn't understand each
other.


On Mon, Feb 6, 2017 at 8:41 PM, Ronald S. Bultje <rsbultje at gmail.com> wrote:

> Hi Aleksey,
>
> On Mon, Feb 6, 2017 at 12:14 PM, Aleksey M <hex000 at gmail.com> wrote:
>
> > Ronald,
> >
> > I looked the vp9_superframe_bsf.c code, but it doesn't help: The only
> place
> > which returns EAGAIN does output packet unref and frees input packet.
> >
> > I tried memset zero on output packet, av_packet_unref, setting out->size
> =
> > 0 and out->side_data_elems = 0, tried to return EAGAIN or 0, nothing
> helps.
> > In any case, "timestamps are not set", "stream is malformed", like the
> > output packet is still used.
>
>
> As frustrating as this may sound, vp9_superframe_bsf does what you're
> asking for, so your best bet is to emulate what it's doing and figure out
> why your code does not invoke the same code path.
>
> Ronald
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list