ossrs / srs

SRS is a simple, high-efficiency, real-time media server supporting RTMP, WebRTC, HLS, HTTP-FLV, HTTP-TS, SRT, MPEG-DASH, and GB28181.
https://ossrs.io
MIT License
25.69k stars 5.38k forks source link

SRT: srt2rtc does not work. #3293

Closed attiliodrei closed 1 year ago

attiliodrei commented 1 year ago

SRS Version: ossrs/srs:v5.0-a1 SRS Config: conf/srt2rtc.conf

srt->rtmp->webrtc does not work

TRANS_BY_GPT3

winlinvip commented 1 year ago

Replayed it by:

./objs/srs -c conf/srt2rtc.conf
ffmpeg -re -i ./doc/source.flv -c copy -pes_payload_size 0 -f mpegts 'srt://127.0.0.1:10080?streamid=#!::r=live/livestream,m=publish'

Play by WebRTC, note that HTTP-FLV is ok.

No Error in logs:

MB0:srs video$ grep '395a9z86' t.log
[2022-12-05 08:40:56.509][INFO][73030][395a9z86] HTTP #0 127.0.0.1:63817 POST http://localhost:1985/rtc/v1/play/, content-length=6945
[2022-12-05 08:40:56.510][INFO][73030][395a9z86] RTC play webrtc://localhost/live/livestream, api=http://localhost:1985/rtc/v1/play/, tid=95c3648, clientip=127.0.0.1, app=live, stream=livestream, offer=6387B, eip=, codec=, srtp=, dtls=
[2022-12-05 08:40:56.510][INFO][73030][395a9z86] ignore attribute=, value=
[2022-12-05 08:40:56.512][INFO][73030][395a9z86] new rtc source, stream_url=/live/livestream
[2022-12-05 08:40:56.513][INFO][73030][395a9z86] RTC player nack=1, nnc=1
[2022-12-05 08:40:56.513][INFO][73030][395a9z86] RTC connection player gcc=3
[2022-12-05 08:40:56.513][INFO][73030][395a9z86] RTC: Init tracks {track: video-88avtevh, is_active: 0=>1},{track: audio-43ki0inw, is_active: 0=>1}, ok
[2022-12-05 08:40:56.513][INFO][73030][395a9z86] Best matched ip=192.168.3.85, ifname=en0
[2022-12-05 08:40:56.513][INFO][73030][395a9z86] Best matched ip=10.211.55.2, ifname=bridge100
[2022-12-05 08:40:56.513][INFO][73030][395a9z86] Best matched ip=10.37.129.2, ifname=bridge101
[2022-12-05 08:40:56.513][INFO][73030][395a9z86] RTC: Use candidates 10.211.55.2, 10.37.129.2, 192.168.3.85, protocol=udp
[2022-12-05 08:40:56.516][INFO][73030][395a9z86] RTC init session, user=40h9nm25:E/+f, url=/live/livestream, encrypt=1/1, DTLS(role=passive, version=auto), timeout=30000ms, nack=1
[2022-12-05 08:40:56.516][INFO][73030][395a9z86] RTC username=40h9nm25:E/+f, dtls=1, srtp=1, offer=6387B, answer=1840B
[2022-12-05 08:40:56.517][INFO][73030][395a9z86] RTC remote offer: v=0\r\no=- 8288901143715181840 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0 1\r\na=extmap-allow-mixed\r\na=msid-semantic: WMS\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111 63 103 104 9 0 8 106 105 13 110 112 113 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:E/+f\r\na=ice-pwd:3zOtQdN4KpuLlm91rGk9n1QJ\r\na=ice-options:trickle\r\na=fingerprint:sha-256 C7:D7:A9:9C:58:E7:A3:23:3F:59:14:76:B8:87:C2:41:12:08:36:2B:85:49:3E:24:83:7F:6D:7A:39:F1:DB:C9\r\na=setup:actpass\r\na=mid:0\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=recvonly\r\na=rtcp-mux\r\na=rtpmap:111 opus/48000/2\r\na=rtcp-fb:111 transport-cc\r\na=fmtp:111 minptime=10;useinbandfec=1\r\na=rtpmap:63 red/48000/2\r\na=fmtp:63 111/111\r\na=rtpmap:103 ISAC/16000\r\na=rtpmap:104 ISAC/32000\r\na=rtpmap:9 G722/8000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:106 CN/32000\r\na=rtpmap:105 CN/16000\r\na=rtpmap:13 CN/8000\r\na=rtpmap:110 telephone-event/48000\r\na=rtpmap:112 telephone-event/32000\r\na=rtpmap:113 telephone-event/16000\r\na=rtpmap:126 telephone-event/8000\r\nm=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 35 36 37 38 102 122 127 121 125 107 108 109 124 120 39 40 41 42 43 44 45 46 47 48 123 119 114 115 116 49\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:E/+f\r\na=ice-pwd:3zOtQdN4KpuLlm91rGk9n1QJ\r\na=ice-options:trickle\r\na=fingerprint:sha-256 C7:D7:A9:9C:58:E7:A3:23:3F:59:14:76:B8:87:C2:41:12:08:36:2B:85:49:3E:24:83:7F:6D:7A:39:F1:DB:C9\r\na=setup:actpass\r\na=mid:1\r\na=extmap:14 urn:ietf:params:rtp-hdrext:toffset\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:13 urn:3gpp:video-orientation\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:5 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay\r\na=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type\r\na=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing\r\na=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/color-space\r\na=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=extmap:10 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\r\na=extmap:11 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id\r\na=recvonly\r\na=rtcp-mux\r\na=rtcp-rsize\r\na=rtpmap:96 VP8/90000\r\na=rtcp-fb:96 goog-remb\r\na=rtcp-fb:96 transport-cc\r\na=rtcp-fb:96 ccm fir\r\na=rtcp-fb:96 nack\r\na=rtcp-fb:96 nack pli\r\na=rtpmap:97 rtx/90000\r\na=fmtp:97 apt=96\r\na=rtpmap:98 VP9/90000\r\na=rtcp-fb:98 goog-remb\r\na=rtcp-fb:98 transport-cc\r\na=rtcp-fb:98 ccm fir\r\na=rtcp-fb:98 nack\r\na=rtcp-fb:98 nack pli\r\na=fmtp:98 profile-id=0\r\na=rtpmap:99 rtx/90000\r\na=fmtp:99 apt=98\r\na=rtpmap:100 VP9/90000\r\na=rtcp-fb:100 goog-remb\r\na=rtcp-fb:100 transport-cc\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack\r\na=rtcp-fb:100 nack pli\r\na=fmtp:100 profile-id=2\r\na=rtpmap:101 rtx/90000\r\na=fmtp:101 apt=100\r\na=rtpmap:35 VP9/90000\r\na=rtcp-fb:35 goog-remb\r\na=rtcp-fb:35 transport-cc\r\na=rtcp-fb:35 ccm fir\r\na=rtcp-fb:35 nack\r\na=rtcp-fb:35 nack pli\r\na=fmtp:35 profile-id=1\r\na=rtpmap:36 rtx/90000\r\na=fmtp:36 apt=35\r\na=rtpmap:37 VP9/90000\r\na=rtcp-fb:37 goog-remb\r\na=rtcp-fb:37 transport-cc\r\na=rtcp-fb:37 ccm fir\r\na=rtcp-fb:37 nack\r\na=rtcp-fb:37 nack pli\r\na=fmtp:37 profile-id=3\r\na=rtpmap:38 rtx/90000\r\na=fmtp:38 apt=37\r\na=rtpmap:102 H264/90000\r\na=rtcp-fb:102 goog-remb\r\na=rtcp-fb:102 transport-cc\r\na=rtcp-fb:102 ccm fir\r\na=rtcp-fb:102 nack\r\na=rtcp-fb:102 nack pli\r\na=fmtp:102 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f\r\na=rtpmap:122 rtx/90000\r\na=fmtp:122 apt=102\r\na=rtpmap:127 H264/90000\r\na=rtcp-fb:127 goog-remb\r\na=rtcp-fb:127 transport-cc\r\na=rtcp-fb:127 ccm fir\r\na=rtcp-fb:127 nack\r\na=rtcp-fb:127 nack pli\r\na=fmtp:127 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f\r\na=rtpmap:121 rtx/90000\r\na=fmtp:121 apt=127\r\na=rtpmap:125 H264/90000\r\na=rtcp-fb:125 goog-remb\r\na=rtcp-fb:125 transport-cc\r\na=rtcp-fb:125 ccm fir\r\na=rtcp-fb:125 nack\r\na=rtcp-fb:125 nack pli\r\na=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f\r\na=rtpmap:107 rtx/90000\r\na=fmtp:107 apt=125\r\na=rtpmap:108 H264/90000\r\na=rtcp-fb:108 goog-remb\r\na=rtcp-fb:108 transport-cc\r\na=rtcp-fb:108 ccm fir\r\na=rtcp-fb:108 nack\r\na=rtcp-fb:108 nack pli\r\na=fmtp:108 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f\r\na=rtpmap:109 rtx/90000\r\na=fmtp:109 apt=108\r\na=rtpmap:124 H264/90000\r\na=rtcp-fb:124 goog-remb\r\na=rtcp-fb:124 transport-cc\r\na=rtcp-fb:124 ccm fir\r\na=rtcp-fb:124 nack\r\na=rtcp-fb:124 nack pli\r\na=fmtp:124 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d001f\r\na=rtpmap:120 rtx/90000\r\na=fmtp:120 apt=124\r\na=rtpmap:39 H264/90000\r\na=rtcp-fb:39 goog-remb\r\na=rtcp-fb:39 transport-cc\r\na=rtcp-fb:39 ccm fir\r\na=rtcp-fb:39 nack\r\na=rtcp-fb:39 nack pli\r\na=fmtp:39 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=4d001f\r\na=rtpmap:40 rtx/90000\r\na=fmtp:40 apt=39\r\na=rtpmap:41 H264/90000\r\na=rtcp-fb:41 goog-remb\r\na=rtcp-fb:41 transport-cc\r\na=rtcp-fb:41 ccm fir\r\na=rtcp-fb:41 nack\r\na=rtcp-fb:41 nack pli\r\na=fmtp:41 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=f4001f\r\na=rtpmap:42 rtx/90000\r\na=fmtp:42 apt=41\r\na=rtpmap:43 H264/90000\r\na=rtcp-fb:43 goog-remb\r\na=rtcp-fb:43 transport-cc\r\na=rtcp-fb:43 ccm fir\r\na=rtcp-fb:43 nack\r\na=rtcp-fb:43 nack pli\r\na=fmtp:43 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=f4001f\r\na=rtpmap:44 rtx/90000\r\na=fmtp:44 apt=43\r\na=rtpmap:45 AV1/90000\r\na=rtcp-fb:45 goog-remb\r\na=rtcp-fb:45 transport-cc\r\na=rtcp-fb:45 ccm fir\r\na=rtcp-fb:45 nack\r\na=rtcp-fb:45 nack pli\r\na=rtpmap:46 rtx/90000\r\na=fmtp:46 apt=45\r\na=rtpmap:47 AV1/90000\r\na=rtcp-fb:47 goog-remb\r\na=rtcp-fb:47 transport-cc\r\na=rtcp-fb:47 ccm fir\r\na=rtcp-fb:47 nack\r\na=rtcp-fb:47 nack pli\r\na=fmtp:47 profile=1\r\na=rtpmap:48 rtx/90000\r\na=fmtp:48 apt=47\r\na=rtpmap:123 H264/90000\r\na=rtcp-fb:123 goog-remb\r\na=rtcp-fb:123 transport-cc\r\na=rtcp-fb:123 ccm fir\r\na=rtcp-fb:123 nack\r\na=rtcp-fb:123 nack pli\r\na=fmtp:123 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=64001f\r\na=rtpmap:119 rtx/90000\r\na=fmtp:119 apt=123\r\na=rtpmap:114 red/90000\r\na=rtpmap:115 rtx/90000\r\na=fmtp:115 apt=114\r\na=rtpmap:116 ulpfec/90000\r\na=rtpmap:49 flexfec-03/90000\r\na=rtcp-fb:49 goog-remb\r\na=rtcp-fb:49 transport-cc\r\na=fmtp:49 repair-window=10000000\r\n
[2022-12-05 08:40:56.517][INFO][73030][395a9z86] RTC local answer: v=0\r\no=SRS/5.0.105(Bee) 107408542301568 2 IN IP4 0.0.0.0\r\ns=SRSPlaySession\r\nt=0 0\r\na=ice-lite\r\na=group:BUNDLE 0 1\r\na=msid-semantic: WMS live/livestream\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111\r\nc=IN IP4 0.0.0.0\r\na=ice-ufrag:40h9nm25\r\na=ice-pwd:ih0tfn531vy5at2u52lt9405876263ko\r\na=fingerprint:sha-256 DD:19:A3:34:DC:34:DD:E9:E6:4D:BD:14:69:14:50:E7:1E:4D:5A:3E:5F:96:43:87:62:56:EF:9C:7A:E2:8B:6A\r\na=setup:passive\r\na=mid:0\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=sendonly\r\na=rtcp-mux\r\na=rtcp-rsize\r\na=rtpmap:111 opus/48000/2\r\na=rtcp-fb:111 transport-cc\r\na=ssrc:737676033 cname:410ro6316y15x9h8\r\na=ssrc:737676033 label:audio-43ki0inw\r\na=candidate:0 1 udp 2130706431 10.211.55.2 8000 typ host generation 0\r\na=candidate:1 1 udp 2130706431 10.37.129.2 8000 typ host generation 0\r\na=candidate:2 1 udp 2130706431 192.168.3.85 8000 typ host generation 0\r\nm=video 9 UDP/TLS/RTP/SAVPF 125\r\nc=IN IP4 0.0.0.0\r\na=ice-ufrag:40h9nm25\r\na=ice-pwd:ih0tfn531vy5at2u52lt9405876263ko\r\na=fingerprint:sha-256 DD:19:A3:34:DC:34:DD:E9:E6:4D:BD:14:69:14:50:E7:1E:4D:5A:3E:5F:96:43:87:62:56:EF:9C:7A:E2:8B:6A\r\na=setup:passive\r\na=mid:1\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=sendonly\r\na=rtcp-mux\r\na=rtcp-rsize\r\na=rtpmap:125 H264/90000\r\na=rtcp-fb:125 transport-cc\r\na=rtcp-fb:125 nack\r\na=rtcp-fb:125 nack pli\r\na=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f\r\na=ssrc:737676034 cname:410ro6316y15x9h8\r\na=ssrc:737676034 label:video-88avtevh\r\na=candidate:0 1 udp 2130706431 10.211.55.2 8000 typ host generation 0\r\na=candidate:1 1 udp 2130706431 10.37.129.2 8000 typ host generation 0\r\na=candidate:2 1 udp 2130706431 192.168.3.85 8000 typ host generation 0\r\n
[2022-12-05 08:40:56.518][INFO][73030][395a9z86] TCP: before dispose resource(HttpConn)(0x60700005e0b0), conns=2, zombies=0, ign=0, inz=0, ind=0
[2022-12-05 08:40:56.518][WARN][73030][395a9z86][54] client disconnect peer. ret=1007
[2022-12-05 08:40:56.518][INFO][73030][395a9z86] TCP: disposing #0 resource(HttpConn)(0x60700005e0b0), conns=2, disposing=1, zombies=0
[2022-12-05 08:40:56.521][INFO][73030][395a9z86] RTC: session address init 10.211.55.2:65108
[2022-12-05 08:40:56.521][INFO][73030][395a9z86] RTC: session STUN done, waiting DTLS handshake.
[2022-12-05 08:40:56.522][INFO][73030][395a9z86] DTLS: State Passive RECV, done=0, arq=0/0, r0=1, r1=0, len=157, cnt=22, size=144, hs=1
[2022-12-05 08:40:56.522][INFO][73030][395a9z86] DTLS: State Passive SEND, done=0, arq=0/0, r0=-1, r1=2, len=679, cnt=22, size=82, hs=2
[2022-12-05 08:40:56.523][INFO][73030][395a9z86] DTLS: State Passive RECV, done=0, arq=0/0, r0=1, r1=0, len=579, cnt=22, size=300, hs=11
[2022-12-05 08:40:56.524][INFO][73030][395a9z86] DTLS: State Passive SEND, done=1, arq=0/0, r0=1, r1=0, len=554, cnt=22, size=466, hs=4
[2022-12-05 08:40:56.524][INFO][73030][395a9z86] RTC: DTLS handshake done.
[2022-12-05 08:40:56.524][INFO][73030][395a9z86] RTC: session pub=0, sub=1, to=30000ms connection established
[2022-12-05 08:40:56.524][INFO][73030][395a9z86] RTC: Subscriber url=/live/livestream established
[2022-12-05 08:40:56.524][INFO][73030][395a9z86] create consumer, no gop cache
[2022-12-05 08:40:56.524][INFO][73030][395a9z86] RTC: start play url=/live/livestream, source_id=/, realtime=1, mw_msgs=0
[2022-12-05 08:40:56.763][INFO][73030][395a9z86] RTC: session address change 10.211.55.2:65108 -> 10.37.129.2:57871, cached=0, nn_change=1/1, nn_address=1
[2022-12-05 08:40:56.950][INFO][73030][395a9z86] RTC: session address change 10.37.129.2:57871 -> 192.168.3.85:61151, cached=0, nn_change=2/1, nn_address=2
[2022-12-05 08:40:57.575][INFO][73030][395a9z86] RTC: session address change 10.37.129.2:57871 -> 10.211.55.2:65108, cached=1, nn_change=6/1, nn_address=3
[2022-12-05 08:41:08.575][INFO][73030][395a9z86] RTC: session address change 10.211.55.2:65108 -> 10.37.129.2:57871, cached=1, nn_change=18/7, nn_address=3
[2022-12-05 08:41:09.106][INFO][73030][395a9z86] RTC: session address change 10.37.129.2:57871 -> 192.168.3.85:61151, cached=1, nn_change=19/7, nn_address=3
[2022-12-05 08:41:09.638][INFO][73030][395a9z86] RTC: session address change 192.168.3.85:61151 -> 10.211.55.2:65108, cached=1, nn_change=20/6, nn_address=3

WebRTC internals show connections established but no packets:

image