[FFmpeg-devel] [PATCH v2] lavf/libsrt: nonblock enabling correction

Marton Balint cus at passwd.hu
Sun Jan 19 01:20:51 EET 2020



On Thu, 16 Jan 2020, Anthony Delannoy wrote:

> As written in https://github.com/Haivision/srt/blob/v1.4.1/docs/API.md,
> the nonblock mode is activated if SRTO_SNDSYN and SRTO_RCVSYN, for
> sending and receiving respectively, are set to 0.
> ---
> libavformat/libsrt.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)

Thanks, applied.

Regards,
Marton

>
> diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
> index 16975b6d94..6e230c254b 100644
> --- a/libavformat/libsrt.c
> +++ b/libavformat/libsrt.c
> @@ -152,12 +152,21 @@ static int libsrt_neterrno(URLContext *h)
>     return AVERROR_UNKNOWN;
> }
> 
> +/*
> + * SRT functions can also work in blocking and non-blocking mode, for which
> + * there are two separate options for sending and receiving: SRTO_SNDSYN and
> + * SRTO_RCVSYN.
> + * Setting SRTO_{SND,RCV}SYN options to 1 enable blocking mode, setting them
> + * to 0 enable non-blocking mode.
> + */
> static int libsrt_socket_nonblock(int socket, int enable)
> {
> -    int ret = srt_setsockopt(socket, 0, SRTO_SNDSYN, &enable, sizeof(enable));
> +    int ret, blocking = enable ? 0 : 1;
> +
> +    ret = srt_setsockopt(socket, 0, SRTO_SNDSYN, &blocking, sizeof(blocking));
>     if (ret < 0)
>         return ret;
> -    return srt_setsockopt(socket, 0, SRTO_RCVSYN, &enable, sizeof(enable));
> +    return srt_setsockopt(socket, 0, SRTO_RCVSYN, &blocking, sizeof(blocking));
> }
> 
> static int libsrt_network_wait_fd(URLContext *h, int eid, int fd, int write)
> -- 
> 2.24.1
>
> _______________________________________________
> 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