History

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).

Jonathan Murray committed 4 years ago

Commit 98d97bb1 parent 95314cd1 file · +6 −1Browse files

Unified · Split

libavformat/rtmpproto.c+6−1
@@ -3049,7 +3049,12 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size) · 3048 unmodified lines
30493049 pkttype, ts, pktsize)) < 0)
30503050 return ret;
30513051
3052− rt->out_pkt.extra = rt->stream_id;
3052+ // If rt->listen, then we're running as a a server and should
3053+ // use the ID that we've sent in Stream Begin and in the
3054+ // _result to createStream.
3055+ // Otherwise, we're running as a client and should use the ID
3056+ // that we've received in the createStream from the server.
3057+ rt->out_pkt.extra = (rt->listen) ? rt->nb_streamid : rt->stream_id;
30533058 rt->flv_data = rt->out_pkt.data;
30543059 }
30553060

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t