This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 95101ecc6502a0fcc2aab7736b326a8044d20a0f
Author:     Rost Kurylo <[email protected]>
AuthorDate: Wed Feb 4 10:07:50 2026 -0800
Commit:     Marton Balint <[email protected]>
CommitDate: Wed Feb 11 20:41:49 2026 +0000

    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 <[email protected]>
---
 libavformat/unix.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/libavformat/unix.c b/libavformat/unix.c
index 3a0caf96ed..666d2545d9 100644
--- a/libavformat/unix.c
+++ b/libavformat/unix.c
@@ -50,7 +50,7 @@ static const AVOption unix_options[] = {
     { "type",      "Socket type",                           OFFSET(type),    
AV_OPT_TYPE_INT,   { .i64 = SOCK_STREAM },    INT_MIN, INT_MAX, ED, .unit = 
"type" },
     { "stream",    "Stream (reliable stream-oriented)",     0,               
AV_OPT_TYPE_CONST, { .i64 = SOCK_STREAM },    INT_MIN, INT_MAX, ED, .unit = 
"type" },
     { "datagram",  "Datagram (unreliable packet-oriented)", 0,               
AV_OPT_TYPE_CONST, { .i64 = SOCK_DGRAM },     INT_MIN, INT_MAX, ED, .unit = 
"type" },
-    { "seqpacket", "Seqpacket (reliable packet-oriented",   0,               
AV_OPT_TYPE_CONST, { .i64 = SOCK_SEQPACKET }, INT_MIN, INT_MAX, ED, .unit = 
"type" },
+    { "seqpacket", "Seqpacket (reliable packet-oriented)",  0,               
AV_OPT_TYPE_CONST, { .i64 = SOCK_SEQPACKET }, INT_MIN, INT_MAX, ED, .unit = 
"type" },
     { "pkt_size",  "Maximum packet size",                   OFFSET(pkt_size), 
AV_OPT_TYPE_INT,  { .i64 = 0 },              0, INT_MAX, ED },
     { NULL }
 };
@@ -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);

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to