Skip to content

Commit

Permalink
Fix packet timestamps running backwards
Browse files Browse the repository at this point in the history
This fixes bitrate measuring in some cases
  • Loading branch information
UniqProject committed Jan 21, 2023
1 parent 61cc6c5 commit 72e16a0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion BDInfo/BDROM/TSStreamFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1438,7 +1438,10 @@ public void Scan(List<TSPlaylistFile> playlists, bool isFullScan)
streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xff);
#endif
streamState.PTSDiff = streamState.DTSTemp - streamState.DTSPrev;
if (streamState.DTSPrev < streamState.DTSTemp)
streamState.PTSDiff = streamState.DTSTemp - streamState.DTSPrev;
else
streamState.PTSDiff = 0;

if (streamState.PTSCount > 0 &&
stream.IsVideoStream)
Expand Down

0 comments on commit 72e16a0

Please sign in to comment.