Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chrome screen sharing is streamed to SRS via WebRTC, but clients cannot play it using the WebRTC protocol, and playing it will cause SRS to crash. #2719

Closed
moliyadi opened this issue Nov 5, 2021 · 12 comments · Fixed by #2729
Assignees
Labels
Bug It might be a bug. TransByAI Translated by AI/GPT. WebRTC WebRTC, RTC2RTMP or RTMP2RTC.
Milestone

Comments

@moliyadi
Copy link

moliyadi commented Nov 5, 2021

Note: Before asking a question, please read the FAQ (Please read FAQ before filing an issue) #2716

Description

Please describe your issue here.

  1. SRS version: v4.0.191
  1. SRS log:

[2021-11-05 09:28:04.317][Trace][1][00cx4q57] XCORE-SRS/4.0.191(Leo)
[2021-11-05 09:28:04.317][Trace][1][00cx4q57] config parse complete
[2021-11-05 09:28:04.317][Trace][1][00cx4q57] write log to console
[2021-11-05 09:28:04.317][Trace][1][00cx4q57][MAIN] SRS/4.0.191(Leo), MIT
[2021-11-05 09:28:04.317][Trace][1][00cx4q57] authors: https://github.com/ossrs/srs/blob/4.0release/trunk/AUTHORS.txt
[2021-11-05 09:28:04.317][Trace][1][00cx4q57] contributors: Winlin<[email protected]> Winlin<[email protected]> Winlin<[email protected]> Wenjie<[email protected]> Wenjie<[email protected]> Wenjie<[email protected]> xiangcheng.liu<[email protected]> naijia.liu<[email protected]> alcoholyi<[email protected]> byteman<[email protected]> chad.wang<[email protected]> suhetao<[email protected]> Johnny<[email protected]> karthikeyan<[email protected]> StevenLiu<[email protected]> zhengfl<[email protected]> tufang14<[email protected]> allspace<[email protected]> niesongsong<[email protected]> rudeb0t<[email protected]> CallMeNP<[email protected]> synote<[email protected]> lovecat<[email protected]> panda1986<[email protected]> YueHonghui<[email protected]> ThomasDreibholz<[email protected]> JuntaoLiu<[email protected]> RocFang<[email protected]> MakarovYaroslav<[email protected]> MirkoVelic<[email protected]> HuiZhang(huzhang2)<[email protected]> OtterWa<[email protected]> walkermi<[email protected]> haofz<[email protected]> ME_Kun_Han<[email protected]> ljx0305<[email protected]> cenxinwei<[email protected]> StarBrilliant<[email protected]> xubin<[email protected]> intliang<[email protected]> flowerwrong<[email protected]> YLX<[email protected]> J<[email protected]> Harlan<[email protected]> hankun<[email protected]> JonathanBarratt<[email protected]> KeeganH<[email protected]> StevenLiu<[email protected]> liuxc0116<[email protected]> ChengdongZhang<[email protected]> lovacat<[email protected]> qiang.li<[email protected]> HungMingWu<[email protected]> Himer<[email protected]> XiaLixin<[email protected]> XiaLixin<[email protected]> XiaLixin<[email protected]> XiaLixin<[email protected]> alphonsetai<[email protected]> Michael.Ma<[email protected]> lam2003<[email protected]> ShiWei<[email protected]> ShiWei<[email protected]> XiaofengWang<[email protected]> XiaoZhihong<[email protected]> XiaoZhihong<[email protected]> XiaoZhihong<[email protected]> yanghuiwen<[email protected]> WuPengqiang<[email protected]> WuPengqiang<[email protected]> l<22312935+lam2003@github> xfalcon<x-falcon@github> ChenGuanghua<[email protected]> ChenGuanghua<[email protected]> LiPeng<[email protected]> LiPeng<[email protected]> yajun18<[email protected]> liulichuan<[email protected]> yapingcat<[email protected]> chenchengbin<[email protected]> ChenHaibo<[email protected]> ChenHaibo<[email protected]> jasongwq<[email protected]> yinjiaoyuan<[email protected]> PieerePi<[email protected]> JesseXi<[email protected]> PieerePi<40780488+PieerePi@github> ghostsf<[email protected]> xbpeng121<53243357+xbpeng121@github> johzzy<[email protected]> stone<[email protected]> cfw11<34058899+cfw11@github> Hung-YiChen<[email protected]> long<[email protected]> matthew1838<77285055+matthew1838@github> rise<[email protected]>
[2021-11-05 09:28:04.317][Trace][1][00cx4q57] cwd=/usr/local/srs, work_dir=./, build: 2021-11-02 00:12:53, configure: --x86-x64 --srt=on --jobs=2, uname: Linux bd23ee4c1e93 5.8.0-1042-azure #45~20.04.1-Ubuntu SMP Wed Sep 15 14:24:15 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux, osx: 0
[2021-11-05 09:28:04.317][Trace][1][00cx4q57] configure detail: --prefix=/usr/local/srs --hls=on --hds=off --dvr=on --ssl=on --https=on --ssl-1-0=off --ssl-local=off --sys-ssl=off --transcode=on --ingest=on --stat=on --http-callback=on --http-server=on --stream-caster=on --http-api=on --utest=off --cherrypy=off --srt=on --rtc=on --simulator=off --cxx11=on --cxx14=off --ffmpeg-fit=on --nasm=on --srtp-nasm=on --clean=on --gperf=off --gmc=off --gmd=off --gmp=off --gcp=off --gprof=off --static=off --shared-st=off --shared-srt=off --shared-ffmpeg=off --log-verbose=off --log-info=off --log-trace=on --gcov=off --debug=off --debug-stats=off --cross-build=off --cc=gcc --cxx=g++ --ar=ar --ld=ld --randlib=randlib
[2021-11-05 09:28:04.317][Trace][1][00cx4q57] srs checking config...
[2021-11-05 09:28:04.317][Trace][1][00cx4q57] ips, iface[0] eth0 ipv4 0x11043 172.17.0.2
[2021-11-05 09:28:04.317][Trace][1][00cx4q57] devices, intranet eth0 172.17.0.2
[2021-11-05 09:28:04.317][Warn][1][00cx4q57][22] stats network use index=0, ip=172.17.0.2, ifname=eth0
[2021-11-05 09:28:04.317][Warn][1][00cx4q57][22] stats disk not configed, disk iops disabled.
[2021-11-05 09:28:04.317][Trace][1][00cx4q57] write log to console
[2021-11-05 09:28:04.317][Trace][1][00cx4q57] features, rch:on, dash:on, hls:on, hds:off, srt:on, hc:on, ha:on, hs:on, hp:on, dvr:on, trans:on, inge:on, stat:on, sc:on
[2021-11-05 09:28:04.317][Trace][1][00cx4q57] SRS on  amd64 x86_64, conf:conf/srs.conf, limit:1000, writev:1024, encoding:little-endian, HZ:100
[2021-11-05 09:28:04.317][Trace][1][00cx4q57] mw sleep:350ms. mr enabled:on, default:0, sleep:350ms
[2021-11-05 09:28:04.317][Trace][1][00cx4q57] gc:on, pq:30000ms, cscc:[0,16), csa:on, tn:on(may hurts performance), ss:auto(guess by merged write)
[2021-11-05 09:28:04.317][Trace][1][00cx4q57] system default latency(ms): mw(0-350) + mr(0-350) + play-queue(0-30000)
[2021-11-05 09:28:04.317][Warn][1][00cx4q57][22] SRS/4.0.191 is not stable
[2021-11-05 09:28:04.317][Warn][1][00cx4q57][22] disable daemon for docker
[2021-11-05 09:28:04.319][Trace][1][00cx4q57] fingerprint=AC:D5:1F:32:23:EC:04:4B:0A:C9:1E:6F:54:46:E8:17:A0:0C:0F:D0:E2:5E:F3:CD:A9:10:9F:6B:4F:46:05:8D
[2021-11-05 09:28:04.319][Trace][1][00cx4q57] CircuitBreaker: enabled=1, high=2x90, critical=1x95, dying=5x99
[2021-11-05 09:28:04.320][Trace][1][00cx4q57] http flv live stream, vhost=__defaultVhost__, mount=[vhost]/[app]/[stream].flv
[2021-11-05 09:28:04.320][Trace][1][00cx4q57] http: root mount to ./objs/nginx/html
[2021-11-05 09:28:04.320][Trace][1][00cx4q57] server main cid=00cx4q57, pid=1, ppid=0, asprocess=0
[2021-11-05 09:28:04.320][Trace][1][00cx4q57] write pid=1 to ./objs/srs.pid success!
[2021-11-05 09:28:04.320][Trace][1][00cx4q57] RTMP listen at tcp://0.0.0.0:1935, fd=7
[2021-11-05 09:28:04.320][Trace][1][00cx4q57] HTTP-API listen at tcp://0.0.0.0:1985, fd=8
[2021-11-05 09:28:04.321][Trace][1][00cx4q57] HTTP-Server listen at tcp://0.0.0.0:8080, fd=9
[2021-11-05 09:28:04.321][Trace][1][00cx4q57] signal installed, reload=1, reopen=10, fast_quit=15, grace_quit=3
[2021-11-05 09:28:04.321][Trace][1][00cx4q57] http: api mount /console to ./objs/nginx/html/console
[2021-11-05 09:28:04.321][Trace][1][00cx4q57] rtc listen at udp://0.0.0.0:8000, fd=10
[2021-11-05 09:28:04.321][Trace][1][mt340542] Hybrid cpu=0.00%,12MB
[2021-11-05 09:28:04.321][Warn][1][30ktgd78][22] use private address as ip: 172.17.0.2, ifname=eth0
[2021-11-05 09:28:04.321][Trace][1][30ktgd78] Startup query id=ad89d9763e1a11eca25e7f51c3e47629, eip=172.17.0.2, wait=575s
[2021-11-05 09:28:04.321][Trace][1][7y7pfa7j] TCP: connection manager run, conns=0
[2021-11-05 09:28:04.321][Warn][1][00cx4q57][11] enable auto reload for docker
[2021-11-05 09:28:04.321][Trace][1][00cx4q57] auto reload watching fd=11, watch=1, file=conf
[2021-11-05 09:28:04.322][Trace][1][430503j6] UDP #10 LISTEN at 0.0.0.0:8000, SO_SNDBUF(default=212992, expect=10485760, actual=425984, r0=0), SO_RCVBUF(default=212992, expect=10485760, actual=425984, r0=0)
[2021-11-05 09:28:04.322][Trace][1][14789672] RTC: connection manager run, conns=0
[2021-11-05 09:28:09.316][Trace][1][mt340542] Hybrid cpu=0.00%,12MB
[2021-11-05 09:28:14.316][Trace][1][mt340542] Hybrid cpu=0.00%,12MB
[2021-11-05 09:28:19.317][Trace][1][mt340542] Hybrid cpu=0.00%,12MB, cid=1,1, timer=63,0,0, clock=0,49,1,0,0,0,0,0,0
[2021-11-05 09:28:23.915][Trace][1][ae621h67] HTTP #0 192.168.124.101:50376 POST http://192.168.124.211:1985/rtc/v1/publish/, content-length=4635
[2021-11-05 09:28:23.916][Trace][1][ae621h67] RTC publish webrtc://192.168.124.211/123456/4a1a397s1, api=http://192.168.124.211:1985/rtc/v1/publish/, tid=22ef503, clientip=192.168.124.101, app=123456, stream=4a1a397s1, offer=4221B, eip=, codec=
[2021-11-05 09:28:23.916][Trace][1][ae621h67] ignore attribute=, value=
[2021-11-05 09:28:23.916][Trace][1][ae621h67] new source, stream_url=/123456/4a1a397s1
[2021-11-05 09:28:23.916][Trace][1][ae621h67] RTC publisher nack=1, nnc=1, pt-drop=0, twcc=1/4
[2021-11-05 09:28:23.916][Trace][1][ae621h67] RTC: Init tracks {track: 0d40516c-a535-42f4-bd17-116e9bd96992, is_active: 0=>1}, ok
[2021-11-05 09:28:23.916][Trace][1][ae621h67] RTC: Use candidates 192.168.124.211
[2021-11-05 09:28:23.917][Trace][1][ae621h67] RTC init session, user=93s9h299:lUjZ, url=/123456/4a1a397s1, encrypt=1/1, DTLS(role=passive, version=auto), timeout=30000ms, nack=1
[2021-11-05 09:28:23.917][Trace][1][ae621h67] RTC username=93s9h299:lUjZ, offer=4221B, answer=867B
[2021-11-05 09:28:23.917][Trace][1][ae621h67] RTC remote offer: v=0\r\no=- 1372008797419425428 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0\r\na=extmap-allow-mixed\r\na=msid-semantic: WMS\r\nm=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 102 121 127 120 125 107 108 109 35 36 124 119 123 118 114 115 116\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:lUjZ\r\na=ice-pwd:1Jmj74OhzbvwFfqWCjD6VIzW\r\na=ice-options:trickle\r\na=fingerprint:sha-256 48:F3:43:90:3B:47:3B:75:A9:81:50:35:60:7C:18:E5:32:1E:58:B2:C8:6E:91:4A:5F:01:84:B3:A6:07:AB:4B\r\na=setup:actpass\r\na=mid:0\r\na=extmap:1 urn:ietf:params:rtp-hdrext:toffset\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:3 urn:3gpp:video-orientation\r\na=extmap:4 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:9 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=sendrecv\r\na=msid:- 0d40516c-a535-42f4-bd17-116e9bd96992\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: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=ssrc-group:FID 584504130 2927640742\r\na=ssrc:584504130 cname:U7Xe2VU55+SsZQBV\r\na=ssrc:584504130 msid:- 0d40516c-a535-42f4-bd17-116e9bd96992\r\na=ssrc:584504130 mslabel:-\r\na=ssrc:584504130 label:0d40516c-a535-42f4-bd17-116e9bd96992\r\na=ssrc:2927640742 cname:U7Xe2VU55+SsZQBV\r\na=ssrc:2927640742 msid:- 0d40516c-a535-42f4-bd17-116e9bd96992\r\na=ssrc:2927640742 mslabel:-\r\na=ssrc:2927640742 label:0d40516c-a535-42f4-bd17-116e9bd96992\r\n
[2021-11-05 09:28:23.917][Trace][1][ae621h67] RTC local answer: v=0\r\no=SRS/4.0.191(Leo) 50079456 2 IN IP4 0.0.0.0\r\ns=SRSPublishSession\r\nt=0 0\r\na=ice-lite\r\na=group:BUNDLE 0\r\na=msid-semantic: WMS 123456/4a1a397s1\r\nm=video 9 UDP/TLS/RTP/SAVPF 125 114\r\nc=IN IP4 0.0.0.0\r\na=ice-ufrag:93s9h299\r\na=ice-pwd:x8q60e9k2664321422394607221p9126\r\na=fingerprint:sha-256 AC:D5:1F:32:23:EC:04:4B:0A:C9:1E:6F:54:46:E8:17:A0:0C:0F:D0:E2:5E:F3:CD:A9:10:9F:6B:4F:46:05:8D\r\na=setup:passive\r\na=mid:0\r\na=extmap:4 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=recvonly\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=rtpmap:114 red/90000\r\na=candidate:0 1 udp 2130706431 192.168.124.211 8000 typ host generation 0\r\n
[2021-11-05 09:28:24.318][Trace][1][mt340542] Hybrid cpu=0.00%,12MB, cid=1,1, timer=63,0,0, clock=0,49,1,0,0,0,0,0,0
[2021-11-05 09:28:24.318][Trace][1][mt340542] RTC: Server conns=1
[2021-11-05 09:28:24.825][Trace][1][ae621h67] TCP: before dispose resource(HttpConn)(0x2facd70), conns=1, zombies=0, ign=0, inz=0, ind=0
[2021-11-05 09:28:24.825][Warn][1][ae621h67][104] client disconnect peer. ret=1007
[2021-11-05 09:28:24.825][Trace][1][7y7pfa7j] TCP: clear zombies=1 resources, conns=1, removing=0, unsubs=0
[2021-11-05 09:28:24.825][Trace][1][ae621h67] TCP: disposing #0 resource(HttpConn)(0x2facd70), conns=1, disposing=1, zombies=0
[2021-11-05 09:28:24.843][Trace][1][ae621h67] RTC: session address init 10.211.55.2:60402
[2021-11-05 09:28:24.843][Trace][1][ae621h67] RTC: session STUN done, waiting DTLS handshake.
[2021-11-05 09:28:24.843][Trace][1][430503j6] <- RTC RECV #10, udp 1, pps 0/0, schedule 1
[2021-11-05 09:28:24.883][Trace][1][ae621h67] RTC: session address change 10.211.55.2:60402 -> 10.37.129.2:64848, cached=0, nn_change=1/1, nn_address=1
[2021-11-05 09:28:24.932][Trace][1][ae621h67] RTC: session address change 10.37.129.2:64848 -> 192.168.124.101:59391, cached=0, nn_change=2/1, nn_address=2
[2021-11-05 09:28:24.936][Trace][1][ae621h67] DTLS: State Passive RECV, done=0, arq=0/0, r0=1, r1=0, len=157, cnt=22, size=144, hs=1
[2021-11-05 09:28:24.936][Trace][1][ae621h67] DTLS: State Passive SEND, done=0, arq=0/0, r0=-1, r1=2, len=682, cnt=22, size=82, hs=2
[2021-11-05 09:28:24.944][Trace][1][ae621h67] DTLS: State Passive RECV, done=0, arq=0/0, r0=1, r1=0, len=578, cnt=22, size=299, hs=11
[2021-11-05 09:28:24.944][Trace][1][ae621h67] DTLS: State Passive SEND, done=1, arq=0/0, r0=1, r1=0, len=554, cnt=22, size=466, hs=4
[2021-11-05 09:28:24.944][Trace][1][ae621h67] RTC: DTLS handshake done.
[2021-11-05 09:28:24.944][Trace][1][ae621h67] RTC: session pub=1, sub=0, to=30000ms connection established
[2021-11-05 09:28:24.945][Trace][1][ae621h67] RTC: Publisher url=/123456/4a1a397s1 established
[2021-11-05 09:28:25.078][Trace][1][ae621h67] RTC: session address change 192.168.124.101:59391 -> 10.211.55.2:60402, cached=1, nn_change=3/1, nn_address=3
[2021-11-05 09:28:29.318][Trace][1][mt340542] Hybrid cpu=1.00%,13MB, cid=1,1, timer=63,0,0, clock=0,49,1,0,0,0,0,0,0
[2021-11-05 09:28:29.318][Trace][1][mt340542] RTC: Server conns=1
[2021-11-05 09:28:34.319][Trace][1][mt340542] Hybrid cpu=0.00%,14MB, cid=3,3, timer=62,7,34, clock=0,48,1,0,0,0,0,0,0, free=1, objs=(pkt:18,raw:14,fua:3,msg:18,oth:1,buf:18)
[2021-11-05 09:28:34.319][Trace][1][mt340542] RTC: Server conns=1
[2021-11-05 09:28:34.858][Trace][1][430503j6] <- RTC RECV #10, udp 331, pps 10/33, schedule 331
[2021-11-05 09:28:35.338][Trace][1][ae621h67] RTC: session address change 192.168.124.101:59391 -> 10.211.55.2:60402, cached=1, nn_change=26/10, nn_address=3
[2021-11-05 09:28:35.839][Trace][1][ae621h67] RTC: session address change 10.211.55.2:60402 -> 10.37.129.2:64848, cached=1, nn_change=27/11, nn_address=3
[2021-11-05 09:28:37.345][Trace][1][ae621h67] RTC: session address change 10.37.129.2:64848 -> 192.168.124.101:59391, cached=1, nn_change=30/7, nn_address=3
[2021-11-05 09:28:39.320][Trace][1][mt340542] Hybrid cpu=0.00%,14MB, cid=3,3, timer=62,7,34, clock=0,48,1,0,0,0,0,0,0, free=1, objs=(pkt:18,raw:14,fua:3,msg:18,oth:1,buf:18)
[2021-11-05 09:28:39.320][Trace][1][mt340542] RTC: Server conns=1, rpkts=(31,rtp:27,stun:2,rtcp:1), spkts=(13,rtp:0,stun:2,rtcp:20), rtcp=(pli:0,twcc:9,rr:1), snk=(49,a:0,v:49,h:0), fid=(id:1,fid:31,ffid:0,addr:2,faddr:31)
[2021-11-05 09:28:44.321][Trace][1][mt340542] Hybrid cpu=0.00%,14MB, cid=1,2, timer=62,10,49, clock=0,47,1,0,0,0,0,0,0, objs=(pkt:24,raw:24,fua:0,msg:24,oth:0,buf:24)
[2021-11-05 09:28:44.321][Trace][1][mt340542] RTC: Server conns=1, rpkts=(31,rtp:27,stun:2,rtcp:1), spkts=(13,rtp:0,stun:2,rtcp:20), rtcp=(pli:0,twcc:9,rr:1), snk=(49,a:0,v:49,h:0), fid=(id:1,fid:31,ffid:0,addr:2,faddr:31)
[2021-11-05 09:28:44.900][Trace][1][430503j6] <- RTC RECV #10, udp 286, pps 15/28, schedule 286
[2021-11-05 09:28:45.603][Trace][1][5j7co0d1] HTTP #0 192.168.124.101:50462 OPTIONS http://192.168.124.211:1985/rtc/v1/play/, content-length=-1
[2021-11-05 09:28:45.658][Trace][1][5j7co0d1] HTTP #1 192.168.124.101:50462 POST http://192.168.124.211:1985/rtc/v1/play/, content-length=5688
[2021-11-05 09:28:45.659][Trace][1][5j7co0d1] RTC play webrtc://192.168.124.211/123456/4a1a397s1, api=http://192.168.124.211:1985/rtc/v1/play/, tid=198d2da, clientip=192.168.124.101, app=123456, stream=4a1a397s1, offer=5211B, eip=, codec=, srtp=, dtls=
[2021-11-05 09:28:45.659][Trace][1][5j7co0d1] ignore attribute=, value=

  1. SRS configuration:

Use the default configuration conf/srs.conf from the source code:


# main config for srs.
# @see full.conf for detail config.

listen              1935;
max_connections     1000;
#srs_log_tank        file;
#srs_log_file        ./objs/srs.log;
daemon              on;
http_api {
    enabled         on;
    listen          1985;
}
http_server {
    enabled         on;
    listen          8080;
    dir             ./objs/nginx/html;
}
rtc_server {
    enabled on;
    listen 8000;
    # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#config-candidate
    candidate $CANDIDATE;
}
vhost __defaultVhost__ {
    hls {
        enabled         on;
    }
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
    }
    rtc {
        enabled     on;
        # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtmp-to-rtc
        rtmp_to_rtc off;
        # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtc-to-rtmp
        rtc_to_rtmp off;
    }
}

Replay

How to replay bug?

  1. Use Chrome browser to obtain the shared screen stream using getDisplayMedia.

constraints configuration:

screenConstraints = {
    video: {
      width: 1280,
      height: 720,
      frameRate: 30
    }
  }
  1. Imitate the publishing logic in srs.sdk.js for WebRTC streaming.
  2. After streaming, there are no errors reported and there is traffic uploading, but playback is not possible and attempting to play causes the SRS service to crash.
  3. Using the built-in RTC player in the SRS demo page also fails to play, and attempting to play also causes the SRS service to crash.

Expected Behavior (Expect)

The client can play WebRTC streaming of Chrome screen sharing normally, similar to camera capture streaming.

TRANS_BY_GPT3

@xiaozhihong
Copy link
Collaborator

xiaozhihong commented Nov 7, 2021

Does the crash have a stack trace? Also, what endpoint is used for streaming? I didn't see the SDP in the above logs.

TRANS_BY_GPT3

@moliyadi
Copy link
Author

moliyadi commented Nov 7, 2021

  1. SRS is running using the Docker method, and the above logs are the complete logs printed by SRS from startup to triggering a crash during playback.
  2. Streaming is done using Chrome, based on srs.sdk.js, to obtain the video stream of the shared screen through getDisplayMedia, and then the publish interface of SRS is called for streaming. The publish interface also returns the SDP information of the answer correctly.
  3. If it is possible to obtain the crash stack trace, I can try to reproduce it and get it. Thank you.

TRANS_BY_GPT3

@moliyadi
Copy link
Author

moliyadi commented Nov 7, 2021

@xiaozhihong, do you think this part in the log is the SDP information sent by the streaming client and the response from SRS?

[2021-11-05 09:28:23.917][Trace][1][ae621h67] RTC remote offer: v=0\r\no=- 1372008797419425428 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0\r\na=extmap-allow-mixed\r\na=msid-semantic: WMS\r\nm=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 102 121 127 120 125 107 108 109 35 36 124 119 123 118 114 115 116\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:lUjZ\r\na=ice-pwd:1Jmj74OhzbvwFfqWCjD6VIzW\r\na=ice-options:trickle\r\na=fingerprint:sha-256 48:F3:43:90:3B:47:3B:75:A9:81:50:35:60:7C:18:E5:32:1E:58:B2:C8:6E:91:4A:5F:01:84:B3:A6:07:AB:4B\r\na=setup:actpass\r\na=mid:0\r\na=extmap:1 urn:ietf:params:rtp-hdrext:toffset\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:3 urn:3gpp:video-orientation\r\na=extmap:4 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:9 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=sendrecv\r\na=msid:- 0d40516c-a535-42f4-bd17-116e9bd96992\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: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=ssrc-group:FID 584504130 2927640742\r\na=ssrc:584504130 cname:U7Xe2VU55+SsZQBV\r\na=ssrc:584504130 msid:- 0d40516c-a535-42f4-bd17-116e9bd96992\r\na=ssrc:584504130 mslabel:-\r\na=ssrc:584504130 label:0d40516c-a535-42f4-bd17-116e9bd96992\r\na=ssrc:2927640742 cname:U7Xe2VU55+SsZQBV\r\na=ssrc:2927640742 msid:- 0d40516c-a535-42f4-bd17-116e9bd96992\r\na=ssrc:2927640742 mslabel:-\r\na=ssrc:2927640742 label:0d40516c-a535-42f4-bd17-116e9bd96992\r\n
[2021-11-05 09:28:23.917][Trace][1][ae621h67] RTC local answer: v=0\r\no=SRS/4.0.191(Leo) 50079456 2 IN IP4 0.0.0.0\r\ns=SRSPublishSession\r\nt=0 0\r\na=ice-lite\r\na=group:BUNDLE 0\r\na=msid-semantic: WMS 123456/4a1a397s1\r\nm=video 9 UDP/TLS/RTP/SAVPF 125 114\r\nc=IN IP4 0.0.0.0\r\na=ice-ufrag:93s9h299\r\na=ice-pwd:x8q60e9k2664321422394607221p9126\r\na=fingerprint:sha-256 AC:D5:1F:32:23:EC:04:4B:0A:C9:1E:6F:54:46:E8:17:A0:0C:0F:D0:E2:5E:F3:CD:A9:10:9F:6B:4F:46:05:8D\r\na=setup:passive\r\na=mid:0\r\na=extmap:4 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=recvonly\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=rtpmap:114 red/90000\r\na=candidate:0 1 udp 2130706431 192.168.124.211 8000 typ host generation 0\r\n

TRANS_BY_GPT3

@xiaozhihong
Copy link
Collaborator

xiaozhihong commented Nov 8, 2021

@xiaozhihong Do you think this part in the log is the SDP information sent by the streaming client and replied by SRS?

[2021-11-05 09:28:23.917][Trace][1][ae621h67] RTC remote offer: v=0\r\no=- 1372008797419425428 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0\r\na=extmap-allow-mixed\r\na=msid-semantic: WMS\r\nm=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 102 121 127 120 125 107 108 109 35 36 124 119 123 118 114 115 116\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:lUjZ\r\na=ice-pwd:1Jmj74OhzbvwFfqWCjD6VIzW\r\na=ice-options:trickle\r\na=fingerprint:sha-256 48:F3:43:90:3B:47:3B:75:A9:81:50:35:60:7C:18:E5:32:1E:58:B2:C8:6E:91:4A:5F:01:84:B3:A6:07:AB:4B\r\na=setup:actpass\r\na=mid:0\r\na=extmap:1 urn:ietf:params:rtp-hdrext:toffset\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:3 urn:3gpp:video-orientation\r\na=extmap:4 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:9 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=sendrecv\r\na=msid:- 0d40516c-a535-42f4-bd17-116e9bd96992\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: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=ssrc-group:FID 584504130 2927640742\r\na=ssrc:584504130 cname:U7Xe2VU55+SsZQBV\r\na=ssrc:584504130 msid:- 0d40516c-a535-42f4-bd17-116e9bd96992\r\na=ssrc:584504130 mslabel:-\r\na=ssrc:584504130 label:0d40516c-a535-42f4-bd17-116e9bd96992\r\na=ssrc:2927640742 cname:U7Xe2VU55+SsZQBV\r\na=ssrc:2927640742 msid:- 0d40516c-a535-42f4-bd17-116e9bd96992\r\na=ssrc:2927640742 mslabel:-\r\na=ssrc:2927640742 label:0d40516c-a535-42f4-bd17-116e9bd96992\r\n
[2021-11-05 09:28:23.917][Trace][1][ae621h67] RTC local answer: v=0\r\no=SRS/4.0.191(Leo) 50079456 2 IN IP4 0.0.0.0\r\ns=SRSPublishSession\r\nt=0 0\r\na=ice-lite\r\na=group:BUNDLE 0\r\na=msid-semantic: WMS 123456/4a1a397s1\r\nm=video 9 UDP/TLS/RTP/SAVPF 125 114\r\nc=IN IP4 0.0.0.0\r\na=ice-ufrag:93s9h299\r\na=ice-pwd:x8q60e9k2664321422394607221p9126\r\na=fingerprint:sha-256 AC:D5:1F:32:23:EC:04:4B:0A:C9:1E:6F:54:46:E8:17:A0:0C:0F:D0:E2:5E:F3:CD:A9:10:9F:6B:4F:46:05:8D\r\na=setup:passive\r\na=mid:0\r\na=extmap:4 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=recvonly\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=rtpmap:114 red/90000\r\na=candidate:0 1 udp 2130706431 192.168.124.211 8000 typ host generation 0\r\n

Yes, you're right, I missed that haha. The stack trace is important. Let's see if we can print the stack trace.

TRANS_BY_GPT3

@moliyadi
Copy link
Author

moliyadi commented Nov 8, 2021

@xiaozhihong
Is the stack information you mentioned supposed to be saved in srs.log? I checked the content saved in srs.log and it is the same as what I initially pasted in the issue. The last print of SRS is this line [2021-11-05 09:28:45.659][Trace][1][5j7co0d1] ignore attribute=, value=, and then the process disappears.

If there are any other ways to obtain the stack information you mentioned, please let me know or provide a reference link. I will do my best to obtain it. Thank you.

TRANS_BY_GPT3

@moliyadi
Copy link
Author

moliyadi commented Nov 8, 2021

@xiaozhihong
I tried saving the core, this is the corresponding stack information, please see if it helps, thank you.

GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from objs/srs...
[New LWP 1994678]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `./objs/srs -c conf/srs.conf'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  SrsRtcSource::get_track_desc (this=0x562e2208f210, type=..., media_name=...) at src/app/srs_app_rtc_source.cpp:662
662	        if (stream_desc_->audio_track_desc_->media_->name_ == media_name) {
(gdb)
(gdb) where
#0  SrsRtcSource::get_track_desc (this=0x562e2208f210, type="audio", media_name="opus") at src/app/srs_app_rtc_source.cpp:662
#1  0x0000562e1fdc0a7a in SrsRtcConnection::negotiate_play_capability (this=0x562e21fc85e0, ruc=0x562e222e93a0, sub_relations=std::map with 0 elements)
    at src/app/srs_app_rtc_conn.cpp:3214
#2  0x0000562e1fdb9a1c in SrsRtcConnection::add_player (this=0x562e21fc85e0, ruc=0x562e222e93a0, local_sdp=...) at src/app/srs_app_rtc_conn.cpp:2025
#3  0x0000562e1fdf33fd in SrsRtcServer::do_create_session (this=0x562e21dde6b0, ruc=0x562e222e93a0, local_sdp=..., session=0x562e21fc85e0)
    at src/app/srs_app_rtc_server.cpp:500
#4  0x0000562e1fdf3207 in SrsRtcServer::create_session (this=0x562e21dde6b0, ruc=0x562e222e93a0, local_sdp=..., psession=0x562e222e8cd0)
    at src/app/srs_app_rtc_server.cpp:478
#5  0x0000562e1fe0adc2 in SrsGoApiRtcPlay::do_serve_http (this=0x562e21eace00, w=0x562e222e9a40, r=0x562e21f3b360, res=0x562e21fcc7b0)
    at src/app/srs_app_rtc_api.cpp:190
#6  0x0000562e1fe09854 in SrsGoApiRtcPlay::serve_http (this=0x562e21eace00, w=0x562e222e9a40, r=0x562e21f3b360) at src/app/srs_app_rtc_api.cpp:49
#7  0x0000562e1fc77cad in SrsHttpServeMux::serve_http (this=0x562e21dde000, w=0x562e222e9a40, r=0x562e21f3b360) at src/protocol/srs_http_stack.cpp:727
#8  0x0000562e1fc78af6 in SrsHttpCorsMux::serve_http (this=0x562e2226e990, w=0x562e222e9a40, r=0x562e21f3b360) at src/protocol/srs_http_stack.cpp:875
#9  0x0000562e1fd4d843 in SrsHttpConn::process_request (this=0x562e21f28720, w=0x562e222e9a40, r=0x562e21f3b360, rid=1) at src/app/srs_app_http_conn.cpp:233
#10 0x0000562e1fd4d46e in SrsHttpConn::process_requests (this=0x562e21f28720, preq=0x562e222e9b18) at src/app/srs_app_http_conn.cpp:206
#11 0x0000562e1fd4cff9 in SrsHttpConn::do_cycle (this=0x562e21f28720) at src/app/srs_app_http_conn.cpp:160
#12 0x0000562e1fd4c9d0 in SrsHttpConn::cycle (this=0x562e21f28720) at src/app/srs_app_http_conn.cpp:105
#13 0x0000562e1fcf77a8 in SrsFastCoroutine::cycle (this=0x562e22173850) at src/app/srs_app_st.cpp:262
#14 0x0000562e1fcf784c in SrsFastCoroutine::pfn (arg=0x562e22173850) at src/app/srs_app_st.cpp:277
#15 0x0000562e1fe1564f in _st_thread_main () at sched.c:363
#16 0x0000562e1fe15f08 in st_thread_create (start=0x562e1fcf7828 <SrsFastCoroutine::pfn(void*)>, arg=0x562e22173850, joinable=1, stk_size=65536) at sched.c:694
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb)

TRANS_BY_GPT3

@winlinvip winlinvip added Bug It might be a bug. WebRTC WebRTC, RTC2RTMP or RTMP2RTC. labels Nov 8, 2021
@winlinvip winlinvip added this to the 4.0 milestone Nov 8, 2021
@winlinvip
Copy link
Member

winlinvip commented Nov 8, 2021

Crashes definitely need to be resolved. The server should not crash just because the client provides an input; this could be considered as a form of attack. 😄

TRANS_BY_GPT3

@xiaozhihong xiaozhihong linked a pull request Nov 11, 2021 that will close this issue
@luojq661
Copy link

luojq661 commented Jul 22, 2022

@moliyadi
Excuse me, have you solved the issue of the shared screen not playing? I'm seeking advice on how to fix it.

TRANS_BY_GPT3

@moliyadi
Copy link
Author

moliyadi commented Jul 26, 2022

@luojq661 After reporting this bug last year, the new version of SRS has already fixed this crash issue. If you are unable to play, it may not be caused by this problem. You can check whether the sdp generated by the playback end createOffer contains unnecessary audio tracks. If the number or order of tracks in the requested sdp and the returned sdp do not match, it will also cause playback failure.

TRANS_BY_GPT3

@linkewei0580
Copy link

linkewei0580 commented Apr 11, 2023

  1. SRS is running in docker mode, and the above log is the complete log printed by SRS from startup to triggering SRS crash during playback;
  2. Streaming is done using Chrome, based on srs.sdk.js, by using getDisplayMedia to obtain the video stream of the shared screen, and then calling SRS's publish interface for streaming. The publish interface also returns the answer's SDP information normally;
  3. If there is a way to obtain the crash stack trace, I can try to reproduce it and get it. Thank you;

Streaming is done using Chrome, based on srs.sdk.js, by using getDisplayMedia to obtain the video stream of the shared screen, and then calling SRS's publish interface for streaming. The publish interface also returns the answer's SDP information normally. Can you share this code? Thank you!

TRANS_BY_GPT3

@moliyadi
Copy link
Author

moliyadi commented Apr 11, 2023

@linkewei0580 Roughly, the logic can be referred to as follows

// Configure constraints
self.screenConstraints = {
    audio: false,
    video: {
      width: 1280,
      height: 720,
      frameRate: 30
    }
  };

// Create PeerConnection
self.prepareShareStream = async function (shareConstraints) {
    if (self.pc === null) {
      self.pc = new RTCPeerConnection(null);
    }
    var stream = await navigator.mediaDevices.getDisplayMedia(shareConstraints);
    console.log('prepareShareStream:', stream, shareConstraints);
    // @see https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/addStream#Migrating_to_addTrack
    stream.getTracks().forEach(function (track) {
      console.log('prepareShareStream_track:', track);
      self.pc.addTrack(track);

      // Notify about local track when stream is ok.
      self.ontrack && self.ontrack({
        track: track
      });
    });
  }

// Start streaming
self.publishStream = async function (url) {
    var conf = self.__internal.prepareUrl(url);
    if (self.pc === null) {
      console.log("publishStream error: not prepare stream");
      return "";
    }
    var offer = await self.pc.createOffer();
    await self.pc.setLocalDescription(offer);
    var session = await new Promise(function (resolve, reject) {
      // @see https://github.com/rtcdn/rtcdn-draft
      var data = {
        api: conf.apiUrl,
        tid: conf.tid,
        streamurl: conf.streamUrl,
        clientip: null,
        sdp: offer.sdp
      };
      console.log("Generated offer: ", data);
      axios({
        method: "POST",
        url: conf.apiUrl,
        data: JSON.stringify(data),
        contentType: 'application/json',
        dataType: 'json'
      }).then(function (response) {
        var data = response.data;
        console.log("Got answer: ", data);
        if (data.code) {
          reject(data);
          return;
        }

        resolve(data);
      }).catch(function (reason) {
        reject(reason);
      });
    });
    await self.pc.setRemoteDescription(
      new RTCSessionDescription({
        type: 'answer',
        sdp: session.sdp
      })
    );
    session.simulator = conf.schema + '//' + conf.urlObject.server + ':' + conf.port + '/rtc/v1/nack/';

    return session;
  }

TRANS_BY_GPT3

@linkewei0580
Copy link

linkewei0580 commented May 9, 2023 via email

@winlinvip winlinvip changed the title Chrome共享屏幕通过WebRTC推流至SRS,客户端无法通过WebRTC协议进行播放,且播放会导致SRS崩溃 Chrome screen sharing is streamed to SRS via WebRTC, but clients cannot play it using the WebRTC protocol, and playing it will cause SRS to crash. Jul 27, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug It might be a bug. TransByAI Translated by AI/GPT. WebRTC WebRTC, RTC2RTMP or RTMP2RTC.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants