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

When using rtc2rtmp, an error occurs when streaming with getDisplayMedia and playing flv. #2403

Closed
bywwcnll opened this issue Jun 8, 2021 · 4 comments · Fixed by #2461
Closed
Assignees
Labels
TransByAI Translated by AI/GPT. WebRTC WebRTC, RTC2RTMP or RTMP2RTC.
Milestone

Comments

@bywwcnll
Copy link

bywwcnll commented Jun 8, 2021

Description'

Please ensure that you maintain the markdown structure.

Please describe the issue you encountered here.
'
Make sure to maintain the markdown structure.

  1. SRS version: 4.0release latest version compiled after git clone
  2. SRS log is as follows:
[2021-06-08 17:55:18.472][Trace][9615][spx42895] NACK: update seq=20481, nack range [20480, 20481]
[2021-06-08 17:55:18.506][Trace][9615][spx42895] NACK: update seq=20506, nack range [20505, 20506]
[2021-06-08 17:55:19.439][Trace][9615][16y1uv31] Hybrid cpu=0.00%,0MB, cid=19,10, timer=59,4,20, clock=0,25,20,1,0,0,0,0,0, free=1, objs=(pkt:103,raw:7,fua:95,msg:104,oth:1,buf:51)
[2021-06-08 17:55:19.439][Trace][9615][16y1uv31] RTC: Server conns=1, rpkts=(89,rtp:86,stun:1,rtcp:1), spkts=(12,rtp:0,stun:1,rtcp:22), rtcp=(pli:1,twcc:9,rr:1), snk=(47,a:0,v:47,h:1), fid=(id:0,fid:0,ffid:89,addr:1,faddr:89)
[2021-06-08 17:55:19.518][Trace][9615][23q83814] <- RTC RECV #10, udp 888, pps 52/88, schedule 888
[2021-06-08 17:55:19.754][Trace][9615][i128tn42] HTTP #0 127.0.0.1:52354 GET http://localhost:8080/live/show.flv, content-length=-1
[2021-06-08 17:55:19.754][Trace][9615][i128tn42] dispatch cached gop success. count=0, duration=9
[2021-06-08 17:55:19.754][Trace][9615][i128tn42] create consumer, active=1, queue_size=0.00, jitter=30000000
[2021-06-08 17:55:19.754][Trace][9615][i128tn42] set fd=11, SO_SNDBUF=146988=>87500, buffer=350ms
[2021-06-08 17:55:19.754][Trace][9615][i128tn42] FLV /live/show.flv, encoder=FLV, nodelay=0, mw_sleep=350ms, cache=0, msgs=128
[2021-06-08 17:55:19.754][Trace][9615][i128tn42] FLV: write header audio=0, video=1
[2021-06-08 17:55:20.031][Trace][9615][spx42895] 36B video sh,  codec(7, profile=Baseline, level=Other, 1728x1088, 0kbps, 0.0fps, 0.0s)
[2021-06-08 17:55:20.031][Trace][9615][spx42895] set ts=505698570, header=20615, lost=20616
[2021-06-08 17:55:24.439][Trace][9615][16y1uv31] Hybrid cpu=0.00%,0MB, cid=19,10, timer=59,4,20, clock=0,25,20,1,0,0,0,0,0, free=1, objs=(pkt:103,raw:7,fua:95,msg:104,oth:1,buf:51)
[2021-06-08 17:55:24.439][Trace][9615][16y1uv31] RTC: Server conns=1, rpkts=(89,rtp:86,stun:1,rtcp:1), spkts=(12,rtp:0,stun:1,rtcp:22), rtcp=(pli:1,twcc:9,rr:1), snk=(47,a:0,v:47,h:1), fid=(id:0,fid:0,ffid:89,addr:1,faddr:89)
[2021-06-08 17:55:24.523][Trace][9615][spx42895] NACK: update seq=20848, nack range [20844, 20848]
[2021-06-08 17:55:24.551][Trace][9615][spx42895] NACK: update seq=20871, nack range [20870, 20871]
[2021-06-08 17:55:26.050][Trace][9615][16y1uv31] RTC: Need PLI ssrc=3968468662, play=[16y1uv31], publish=[spx42895], count=3/3
[2021-06-08 17:55:26.050][Trace][9615][spx42895] RTC: Request PLI ssrc=3968468662, play=[16y1uv31], count=3/3, bytes=12B
[2021-06-08 17:55:26.072][Trace][9615][spx42895] 36B video sh,  codec(7, profile=Baseline, level=Other, 1728x1088, 0kbps, 0.0fps, 0.0s)
[2021-06-08 17:55:26.072][Trace][9615][spx42895] set ts=506242350, header=20916, lost=20917
[2021-06-08 17:55:28.543][Trace][9615][spx42895] NACK: update seq=21120, nack range [21117, 21120]
^C[2021-06-08 17:55:29.268][Trace][9615][68364m49] sig=2, user terminate program, fast quit
[2021-06-08 17:55:29.440][Trace][9615][16y1uv31] Hybrid cpu=0.00%,0MB, cid=2,1, timer=59,10,46, clock=0,20,25,1,0,0,0,0,0, objs=(pkt:110,raw:62,fua:47,msg:157,oth:1,buf:55)
[2021-06-08 17:55:29.440][Trace][9615][16y1uv31] RTC: Server conns=1, rpkts=(89,rtp:86,stun:1,rtcp:1), spkts=(12,rtp:0,stun:1,rtcp:22), rtcp=(pli:1,twcc:9,rr:1), snk=(47,a:0,v:47,h:1), fid=(id:0,fid:0,ffid:89,addr:1,faddr:89)
[2021-06-08 17:55:29.475][Trace][9615][68364m49] cleanup for quit signal fast=1, grace=0
  1. SRS configuration is as follows:
listen              1935;
max_connections     1000;
daemon              off;
srs_log_tank        console;

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/wiki/v4_CN_RTCWiki#config-candidate
    candidate $CANDIDATE;
}

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

It is the default rtc2rtmp.conf.

Replay

How to replay bug?

Steps to reproduce the bug

Steps to replay the bug:

  1. Start SRS: ./objs/srs -c conf/rtc2rtmp.conf
  2. Modify line 50 in /path/to/srs/trunk/objs/nginx/html/players/js/srs.sdk.js from navigator.mediaDevices.getUserMedia to navigator.mediaDevices.getDisplayMedia
  3. Access http://localhost:8080/players/rtc_publisher.html?autostart=true to perform RTC screen sharing streaming
  4. Access http://localhost:8080/players/srs_player.html?autostart=true to view the FLV stream video. After watching for a while, an error occurs.
    image

Expected behavior (Expect)

> Hope that getDisplayMedia can work properly like getUserMedia.

TRANS_BY_GPT3

@bywwcnll
Copy link
Author

bywwcnll commented Jun 9, 2021

After testing, it was found that disabling the twcc function of rtc resolved the issue. I hope the experts can pay attention to it.
image

TRANS_BY_GPT3

@winlinvip winlinvip added the WebRTC WebRTC, RTC2RTMP or RTMP2RTC. label Jun 16, 2021
@duiniuluantanqin
Copy link
Member

duiniuluantanqin commented Jul 5, 2021

Verified, Chrome does indeed have this issue. But Firefox runs well.

TRANS_BY_GPT3

@duiniuluantanqin
Copy link
Member

#2461 (comment)

winlinvip pushed a commit that referenced this issue Jul 8, 2021
Calculate the correct payload_size which pure padding data, in the process of rtc2rtmp, make Chrome happy (#2461)

* Calculate the correct payload_size which pure padding data, in the process of rtc2rtmp, make Chrome happy

* make clear for magic number

make clear for magic number

* Update srs_app_rtc_source.cpp
@bywwcnll
Copy link
Author

bywwcnll commented Jul 9, 2021

Verified

TRANS_BY_GPT3

@bywwcnll bywwcnll closed this as completed Jul 9, 2021
@winlinvip winlinvip added this to the 4.0 milestone Sep 4, 2021
@winlinvip winlinvip changed the title 使用rtc2rtmp时,用getDisplayMedia推流,播放flv出错 When using rtc2rtmp, an error occurs when streaming with getDisplayMedia and playing flv. Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TransByAI Translated by AI/GPT. WebRTC WebRTC, RTC2RTMP or RTMP2RTC.
Projects
None yet
3 participants