Skip to content

Commit

Permalink
Revert "flv-demuxer: Drop tags which have timestamps smaller than pre…
Browse files Browse the repository at this point in the history
…vious same type tag"

This reverts commit 58792a0.
  • Loading branch information
xqq committed Sep 13, 2021
1 parent 46fd879 commit 705a72b
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions src/demux/flv-demuxer.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ class FLVDemuxer {
this._audioMetadata = null;
this._videoMetadata = null;

this._prevVideoTagTimestamp = 0;
this._prevAudioTagTimestamp = 0;

this._naluLengthSize = 4;
this._timestampBase = 0; // int32, in milliseconds
this._timescale = 1000;
Expand Down Expand Up @@ -125,9 +122,6 @@ class FLVDemuxer {
this._videoTrack = null;
this._audioTrack = null;

this._prevVideoTagTimestamp = 0;
this._prevAudioTagTimestamp = 0;

this._onError = null;
this._onMediaInfo = null;
this._onMetaDataArrived = null;
Expand Down Expand Up @@ -334,15 +328,6 @@ class FLVDemuxer {

let timestamp = ts0 | (ts1 << 8) | (ts2 << 16) | (ts3 << 24);

if (tagType === 8 && timestamp < this._prevAudioTagTimestamp ||
tagType === 9 && timestamp < this._prevVideoTagTimestamp) {
let prevTimestamp = (tagType === 8) ? this._prevAudioTagTimestamp : this._prevVideoTagTimestamp;
Log.w(this.TAG, `Tag timestamp ${timestamp} is smaller than previous tag timestamp ${prevTimestamp}, skipped`);
// consume the whole tag (skip it)
offset += 11 + dataSize + 4;
continue;
}

let streamId = v.getUint32(7, !le) & 0x00FFFFFF;
if (streamId !== 0) {
Log.w(this.TAG, 'Meet tag which has StreamID != 0!');
Expand All @@ -352,11 +337,9 @@ class FLVDemuxer {

switch (tagType) {
case 8: // Audio
this._prevAudioTagTimestamp = timestamp;
this._parseAudioData(chunk, dataOffset, dataSize, timestamp);
break;
case 9: // Video
this._prevVideoTagTimestamp = timestamp;
this._parseVideoData(chunk, dataOffset, dataSize, timestamp, byteStart + offset);
break;
case 18: // ScriptDataObject
Expand Down

0 comments on commit 705a72b

Please sign in to comment.