winlin

time jitter detect and correct, very simple algorithm

@@ -68,11 +68,14 @@ int SrsConsumer::enqueue(SrsSharedPtrMessage* msg) @@ -68,11 +68,14 @@ int SrsConsumer::enqueue(SrsSharedPtrMessage* msg)
68 int ret = ERROR_SUCCESS; 68 int ret = ERROR_SUCCESS;
69 69
70 /** 70 /**
71 - * we use a very simple time jitter detect/correct algorithm,  
72 - * if the delta of time is nagative or greater than CONST_MAX_JITTER_MS,  
73 - * we enforce the delta to DEFAULT_FRAME_TIME_MS,  
74 - * and update the last_pkt_time which used to detect next jitter.  
75 - * the last_pkt_correct_time is enforce the time monotonically. 71 + * we use a very simple time jitter detect/correct algorithm:
  72 + * 1. delta: ensure the delta is positive and valid,
  73 + * we set the delta to DEFAULT_FRAME_TIME_MS,
  74 + * if the delta of time is nagative or greater than CONST_MAX_JITTER_MS.
  75 + * 2. last_pkt_time: specifies the original packet time,
  76 + * is used to detect next jitter.
  77 + * 3. last_pkt_correct_time: simply add the positive delta,
  78 + * and enforce the time monotonically.
76 */ 79 */
77 int32_t time = msg->header.timestamp; 80 int32_t time = msg->header.timestamp;
78 int32_t delta = time - last_pkt_time; 81 int32_t delta = time - last_pkt_time;