mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-26 05:02:36 +01:00
Improve TS read performance slightly
This commit is contained in:
parent
8dba59e913
commit
9bf5dd71ae
@ -55,7 +55,6 @@ namespace Nikse.SubtitleEdit.Core.TransportStream
|
|||||||
var packetBuffer = new byte[packetLength];
|
var packetBuffer = new byte[packetLength];
|
||||||
var m2TsTimeCodeBuffer = new byte[4];
|
var m2TsTimeCodeBuffer = new byte[4];
|
||||||
long position = 0;
|
long position = 0;
|
||||||
long callBackTicks = 0;
|
|
||||||
SubtitlesLookup = new Dictionary<int, List<DvbSubPes>>();
|
SubtitlesLookup = new Dictionary<int, List<DvbSubPes>>();
|
||||||
|
|
||||||
// check for Topfield .rec file
|
// check for Topfield .rec file
|
||||||
@ -169,10 +168,9 @@ namespace Nikse.SubtitleEdit.Core.TransportStream
|
|||||||
TotalNumberOfPackets++;
|
TotalNumberOfPackets++;
|
||||||
position += packetLength;
|
position += packetLength;
|
||||||
|
|
||||||
if (callback != null && DateTime.UtcNow.Ticks - 10000 * 500 > callBackTicks) // call back every half second
|
if (TotalNumberOfPackets % 100000 == 0)
|
||||||
{
|
{
|
||||||
callback.Invoke(ms.Position, transportStreamLength);
|
callback.Invoke(ms.Position, transportStreamLength);
|
||||||
callBackTicks = DateTime.UtcNow.Ticks;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user