Prebuffering time drastically decreased
This commit is contained in:
parent
a609e17717
commit
99049a6ace
@ -38,6 +38,11 @@ namespace NadekoBot.DataStructures
|
||||
}
|
||||
}
|
||||
|
||||
public int LightLength =>
|
||||
_readPos <= _writePos?
|
||||
_writePos - _readPos :
|
||||
Capacity - (_readPos - _writePos);
|
||||
|
||||
public int RemainingCapacity
|
||||
{
|
||||
get { lock (posLock) return Capacity - Length - 1; }
|
||||
|
@ -54,7 +54,7 @@ namespace NadekoBot.Services.Music
|
||||
bytesRead = await p.StandardOutput.BaseStream.ReadAsync(buffer, 0, readSize, cancelToken).ConfigureAwait(false);
|
||||
await _outStream.WriteAsync(buffer, 0, bytesRead, cancelToken);
|
||||
|
||||
if (_outStream.RemainingCapacity < _outStream.Capacity * 0.5f || bytesRead == 0)
|
||||
if (_outStream.LightLength > 200_000 || bytesRead == 0)
|
||||
if (toReturn.TrySetResult(true))
|
||||
_log.Info("Prebuffering finished");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user