mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
time jitter detect and correct, very simple algorithm
This commit is contained in:
parent
e31e3d601d
commit
b40d0467a8
1 changed files with 8 additions and 5 deletions
|
@ -68,11 +68,14 @@ int SrsConsumer::enqueue(SrsSharedPtrMessage* msg)
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* we use a very simple time jitter detect/correct algorithm,
|
* we use a very simple time jitter detect/correct algorithm:
|
||||||
* if the delta of time is nagative or greater than CONST_MAX_JITTER_MS,
|
* 1. delta: ensure the delta is positive and valid,
|
||||||
* we enforce the delta to DEFAULT_FRAME_TIME_MS,
|
* we set the delta to DEFAULT_FRAME_TIME_MS,
|
||||||
* and update the last_pkt_time which used to detect next jitter.
|
* if the delta of time is nagative or greater than CONST_MAX_JITTER_MS.
|
||||||
* the last_pkt_correct_time is enforce the time monotonically.
|
* 2. last_pkt_time: specifies the original packet time,
|
||||||
|
* is used to detect next jitter.
|
||||||
|
* 3. last_pkt_correct_time: simply add the positive delta,
|
||||||
|
* and enforce the time monotonically.
|
||||||
*/
|
*/
|
||||||
int32_t time = msg->header.timestamp;
|
int32_t time = msg->header.timestamp;
|
||||||
int32_t delta = time - last_pkt_time;
|
int32_t delta = time - last_pkt_time;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue