ossrs / srs

SRS is a simple, high-efficiency, real-time video server supporting RTMP, WebRTC, HLS, HTTP-FLV, SRT, MPEG-DASH, and GB28181.

Home Page:https://ossrs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When the FMS source station is on, the frame rate is incorrect, causing video stuttering and shaking.

winlinvip opened this issue · comments

Sometimes, the packages that come out of FMS have a timestamp of 0 in the gop cache at the beginning.

[2015-06-09 20:33:51.01] Video packet type=Video, dts=0, pts=0, diff=0, size=45, H.264(SH,I)
[2015-06-09 20:33:51.01] Audio packet type=Audio, dts=0, pts=0, diff=0, size=6, AAC(44KHz,16bit,Stereo,SH)
[2015-06-09 20:33:51.01] Rtmp packet type=Video, dts=0, diff=0, size=2, DecodeError
[2015-06-09 20:33:51.15] Video packet type=Video, dts=0, pts=80, diff=0, size=17044, H.264(Nalu,I)
[2015-06-09 20:33:51.15] Video packet type=Video, dts=0, pts=200, diff=0, size=4474, H.264(Nalu,P/B)
[2015-06-09 20:33:51.15] Video packet type=Video, dts=0, pts=80, diff=0, size=2045, H.264(Nalu,P/B)
[2015-06-09 20:33:51.15] Video packet type=Video, dts=0, pts=0, diff=0, size=1226, H.264(Nalu,P/B)
[2015-06-09 20:33:51.15] Video packet type=Video, dts=0, pts=40, diff=0, size=1476, H.264(Nalu,P/B)
[2015-06-09 20:33:51.19] Video packet type=Video, dts=0, pts=200, diff=0, size=3675, H.264(Nalu,P/B)
[2015-06-09 20:33:51.19] Video packet type=Video, dts=0, pts=80, diff=0, size=1741, H.264(Nalu,P/B)
[2015-06-09 20:33:51.19] Video packet type=Video, dts=0, pts=0, diff=0, size=1220, H.264(Nalu,P/B)
[2015-06-09 20:33:51.19] Video packet type=Video, dts=0, pts=40, diff=0, size=1210, H.264(Nalu,P/B)
[2015-06-09 20:33:51.19] Video packet type=Video, dts=0, pts=200, diff=0, size=3513, H.264(Nalu,P/B)
[2015-06-09 20:33:51.19] Video packet type=Video, dts=0, pts=80, diff=0, size=1617, H.264(Nalu,P/B)
[2015-06-09 20:33:51.19] Video packet type=Video, dts=0, pts=0, diff=0, size=1190, H.264(Nalu,P/B)
[2015-06-09 20:33:54.43] Video packet type=Video, dts=3, pts=83, diff=0, size=1866, H.264(Nalu,P/B)
[2015-06-09 20:33:54.75] Video packet type=Video, dts=43, pts=43, diff=40, size=1508, H.264(Nalu,P/B)
[2015-06-09 20:33:54.75] Audio packet type=Audio, dts=43, pts=43, diff=0, size=91, AAC(44KHz,16bit,Stereo,Raw)
[2015-06-09 20:33:54.79] Video packet type=Video, dts=83, pts=123, diff=40, size=1313, H.264(Nalu,P/B)

If the timestamp is corrected at this time, it will cause the first client to either fast forward or slow down the playback.

TRANS_BY_GPT3

The most appropriate approach is to not adjust the timestamp when it remains unchanged. Only when the timestamp jumps, should it be corrected.

TRANS_BY_GPT3

    // if jitter detected, reset the delta.
    if (delta < 0 || delta > CONST_MAX_JITTER_MS) {

The current algorithm is to detect negative values and jumps.

TRANS_BY_GPT3

The problem of SRS2 frame skipping is related to handling aggregate messages in FMS and the issue with negative delta value judgment.

TRANS_BY_GPT3