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

WebRTC: RTMP2RTC failure, RTC2RTMP failure, unable to achieve live streaming and WebRTC conversion, RTMP to WebRTC black screen, WebRTC to RTMP black screen. #2728

Closed zhang7249 closed 2 years ago

zhang7249 commented 2 years ago

Note: Before asking a question, please read the FAQ (Please read FAQ before filing an issue) https://github.com/ossrs/srs/issues/2716

Description

According to the official website documentation, I have installed SRS and used RTMP for streaming and WebRTC for playback. RTMP streaming is successful, and RTMP and FLV can be played back successfully. However, WebRTC cannot be played back. I have already modified the candidate to an external network address. Every time I click "Play Video", I get an error message saying "client disconnect peer. ret=1007"!

Previously, I followed the steps in the blog https://www.cnblogs.com/ziyue7575/p/13927894.html to install it four or five times without any issues. Please help me resolve this problem. Thank you.

Please describe the issue you are facing.

  1. SRS version: 4.0.195
    [root@20211104-instance trunk]# ./objs/srs -v
    4.0.195
    [root@20211104-instance trunk]# 
    [root@20211104-instance trunk]# 
    [root@20211104-instance trunk]# git branch -v
    * 4.0release 92f061ee7 Rtc2Rtmp: Use RTP timestamp to identify video frames. v4.0.195 (#2721)
    develop    6cde9a023 Squash: Guess config files by FHS
    [root@20211104-instance trunk]# 
    [root@20211104-instance trunk]# 
    [root@20211104-instance trunk]# git branch 
    * 4.0release
    develop
  2. SRS log is as follows:
    
    [2021-11-09 23:34:19.151][Trace][147724][22zp0891] -> HLS time=824695118ms, sno=72, ts=wrj-71.ts, dur=0.00, dva=1733p
    [2021-11-09 23:34:20.088][Trace][147724][2a59484g] DTLS: State Passive RECV, done=1, arq=0/0, r0=1, r1=0, len=39, cnt=21, size=26, hs=0
    **### [2021-11-09 23:34:20.088][Warn][147724][2a59484g][0] DTLS: SSL3 alert method=read type=warning, desc=CN(close notify), where=16388, ret=256, r1=0**
    [2021-11-09 23:34:20.088][Trace][147724][2a59484g] RTC: session destroy by DTLS alert, username=4wbo139f:5u3o
    [2021-11-09 23:34:20.088][Trace][147724][2a59484g] RTC: before dispose resource(RtcConn)(0x288ca60), conns=1, zombies=0, ign=0, inz=0, ind=0
    [2021-11-09 23:34:20.088][Trace][147724][2a59484g] RTC: session detach from [2a59484g](RtcConn), disposing=1
    [2021-11-09 23:34:20.088][Trace][147724][9839e6i4] RTC: clear zombies=1 resources, conns=1, removing=0, unsubs=1
    [2021-11-09 23:34:20.088][Trace][147724][2a59484g] RTC: disposing #0 resource(RtcConn)(0x288ca60), conns=1, disposing=1, zombies=0
    [2021-11-09 23:34:20.126][Trace][147724][0a25609q] HTTP #0 112.1.171.64:27256 OPTIONS http://114.67.69.234:1985/rtc/v1/play/, content-length=-1
    [2021-11-09 23:34:20.144][Trace][147724][0a25609q] HTTP #1 112.1.171.64:27256 POST http://114.67.69.234:1985/rtc/v1/play/, content-length=5683
    [2021-11-09 23:34:20.146][Trace][147724][0a25609q] RTC play webrtc://114.67.69.234/live/livestream, api=http://114.67.69.234:1985/rtc/v1/play/, tid=14bd2bf, clientip=112.1.171.64, app=live, stream=livestream, offer=5211B, eip=, codec=, srtp=, dtls=
    [2021-11-09 23:34:20.146][Trace][147724][0a25609q] ignore attribute=, value=
    [2021-11-09 23:34:20.147][Trace][147724][0a25609q] RTC player nack=1, nnc=1
    [2021-11-09 23:34:20.147][Trace][147724][0a25609q] RTC connection player gcc=3
    [2021-11-09 23:34:20.147][Trace][147724][0a25609q] RTC: Init tracks {track: video-28y3l949, is_active: 0=>1},{track: audio-12t74wa9, is_active: 0=>1}, ok
    [2021-11-09 23:34:20.147][Trace][147724][0a25609q] RTC: Use candidates 114.67.69.234
    [2021-11-09 23:34:20.147][Trace][147724][0a25609q] RTC init session, user=b6jft897:iVl6, url=/live/livestream, encrypt=1/1, DTLS(role=passive, version=auto), timeout=30000ms, nack=1
    [2021-11-09 23:34:20.147][Trace][147724][0a25609q] RTC username=b6jft897:iVl6, dtls=1, srtp=1, offer=5211B, answer=1547B
    [2021-11-09 23:34:20.147][Trace][147724][0a25609q] RTC remote offer: v=0\r\no=- 1457447232142444040 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 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:iVl6\r\na=ice-pwd:dXdNO9ypbFfBQgrTTIQcMSgm\r\na=ice-options:trickle\r\na=fingerprint:sha-256 C2:8E:F2:2F:B4:63:66:58:9D:3E:5D:39:3F:B5:F5:DD:EF:1D:3D:26:04:00:AE:39:8C:0F:B8:3D:C2:EE:B5:07\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=extmap:5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\r\na=extmap:6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id\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: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 122 102 121 127 120 125 107 108 109 35 36 124 119 123 118 114 115 116 37\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:iVl6\r\na=ice-pwd:dXdNO9ypbFfBQgrTTIQcMSgm\r\na=ice-options:trickle\r\na=fingerprint:sha-256 C2:8E:F2:2F:B4:63:66:58:9D:3E:5D:39:3F:B5:F5:DD:EF:1D:3D:26:04:00:AE:39:8C:0F:B8:3D:C2:EE:B5:07\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:12 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay\r\na=extmap:11 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:5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\r\na=extmap:6 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:122 VP9/90000\r\na=rtcp-fb:122 goog-remb\r\na=rtcp-fb:122 transport-cc\r\na=rtcp-fb:122 ccm fir\r\na=rtcp-fb:122 nack\r\na=rtcp-fb:122 nack pli\r\na=fmtp:122 profile-id=1\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:121 rtx/90000\r\na=fmtp:121 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:120 rtx/90000\r\na=fmtp:120 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:35 AV1X/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=rtpmap:36 rtx/90000\r\na=fmtp:36 apt=35\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=4d0032\r\na=rtpmap:119 rtx/90000\r\na=fmtp:119 apt=124\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=640032\r\na=rtpmap:118 rtx/90000\r\na=fmtp:118 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:37 flexfec-03/90000\r\na=rtcp-fb:37 goog-remb\r\na=rtcp-fb:37 transport-cc\r\na=fmtp:37 repair-window=10000000\r\n
    [2021-11-09 23:34:20.147][Trace][147724][0a25609q] RTC local answer: v=0\r\no=SRS/4.0.195(Leo) 42519136 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:b6jft897\r\na=ice-pwd:808fnd54879479019e9fu3k2s738f18n\r\na=fingerprint:sha-256 C4:DE:D6:B0:28:99:B2:53:F4:A3:38:AA:BF:44:69:E0:E3:7A:57:E4:AE:98:EC:38:52:B1:6C:C8:88:40:61:11\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:1492160179 cname:oq8105ups92kf280\r\na=ssrc:1492160179 label:audio-12t74wa9\r\na=candidate:0 1 udp 2130706431 114.67.69.234 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:b6jft897\r\na=ice-pwd:808fnd54879479019e9fu3k2s738f18n\r\na=fingerprint:sha-256 C4:DE:D6:B0:28:99:B2:53:F4:A3:38:AA:BF:44:69:E0:E3:7A:57:E4:AE:98:EC:38:52:B1:6C:C8:88:40:61:11\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:1492160180 cname:oq8105ups92kf280\r\na=ssrc:1492160180 label:video-28y3l949\r\na=candidate:0 1 udp 2130706431 114.67.69.234 8000 typ host generation 0\r\n
    [2021-11-09 23:34:20.181][Trace][147724][0a25609q] TCP: before dispose resource(HttpConn)(0x2c6e830), conns=5, zombies=0, ign=0, inz=0, ind=0
    [2021-11-09 23:34:20.181][Warn][147724][0a25609q][104] client disconnect peer. ret=1007
    [2021-11-09 23:34:20.181][Trace][147724][63jyjca7] TCP: clear zombies=1 resources, conns=5, removing=0, unsubs=0
    [2021-11-09 23:34:20.181][Trace][147724][0a25609q] TCP: disposing #0 resource(HttpConn)(0x2c6e830), conns=5, disposing=1, zombies=0
    [2021-11-09 23:34:20.186][Trace][147724][0a25609q] RTC: session address init 112.1.171.64:27337
    [2021-11-09 23:34:20.186][Trace][147724][0a25609q] RTC: session STUN done, waiting DTLS handshake.
    [2021-11-09 23:34:20.206][Trace][147724][0a25609q] DTLS: State Passive RECV, done=0, arq=0/0, r0=1, r1=0, len=157, cnt=22, size=144, hs=1
    [2021-11-09 23:34:20.206][Trace][147724][0a25609q] DTLS: State Passive SEND, done=0, arq=0/0, r0=-1, r1=2, len=681, cnt=22, size=82, hs=2
    [2021-11-09 23:34:20.227][Trace][147724][0a25609q] DTLS: State Passive RECV, done=0, arq=0/0, r0=1, r1=0, len=580, cnt=22, size=300, hs=11
    [2021-11-09 23:34:20.227][Trace][147724][0a25609q] DTLS: State Passive SEND, done=1, arq=0/0, r0=1, r1=0, len=554, cnt=22, size=466, hs=4
    [2021-11-09 23:34:20.227][Trace][147724][0a25609q] RTC: DTLS handshake done.
    [2021-11-09 23:34:20.227][Trace][147724][0a25609q] RTC: session pub=0, sub=1, to=30000ms connection established
    [2021-11-09 23:34:20.227][Trace][147724][0a25609q] RTC: Subscriber url=/live/livestream established
    [2021-11-09 23:34:20.227][Trace][147724][0a25609q] create consumer, no gop cache
    [2021-11-09 23:34:20.227][Trace][147724][0a25609q] RTC: start play url=/live/livestream, source_id=/, realtime=1, mw_msgs=0
    [2021-11-09 23:34:20.278][Trace][147724][52hs7r4w] HTTP #0 112.1.171.64:28107 POST http://114.67.69.234:1985/rtc/v1/play/, content-length=5683
    [2021-11-09 23:34:20.280][Trace][147724][52hs7r4w] RTC play webrtc://114.67.69.234/live/livestream, api=http://114.67.69.234:1985/rtc/v1/play/, tid=8d8d8a5, clientip=112.1.171.64, app=live, stream=livestream, offer=5211B, eip=, codec=, srtp=, dtls=
    [2021-11-09 23:34:20.281][Trace][147724][52hs7r4w] ignore attribute=, value=
    [2021-11-09 23:34:20.281][Trace][147724][52hs7r4w] RTC player nack=1, nnc=1
    [2021-11-09 23:34:20.281][Trace][147724][52hs7r4w] RTC connection player gcc=3
    [2021-11-09 23:34:20.281][Trace][147724][52hs7r4w] RTC: Init tracks {track: video-28y3l949, is_active: 0=>1},{track: audio-12t74wa9, is_active: 0=>1}, ok
    [2021-11-09 23:34:20.281][Trace][147724][52hs7r4w] RTC: Use candidates 114.67.69.234
    [2021-11-09 23:34:20.281][Trace][147724][52hs7r4w] RTC init session, user=xfh0e8j5:keOO, url=/live/livestream, encrypt=1/1, DTLS(role=passive, version=auto), timeout=30000ms, nack=1
    [2021-11-09 23:34:20.281][Trace][147724][52hs7r4w] RTC username=xfh0e8j5:keOO, dtls=1, srtp=1, offer=5211B, answer=1547B
    [2021-11-09 23:34:20.281][Trace][147724][52hs7r4w] RTC remote offer: v=0\r\no=- 7726942759880117827 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 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:keOO\r\na=ice-pwd:LfCjcKNXZW5EMxcWNHMwMbHN\r\na=ice-options:trickle\r\na=fingerprint:sha-256 63:7F:24:A9:18:55:81:0E:CB:5D:B5:68:41:E7:52:51:48:3B:D1:1B:70:2E:5C:70:51:A5:EE:8A:DE:7E:9A:AA\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=extmap:5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\r\na=extmap:6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id\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: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 122 102 121 127 120 125 107 108 109 35 36 124 119 123 118 114 115 116 37\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:keOO\r\na=ice-pwd:LfCjcKNXZW5EMxcWNHMwMbHN\r\na=ice-options:trickle\r\na=fingerprint:sha-256 63:7F:24:A9:18:55:81:0E:CB:5D:B5:68:41:E7:52:51:48:3B:D1:1B:70:2E:5C:70:51:A5:EE:8A:DE:7E:9A:AA\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:12 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay\r\na=extmap:11 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:5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\r\na=extmap:6 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:122 VP9/90000\r\na=rtcp-fb:122 goog-remb\r\na=rtcp-fb:122 transport-cc\r\na=rtcp-fb:122 ccm fir\r\na=rtcp-fb:122 nack\r\na=rtcp-fb:122 nack pli\r\na=fmtp:122 profile-id=1\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:121 rtx/90000\r\na=fmtp:121 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:120 rtx/90000\r\na=fmtp:120 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:35 AV1X/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=rtpmap:36 rtx/90000\r\na=fmtp:36 apt=35\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=4d0032\r\na=rtpmap:119 rtx/90000\r\na=fmtp:119 apt=124\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=640032\r\na=rtpmap:118 rtx/90000\r\na=fmtp:118 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:37 flexfec-03/90000\r\na=rtcp-fb:37 goog-remb\r\na=rtcp-fb:37 transport-cc\r\na=fmtp:37 repair-window=10000000\r\n
    [2021-11-09 23:34:20.281][Trace][147724][52hs7r4w] RTC local answer: v=0\r\no=SRS/4.0.195(Leo) 44953552 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:xfh0e8j5\r\na=ice-pwd:kk5u2y13736y00v63m8t83hxa8v3mx4n\r\na=fingerprint:sha-256 C4:DE:D6:B0:28:99:B2:53:F4:A3:38:AA:BF:44:69:E0:E3:7A:57:E4:AE:98:EC:38:52:B1:6C:C8:88:40:61:11\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:1492160181 cname:mxbwgcy8976y9410\r\na=ssrc:1492160181 label:audio-12t74wa9\r\na=candidate:0 1 udp 2130706431 114.67.69.234 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:xfh0e8j5\r\na=ice-pwd:kk5u2y13736y00v63m8t83hxa8v3mx4n\r\na=fingerprint:sha-256 C4:DE:D6:B0:28:99:B2:53:F4:A3:38:AA:BF:44:69:E0:E3:7A:57:E4:AE:98:EC:38:52:B1:6C:C8:88:40:61:11\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:1492160182 cname:mxbwgcy8976y9410\r\na=ssrc:1492160182 label:video-28y3l949\r\na=candidate:0 1 udp 2130706431 114.67.69.234 8000 typ host generation 0\r\n
    [2021-11-09 23:34:20.319][Trace][147724][52hs7r4w] TCP: before dispose resource(HttpConn)(0x2d630a0), conns=5, zombies=0, ign=0, inz=0, ind=0
    **_[2021-11-09 23:34:20.319][Warn][147724][52hs7r4w][104] client disconnect peer. ret=1007_**
    [2021-11-09 23:34:20.319][Trace][147724][63jyjca7] TCP: clear zombies=1 resources, conns=5, removing=0, unsubs=0
    [2021-11-09 23:34:20.319][Trace][147724][52hs7r4w] TCP: disposing #0 resource(HttpConn)(0x2d630a0), conns=5, disposing=1, zombies=0
    [2021-11-09 23:34:20.321][Trace][147724][52hs7r4w] RTC: session address init 112.1.171.64:27429
    [2021-11-09 23:34:20.321][Trace][147724][52hs7r4w] RTC: session STUN done, waiting DTLS handshake.
    [2021-11-09 23:34:20.341][Trace][147724][52hs7r4w] DTLS: State Passive RECV, done=0, arq=0/0, r0=1, r1=0, len=157, cnt=22, size=144, hs=1
    [2021-11-09 23:34:20.342][Trace][147724][52hs7r4w] DTLS: State Passive SEND, done=0, arq=0/0, r0=-1, r1=2, len=681, cnt=22, size=82, hs=2
    [2021-11-09 23:34:20.361][Trace][147724][52hs7r4w] DTLS: State Passive RECV, done=0, arq=0/0, r0=1, r1=0, len=578, cnt=22, size=299, hs=11
    [2021-11-09 23:34:20.362][Trace][147724][52hs7r4w] DTLS: State Passive SEND, done=1, arq=0/0, r0=1, r1=0, len=554, cnt=22, size=466, hs=4
    [2021-11-09 23:34:20.362][Trace][147724][52hs7r4w] RTC: DTLS handshake done.
    [2021-11-09 23:34:20.362][Trace][147724][52hs7r4w] RTC: session pub=0, sub=1, to=30000ms connection established
    [2021-11-09 23:34:20.362][Trace][147724][52hs7r4w] RTC: Subscriber url=/live/livestream established
    [2021-11-09 23:34:20.362][Trace][147724][52hs7r4w] create consumer, no gop cache
    [2021-11-09 23:34:20.362][Trace][147724][52hs7r4w] RTC: start play url=/live/livestream, source_id=/, realtime=1, mw_msgs=0
    [2021-11-09 23:34:21.153][Trace][147724][9x688437] HTTP #76 112.1.171.64:28922 GET http://114.67.69.234:1985/api/v1/streams/?callback=angular.callbacks._4l, content-length=-1
    [2021-11-09 23:34:21.474][Trace][147724][09r51btg] <- RTC RECV #10, udp 37, pps 1/3, schedule 37
    [2021-11-09 23:34:22.412][Trace][147724][y3284m77] Hybrid cpu=2.00%,19MB, cid=20,11, timer=62,0,55, clock=0,46,2,0,0,0,0,0,0, free=1, objs=(pkt:0,raw:0,fua:0,msg:468,oth:0,buf:0)
    [2021-11-09 23:34:22.412][Trace][147724][y3284m77] RTC: Server conns=2, rpkts=(2,rtp:0,stun:1,rtcp:1), spkts=(1,rtp:0,stun:1,rtcp:0), fid=(id:1,fid:2,ffid:0,addr:1,faddr:3)
    [2021-11-09 23:34:25.418][Trace][147724][9x688437] HTTP #77 112.1.171.64:28922 GET http://114.67.69.234:1985/api/v1/streams/?callback=angular.callbacks._4m, content-length=-1
    [2021-11-09 23:34:27.262][Trace][147724][q67w0684] -> PLA time=61177840, msgs=28, okbps=2792,2729,0, ikbps=0,0,0, mw=350/8
    [2021-11-09 23:34:27.352][Trace][147724][a0wyg7zx] <- CPB time=110005479, okbps=0,0,0, ikbps=2684,2716,0, mr=0/350, p1stpt=20000, pnt=5000
    [2021-11-09 23:34:27.413][Trace][147724][y3284m77] Hybrid cpu=1.00%,19MB, cid=20,11, timer=62,0,55, clock=0,46,2,0,0,0,0,0,0, free=1, objs=(pkt:0,raw:0,fua:0,msg:468,oth:0,buf:0)
    [2021-11-09 23:34:27.413][Trace][147724][y3284m77] RTC: Server conns=2, rpkts=(2,rtp:0,stun:1,rtcp:1), spkts=(1,rtp:0,stun:1,rtcp:0), fid=(id:1,fid:2,ffid:0,addr:1,faddr:3)
    [2021-11-09 23:34:29.150][Trace][147724][22zp0891] -> HLS time=834688924ms, sno=72, ts=wrj-71.ts, dur=0.00, dva=11734p
    [2021-11-09 23:34:29.584][Trace][147724][9x688437] HTTP #78 112.1.171.64:28922 GET http://114.67.69.234:1985/api/v1/streams/?callback=angular.callbacks._4n, content-length=-1
    ^C[2021-11-09 23:34:30.723][Trace][147724][4x6i2619] sig=2, user terminate program, fast quit
    [2021-11-09 23:34:30.791][Trace][147724][4x6i2619] cleanup for quit signal fast=1, grace=0

> 1. SRS configuration is as follows:

the config for srs to delivery RTMP

@see https://github.com/ossrs/srs/wiki/v1_CN_SampleRTMP

@see full.conf for detail config.

listen 1935; max_connections 1000; srs_log_tank console; srs_log_file ./objs/srs.log; daemon off;

http_server { enabled on; listen 8080; dir ./objs/nginx/html; } http_api { enabled on; listen 1985; } stats { network 0; } rtc_server { enabled on;

Listen at udp://8000

listen          8000;
#
# The $CANDIDATE means fetch from env, if not configed, use * as default.
#
# The * means retrieving server IP automatically, from all network interfaces,
# @see https://github.com/ossrs/srs/issues/307#issuecomment-599028124
candidate      114.67.69.234;

} vhost defaultVhost {

0 latency, default is 0 latency

min_latency on;

play {

mw_latency 0;

mw_msgs 0;

}

Enable FLV playback

http_remux { enabled on; mount [vhost]/[app]/[stream].flv; }

Enable M3U8 playback

hls { enabled on; hls_path ./objs/nginx/html; hls_fragment 10; hls_window 60; } rtc { enabled on; bframe discard; }

}

vhost nosave {

0 latency, the default is 0 latency

min_latency on;

play {

mw_latency 0;

mw_msgs 0;

}

Enable FLV playback

http_remux { enabled on; mount [vhost]/[app]/[stream].flv; }

Enable M3U8 playback

hls { enabled on; hls_path ./objs/nginx/html; hls_fragment 10; hls_window 60; } rtc { enabled on; bframe discard; } }



> **Replay**

> **How to replay bug?**

1. `xxxxxx`
1. `xxxxxx`
1. `xxxxxx`

> **Expect**

> **Please describe your expectation**

`TRANS_BY_GPT3`
winlinvip commented 2 years ago

English Guide

For the config srs.conf only enable live streaming and WebRTC, but doesn't enable the convert RTMP to WebRTC, vice versa. It's because the convert consumes lots of CPU, about 2% CPU for each stream, RTMP(aac) to WebRTC(opus), or WebRTC(opus) to RTMP(aac).

Please use config rtmp2rtc.conf, if convert RTMP to WebRTC, see Wiki: RTMP to RTC

Please use config rtc2rtmp.conf, if convert WebRTC to RTMP, see Wiki: RTC to RTC

For example:

./objs/srs -c rtmp2rtc.conf

Chinese Guide

Different configuration files must be used. Please refer to the content of the configuration for detailed differences. The main difference is that audio transcoding will not be automatically enabled due to high CPU consumption. Therefore, it must be explicitly enabled when converting between WebRTC and RTMP.

Please refer to the official website documentation for updated configuration information.

For example:

./objs/srs -c rtmp2rtc.conf

For example, RTMP streaming and FLV playback do not automatically enable RTC transcoding. If enabled, it can only support around 100 streams, but if not enabled, it can support around 3000 streams. Of course, enabling transcoding will have a significant impact on performance.

RTC streaming and RTC playback are the same, they will not be transcoded to RTMP by default.

TRANS_BY_GPT3

xlzcjj commented 2 years ago

So, have you solved your problem? I have also encountered such an issue.

TRANS_BY_GPT3

zhang7249 commented 2 years ago

So, have you solved your problem? I have also encountered such an issue. Yes, I have solved it. The configuration file is not compatible between the new version and the old version. You just need to go and modify the "rtmp2rtc.conf" file under the "conf" directory. When starting, use the command "-c conf/rtmp2rtc.conf'".

TRANS_BY_GPT3

zhang7249 commented 2 years ago

@xlzcjj So, have you solved your problem? I have also encountered such an issue.

It's resolved. The configuration files of the new version and the old version are not compatible. You can directly use the file "rtmp2rtc.conf" under the "conf" directory. When starting, use the command "-c conf/rtmp2rtc.conf".

TRANS_BY_GPT3

winlinvip commented 2 years ago

This problem is too common. We have optimized the error message. If the RTMP stream already exists but the rtmp2rtc configuration is not enabled, playing WebRTC will result in a direct error.

RTC error code=5021 : Disabled rtmp_to_rtc of __defaultVhost__, see #2728
thread [35701][e7rc59t6]: do_serve_http() [src/app/srs_app_rtc_api.cpp:192][errno=35]

This allows errors to appear more quickly instead of having a black screen, as there are too many possibilities for a black screen. This obvious configuration issue should immediately result in an error to reduce troubleshooting time.

From a business logic perspective, if an RTMP stream has already been pushed, it is not possible to push another RTC stream with the same URL. Therefore, it must belong to the RTMP to RTC conversion scenario.

Note: RTC2RTMP does not perform this check because it is currently less commonly used.

Please refer to: https://github.com/ossrs/srs/commit/8bc2759c7e8eaaac95d6e5a5072a03b2378280c3

TRANS_BY_GPT3