Skip to content

Compile SRS source code, DJI M30 drone RTMP streaming, service code error causing server crash. #3241

@Lichu520

Description

@Lichu520

The problems I encountered

1. The problem I encountered:

According to the SRS official website documentation, I followed the steps to compile WebRTC for Live Streaming and successfully deployed the SRS live streaming service. I used the DJI M30 drone for RTMP streaming and conducted several tests. After reinstalling SRS multiple times on multiple servers, I noticed that a few seconds or minutes after starting the streaming, the console would display the following error: "srs: src/kernel/srs_kernel_buffer.cpp:96: void SrsBuffer::skip(int): Assertion `p + size <= bytes + nb_bytes' failed." This error caused the SRS service to crash immediately.

2. In this situation, I have also tried using the EasyRTMP mobile application for streaming, and the live streaming service worked fine. I have also deployed it using Docker, and when streaming with the DJI M30 drone, everything worked fine as well. The error only occurs when using the compiled source code.

3. I have also tried directly editing line 96 of the srs_kernel_buffer.cpp file by commenting out that line of code, but the console still throws the same error.

二、SRS Version (版本): v4.0.76

1. SRS Log (日志):

[root@192-168-199-26 trunk]# ./objs/srs -c conf/rtmp2rtc.conf
[2022-11-16 02:58:09.629][Trace][20084][15615u1e] XCORE-SRS/4.0.267(Leo)
[2022-11-16 02:58:09.630][Trace][20084][15615u1e] config parse complete
[2022-11-16 02:58:09.630][Trace][20084][15615u1e] write log to console
[2022-11-16 02:58:09.631][Trace][20084][15615u1e][MAIN] SRS/4.0.267(Leo), MIT
[2022-11-16 02:58:09.631][Trace][20084][15615u1e] authors: 
[2022-11-16 02:59:29.631][Trace][20084][l194666h] Hybrid cpu=3.00%,13MB, cid=2,6, timer=62,0,97, clock=0,42,6,0,0,0,0,0,0, objs=(pkt:163,raw:51,fua:110,msg:291,oth:2,buf:1)
[2022-11-16 02:59:29.631][Trace][20084][l194666h] RTC: Server conns=2, rpkts=(6,rtp:0,stun:1,rtcp:5), spkts=(82,rtp:81,stun:1,rtcp:0), fid=(id:0,fid:6,ffid:0,addr:1,faddr:6)
[2022-11-16 02:59:29.702][Trace][20084][m61075t8] 39B video sh,  codec(7, profile=High, level=3.1, 1280x720, 0kbps, 0.0fps, 0.0s)
[2022-11-16 02:59:30.670][Trace][20084][m61075t8] 39B video sh,  codec(7, profile=High, level=3.1, 1280x720, 0kbps, 0.0fps, 0.0s)
[2022-11-16 02:59:30.861][Trace][20084][034175q7] <- RTC RECV #10, udp 63, pps 5/6, schedule 63
[2022-11-16 02:59:31.677][Trace][20084][m61075t8] 39B video sh,  codec(7, profile=High, level=3.1, 1280x720, 0kbps, 0.0fps, 0.0s)
[2022-11-16 02:59:32.708][Trace][20084][m61075t8] 39B video sh,  codec(7, profile=High, level=3.1, 1280x720, 0kbps, 0.0fps, 0.0s)
[2022-11-16 02:59:32.986][Trace][20084][m61075t8] <- CPB time=70002626, okbps=0,0,0, ikbps=579,573,0, mr=0/350, p1stpt=20000, pnt=5000
[2022-11-16 02:59:33.702][Trace][20084][m61075t8] 39B video sh,  codec(7, profile=High, level=3.1, 1280x720, 0kbps, 0.0fps, 0.0s)
[2022-11-16 02:59:34.631][Trace][20084][l194666h] Hybrid cpu=3.00%,13MB, cid=2,6, timer=62,0,97, clock=0,42,6,0,0,0,0,0,0, objs=(pkt:163,raw:51,fua:110,msg:291,oth:2,buf:1)
[2022-11-16 02:59:34.631][Trace][20084][l194666h] RTC: Server conns=2, rpkts=(6,rtp:0,stun:1,rtcp:5), spkts=(82,rtp:81,stun:1,rtcp:0), fid=(id:0,fid:6,ffid:0,addr:1,faddr:6)
[2022-11-16 02:59:34.704][Trace][20084][m61075t8] 39B video sh,  codec(7, profile=High, level=3.1, 1280x720, 0kbps, 0.0fps, 0.0s)
[2022-11-16 02:59:35.704][Trace][20084][m61075t8] 39B video sh,  codec(7, profile=High, level=3.1, 1280x720, 0kbps, 0.0fps, 0.0s)
[2022-11-16 02:59:36.705][Trace][20084][m61075t8] 39B video sh,  codec(7, profile=High, level=3.1, 1280x720, 0kbps, 0.0fps, 0.0s)
[2022-11-16 02:59:37.708][Trace][20084][m61075t8] 39B video sh,  codec(7, profile=High, level=3.1, 1280x720, 0kbps, 0.0fps, 0.0s)
srs: src/kernel/srs_kernel_buffer.cpp:96: void SrsBuffer::skip(int): Assertion `p + size <= bytes + nb_bytes' failed.
**已放弃 (吐核):**

1. SRS Config (配置):


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 8000; # UDP port
    # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
    candidate 192.168.199.26;
}

vhost __defaultVhost__ {
    rtc {
        enabled     on;
        # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
        rtmp_to_rtc on;
        # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
        rtc_to_rtmp on;
    }
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
    }
    dvr {
        enabled             on;
        dvr_path            /usr/local/dvr_srs/[app]/[stream]/video.mp4;
        dvr_plan            session;
   }
}

Replay (重现)

Please describe how to replay the bug? (重现Bug的步骤)

  1. Deploy the SRS service using the steps for compiling from source code and ensure successful startup.
  2. You will need a DJI M30 drone. Follow the DJI developer's cloud API tutorial at https://developer.dji.com/doc/cloud-api-tutorial/en/quick-start/source-code-deployment-steps.html to deploy the DJI airport demo project, as shown in the image.
    image
    `
  3. Using the functionality shown in the image, push the drone's video stream to the DJI airport demo project. Within a few minutes, the SRS service will throw the error I encountered, and then the SRS service will crash.

Expect (Expected Behavior)

Please describe your expectation.
I have read all the official documentation of SRS, watched relevant videos on Bilibili, and checked the issues on GitHub for other students' questions (only found one similar question but did not see a solution). I have also searched for how others use SRS on the internet but couldn't find a solution. I hope that after the experts see this, they can give me a little reply to guide me. Thank you!

TRANS_BY_GPT3

Metadata

Metadata

Labels

EnhancementImprovement or enhancement.TransByAITranslated by AI/GPT.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions