Don't know enough RTMP to comment on. Since the ticket is still open on
red5's github repo I presume this is still an issue

Spotify comments
----------------
Interop issue with red5 RTMP server. Is unknown if this is a bug in
red5 or ffmpeg as the RTMP spec is vague and the ffmpeg code uses
different terminology.

Was reported to red5 at https://github.com/Red5/red5-client/issues/53

/Tomas
From ab813b96f7967ac080a0b802c6a98517ae68d46a Mon Sep 17 00:00:00 2001
From: Jonathan Murray <jonathanmur...@spotify.com>
Date: Thu, 31 Mar 2022 16:23:17 +0200
Subject: [PATCH 09/15] rtmp: Set correct message stream id when writing as
 server

rtmp_write is used both for writing outputs as a server. The
rt->listen flag determines which mode we're running in.

Previously, when running as a server, the message stream id would
always be set to 0 for media/metadata messages. This is surprising
given that we have both responded to "createStream()" with a value
of 1 and sent a "Stream Begin 1" to the client. Furthermore, some
client libraries (Red5) seem to trip up on receiving
"@setDataFrame" on stream 0 (and may be correct to assume that
this message would be sent on stream 1).
---
 libavformat/rtmpproto.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index b3b1eedacb..1f9bb84d69 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -3046,7 +3046,12 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
                                              pkttype, ts, pktsize)) < 0)
                 return ret;
 
-            rt->out_pkt.extra = rt->stream_id;
+            // If rt->listen, then we're running as a a server and should
+            // use the ID that we've sent in Stream Begin and in the
+            // _result to createStream.
+            // Otherwise, we're running as a client and should use the ID
+            // that we've received in the createStream from the server.
+            rt->out_pkt.extra = (rt->listen) ? rt->nb_streamid : rt->stream_id;
             rt->flv_data = rt->out_pkt.data;
         }
 
-- 
2.39.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Reply via email to