On Sun, 28 Feb 2021, Paul B Mahol wrote:

This work is sponsored by Open Broadcast Systems.

Signed-off-by: Paul B Mahol <one...@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.

+    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@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to