Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Marton Balint <cus@passwd.hu>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] avformat/libsrt: use SRT_EPOLL_IN for waiting for an incoming connection
Date: Sat, 24 Feb 2024 22:18:47 +0100 (CET)
Message-ID: <a52bad19-f3e2-9b00-63d2-6f6079eba278@passwd.hu> (raw)
In-Reply-To: <20240220214442.19325-1-cus@passwd.hu>



On Tue, 20 Feb 2024, Marton Balint wrote:

> This is the proper poll mode for waiting for an incoming connection according
> to the SRT API docs.
>
> Fixes ticket #9142.

Will apply.

Regards,
Marton

>
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
> libavformat/libsrt.c | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
> index 56acb6e741..0edea9266d 100644
> --- a/libavformat/libsrt.c
> +++ b/libavformat/libsrt.c
> @@ -250,7 +250,7 @@ static int libsrt_listen(int eid, int fd, const struct sockaddr *addr, socklen_t
>     if (srt_listen(fd, 1))
>         return libsrt_neterrno(h);
>
> -    ret = libsrt_network_wait_fd_timeout(h, eid, 1, timeout, &h->interrupt_callback);
> +    ret = libsrt_network_wait_fd_timeout(h, eid, 0, timeout, &h->interrupt_callback);
>     if (ret < 0)
>         return ret;
>
> @@ -391,7 +391,7 @@ static int libsrt_setup(URLContext *h, const char *uri, int flags)
>     char hostname[1024],proto[1024],path[1024];
>     char portstr[10];
>     int64_t open_timeout = 0;
> -    int eid, write_eid;
> +    int eid;
>
>     av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname),
>         &port, path, sizeof(path), uri);
> @@ -455,18 +455,21 @@ static int libsrt_setup(URLContext *h, const char *uri, int flags)
>     if (libsrt_socket_nonblock(fd, 1) < 0)
>         av_log(h, AV_LOG_DEBUG, "libsrt_socket_nonblock failed\n");
>
> -    ret = write_eid = libsrt_epoll_create(h, fd, 1);
> -    if (ret < 0)
> -        goto fail1;
>     if (s->mode == SRT_MODE_LISTENER) {
> +        int read_eid = ret = libsrt_epoll_create(h, fd, 0);
> +        if (ret < 0)
> +            goto fail1;
>         // multi-client
> -        ret = libsrt_listen(write_eid, fd, cur_ai->ai_addr, cur_ai->ai_addrlen, h, s->listen_timeout);
> -        srt_epoll_release(write_eid);
> +        ret = libsrt_listen(read_eid, fd, cur_ai->ai_addr, cur_ai->ai_addrlen, h, s->listen_timeout);
> +        srt_epoll_release(read_eid);
>         if (ret < 0)
>             goto fail1;
>         srt_close(fd);
>         fd = ret;
>     } else {
> +        int write_eid = ret = libsrt_epoll_create(h, fd, 1);
> +        if (ret < 0)
> +            goto fail1;
>         if (s->mode == SRT_MODE_RENDEZVOUS) {
>             if (srt_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen)) {
>                 ret = libsrt_neterrno(h);
> -- 
> 2.35.3
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

      reply	other threads:[~2024-02-24 21:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-20 21:44 Marton Balint
2024-02-24 21:18 ` Marton Balint [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a52bad19-f3e2-9b00-63d2-6f6079eba278@passwd.hu \
    --to=cus@passwd.hu \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git