Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Rost Kurylo via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Rost Kurylo <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PR] avformat/unix: Fix 'operation unsupported' error when reading from unixgram sockets (PR #21655)
Date: Thu, 05 Feb 2026 17:19:03 -0000
Message-ID: <177031194367.25.14854307041466618212@4457048688e7> (raw)

PR #21655 opened by Rost Kurylo (rost.kurylo)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21655
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21655.patch

Sockets of type SOCK_DGRAM don't support listen(), so it was
impossible to read from "unixgram" sockets in ffmpeg.

To test:

```
ffmpeg -type datagram -listen 1 -i 'unix:/tmp/test' -map 0 -f null -
```

With this change, listen() won't be called on the socket, but semantics similar to SOCK_STREAM are preserved (create a socket file, bind to it, receive packets).

Signed-off-by: Rost Kurylo <rost.kurylo@netint.ca>


>From e5fc29385eef58372e86001f80f996ecaeed4687 Mon Sep 17 00:00:00 2001
From: Rost Kurylo <rost.kurylo@netint.ca>
Date: Wed, 4 Feb 2026 10:07:50 -0800
Subject: [PATCH] avformat/unix: Fix 'operation unsupported' error when reading
 from unixgram sockets

Sockets of type SOCK_DGRAM don't support listen(), so it was
impossible to read from "unixgram" sockets in ffmpeg.

Signed-off-by: Rost Kurylo <rost.kurylo@netint.ca>
---
 libavformat/unix.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/libavformat/unix.c b/libavformat/unix.c
index 3a0caf96ed..ac6a18c48d 100644
--- a/libavformat/unix.c
+++ b/libavformat/unix.c
@@ -78,11 +78,19 @@ static int unix_open(URLContext *h, const char *filename, int flags)
         s->timeout = h->rw_timeout / 1000;
 
     if (s->listen) {
-        ret = ff_listen_bind(fd, (struct sockaddr *)&s->addr,
-                             sizeof(s->addr), s->timeout, h);
-        if (ret < 0)
-            goto fail;
-        fd = ret;
+        if (s->type == SOCK_DGRAM) {
+            ret = bind(fd, (struct sockaddr *)&s->addr, sizeof(s->addr));
+            if (ret) {
+                ret = ff_neterrno();
+                goto fail;
+            }
+        } else {
+            ret = ff_listen_bind(fd, (struct sockaddr *)&s->addr,
+                                sizeof(s->addr), s->timeout, h);
+            if (ret < 0)
+                goto fail;
+            fd = ret;
+        }
     } else {
         ret = ff_listen_connect(fd, (struct sockaddr *)&s->addr,
                                 sizeof(s->addr), s->timeout, h, 0);
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

                 reply	other threads:[~2026-02-05 17:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=177031194367.25.14854307041466618212@4457048688e7 \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@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