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

Marton Balint cus at passwd.hu
Fri Dec 25 01:07:34 EET 2020



On Thu, 24 Dec 2020, Nicolas George wrote:

>> +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->rist_ctx, &data_block, 5);
>
> Already mentioned: the 5 millisecond timeout not acceptable. Set it to 0
> in non-blocking mode and as large as possible in blocking mode.

Actually it should be POLLING_TIME as defined in libavformat/network.h for 
blocking mode if you want behaviour to be consistent with other protocols. 
The function cannot block indefinitely even in blocking mode to be able 
allow generic code in libavformat/avio.c:retry_transfer_wrapper to abort a 
blocking wait.

Other protocols are directly using poll/select to wait for data with 
POLLING_TIME timeout, but since librist does not provide a way to poll for 
data, this is the best we can do (and return EAGAIN even in blocking mode 
if the POLLING_TIME elapses, because retry_transfer_wrapper will retry in 
that case anyway)

Regards,
Marton


More information about the ffmpeg-devel mailing list