[FFmpeg-devel] [PATCH] libavformat: add librist protocol

Paul B Mahol onemda at gmail.com
Mon Mar 1 00:17:29 EET 2021


On Sun, Feb 28, 2021 at 11:14 PM Marton Balint <cus at passwd.hu> wrote:

>
>
> On Sun, 28 Feb 2021, Paul B Mahol wrote:
>
> > This work is sponsored by Open Broadcast Systems.
> >
> > Signed-off-by: Paul B Mahol <onemda at gmail.com>
> > ---
> > configure               |   5 +
> > doc/protocols.texi      |  29 +++++
> > libavformat/Makefile    |   1 +
> > libavformat/librist.c   | 236 ++++++++++++++++++++++++++++++++++++++++
> > libavformat/protocols.c |   1 +
> > 5 files changed, 272 insertions(+)
> > create mode 100644 libavformat/librist.c
> >
>
> [...]
>
> > +static int librist_read(URLContext *h, uint8_t *buf, int size)
> > +{
> > +    RISTContext *s = h->priv_data;
> > +    const struct rist_data_block *data_block;
> > +    int ret;
> > +
> > +    ret = rist_receiver_data_read(s->ctx, &data_block, s->queue_count
> <= 0 ? POLLING_TIME : 0);
>
> Use POLLING_TIME unconditionally. If there are packets in the queue,
> POLLING_TIME should not matter. This also means that keeping track of
> queue_count is useless.
>


Not possible, that would cause fifo filling up.

I give up. FFmpeg protocols API is utterly useless.


>
> > +    if (ret < 0)
> > +        return risterr2ret(ret);
> > +
> > +    if (ret == 0 || data_block->payload_len <= 0)
> > +        return 0;
>
> You should return EAGAIN if ret == 0, as in the previous version of the
> patch. Otherwise you are "making up" a 0 sized packet.
>
> Yet again, this should not make a difference, because
> retry_transfer_wrapper in libavformat/avio.c fast retries EAGAIN
> immedietly for the first five times. So the user will only see an EAGAIN
> if the queue was empty for 5 * POLLING_TIME, which is 0.5 sec. If a
> librist stream receives no packets for 0.5 secs, then something is wrong.
>
> Regards,
> Marton
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list