From 9bf5dd71ae2888a0ce3ccc5cabf18d13009ca050 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Mon, 21 Oct 2019 18:14:07 +0200 Subject: [PATCH] Improve TS read performance slightly --- libse/TransportStream/TransportStreamParser.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libse/TransportStream/TransportStreamParser.cs b/libse/TransportStream/TransportStreamParser.cs index b2781b75a..38f5fa09b 100644 --- a/libse/TransportStream/TransportStreamParser.cs +++ b/libse/TransportStream/TransportStreamParser.cs @@ -55,7 +55,6 @@ namespace Nikse.SubtitleEdit.Core.TransportStream var packetBuffer = new byte[packetLength]; var m2TsTimeCodeBuffer = new byte[4]; long position = 0; - long callBackTicks = 0; SubtitlesLookup = new Dictionary>(); // check for Topfield .rec file @@ -169,10 +168,9 @@ namespace Nikse.SubtitleEdit.Core.TransportStream TotalNumberOfPackets++; 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); - callBackTicks = DateTime.UtcNow.Ticks; } } else