File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ class FLVDemuxer {
79
79
80
80
this . _naluLengthSize = 4 ;
81
81
this . _timestampBase = 0 ; // int32, in milliseconds
82
+ this . _lastTimestamp = 0 ;
82
83
this . _timescale = 1000 ;
83
84
this . _duration = 0 ; // int32, in milliseconds
84
85
this . _durationOverrided = false ;
@@ -121,6 +122,7 @@ class FLVDemuxer {
121
122
this . _videoMetadata = null ;
122
123
this . _videoTrack = null ;
123
124
this . _audioTrack = null ;
125
+ this . _lastTimestamp = 0 ;
124
126
125
127
this . _onError = null ;
126
128
this . _onMediaInfo = null ;
@@ -328,6 +330,14 @@ class FLVDemuxer {
328
330
329
331
let timestamp = ts0 | ( ts1 << 8 ) | ( ts2 << 16 ) | ( ts3 << 24 ) ;
330
332
333
+ if ( timestamp < this . _lastTimestamp ) {
334
+ Log . w ( this . TAG , `Current tag's timestamp(${ timestamp } ) is smaller than last timestamp(${ this . _lastTimestamp } ), skipped` ) ;
335
+ // consume the whole tag (skip it)
336
+ offset += 11 + dataSize + 4 ;
337
+ continue ;
338
+ }
339
+ this . _lastTimestamp = timestamp ;
340
+
331
341
let streamId = v . getUint32 ( 7 , ! le ) & 0x00FFFFFF ;
332
342
if ( streamId !== 0 ) {
333
343
Log . w ( this . TAG , 'Meet tag which has StreamID != 0!' ) ;
You can’t perform that action at this time.
0 commit comments