mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-11-15 19:22:19 +08:00
fix(flv): relax timestamp jump detection threshold
This commit is contained in:
parent
8e7b0946c3
commit
d2440d1199
|
@ -14,7 +14,7 @@ namespace BililiveRecorder.Flv.Pipeline.Rules
|
|||
{
|
||||
private const string TS_STORE_KEY = "Timestamp_Store_Key";
|
||||
|
||||
private const int JUMP_THRESHOLD = 50;
|
||||
private const int JUMP_THRESHOLD = 500;
|
||||
|
||||
private const int AUDIO_DURATION_FALLBACK = 22;
|
||||
private const int AUDIO_DURATION_MIN = 20;
|
||||
|
@ -40,7 +40,7 @@ namespace BililiveRecorder.Flv.Pipeline.Rules
|
|||
var tags = dataAction.Tags;
|
||||
var currentTimestamp = tags[0].Timestamp;
|
||||
|
||||
bool isFirstChunk = ts.FirstChunk;
|
||||
var isFirstChunk = ts.FirstChunk;
|
||||
if (isFirstChunk)
|
||||
{
|
||||
// 第一段数据使用最小的时间戳作为基础偏移量
|
||||
|
@ -75,7 +75,7 @@ namespace BililiveRecorder.Flv.Pipeline.Rules
|
|||
{
|
||||
var tag = endAction.Tag;
|
||||
var diff = tag.Timestamp - ts.LastOriginal;
|
||||
if (diff < 0 || diff > JUMP_THRESHOLD)
|
||||
if (diff is < 0 or > JUMP_THRESHOLD)
|
||||
{
|
||||
tag.Timestamp = ts.NextTimestampTarget;
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace BililiveRecorder.Flv.Tests.RuleTests
|
|||
var originalTags = SampleFileLoader.LoadXmlFlv(path).Tags;
|
||||
|
||||
var random = new System.Random();
|
||||
var offset = random.Next(51, 9999);
|
||||
var offset = random.Next(501, 9999);
|
||||
if (random.Next(2) == 1)
|
||||
offset = -offset;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user