winlin

fix time jitter zero algorithm bug, reset when timestamp overflow.

@@ -69,25 +69,32 @@ int SrsRtmpJitter::correct(SrsSharedPtrMessage* msg, int tba, int tbv, SrsRtmpJi @@ -69,25 +69,32 @@ int SrsRtmpJitter::correct(SrsSharedPtrMessage* msg, int tba, int tbv, SrsRtmpJi
69 { 69 {
70 int ret = ERROR_SUCCESS; 70 int ret = ERROR_SUCCESS;
71 71
  72 + // for performance issue
  73 + if (ag != SrsRtmpJitterAlgorithmFULL) {
72 // all jitter correct features is disabled, ignore. 74 // all jitter correct features is disabled, ignore.
73 if (ag == SrsRtmpJitterAlgorithmOFF) { 75 if (ag == SrsRtmpJitterAlgorithmOFF) {
74 return ret; 76 return ret;
75 } 77 }
76 78
77 -  
78 // start at zero, but donot ensure monotonically increasing. 79 // start at zero, but donot ensure monotonically increasing.
79 if (ag == SrsRtmpJitterAlgorithmZERO) { 80 if (ag == SrsRtmpJitterAlgorithmZERO) {
80 - if (last_pkt_correct_time <= 0) { 81 + // for the first time, last_pkt_correct_time is zero.
  82 + // while when timestamp overflow, the timestamp become smaller, reset the last_pkt_correct_time.
  83 + if (last_pkt_correct_time <= 0 || last_pkt_correct_time > msg->header.timestamp) {
81 last_pkt_correct_time = msg->header.timestamp; 84 last_pkt_correct_time = msg->header.timestamp;
82 } 85 }
83 msg->header.timestamp -= last_pkt_correct_time; 86 msg->header.timestamp -= last_pkt_correct_time;
84 return ret; 87 return ret;
85 } 88 }
86 89
  90 + // other algorithm, ignore.
  91 + return ret;
  92 + }
  93 +
87 // full jitter algorithm, do jitter correct. 94 // full jitter algorithm, do jitter correct.
88 95
89 // set to 0 for metadata. 96 // set to 0 for metadata.
90 - if (!msg->header.is_video() && !msg->header.is_audio()) { 97 + if (!msg->header.is_audio() && !msg->header.is_video()) {
91 msg->header.timestamp = 0; 98 msg->header.timestamp = 0;
92 return ret; 99 return ret;
93 } 100 }
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR "0" 32 #define VERSION_MAJOR "0"
33 #define VERSION_MINOR "9" 33 #define VERSION_MINOR "9"
34 -#define VERSION_REVISION "133" 34 +#define VERSION_REVISION "134"
35 #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION 35 #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
36 // server info. 36 // server info.
37 #define RTMP_SIG_SRS_KEY "SRS" 37 #define RTMP_SIG_SRS_KEY "SRS"