magic numbers
This commit is contained in:
parent
bbe3ac66e3
commit
7de15bf444
@ -101,10 +101,10 @@ namespace NadekoBot.Services.Music
|
||||
// i don't want to spam connection attempts
|
||||
continue;
|
||||
}
|
||||
var pcm = ac.CreatePCMStream(AudioApplication.Music, bufferMillis: 250);
|
||||
var pcm = ac.CreatePCMStream(AudioApplication.Music, bufferMillis: 1000);
|
||||
OnStarted?.Invoke(this, data.Song);
|
||||
|
||||
byte[] buffer = new byte[3840];
|
||||
byte[] buffer = new byte[38400];
|
||||
int bytesRead = 0;
|
||||
try
|
||||
{
|
||||
|
@ -43,17 +43,17 @@ namespace NadekoBot.Services.Music
|
||||
while (!cancelToken.IsCancellationRequested)
|
||||
{
|
||||
var toRead = buffer.Length;
|
||||
var remCap = _outStream.RemainingCapacity;
|
||||
if (remCap < readSize)
|
||||
{
|
||||
if (_outStream.RemainingCapacity == 0)
|
||||
{
|
||||
Console.WriteLine("Buffer full, not gonnna read from ffmpeg");
|
||||
await Task.Delay(20);
|
||||
continue;
|
||||
}
|
||||
toRead = remCap;
|
||||
}
|
||||
//var remCap = _outStream.RemainingCapacity;
|
||||
//if (remCap < readSize)
|
||||
//{
|
||||
// if (_outStream.RemainingCapacity == 0)
|
||||
// {
|
||||
// Console.WriteLine("Buffer full, not gonnna read from ffmpeg");
|
||||
// await Task.Delay(20);
|
||||
// continue;
|
||||
// }
|
||||
// toRead = remCap;
|
||||
//}
|
||||
|
||||
int bytesRead = await p.StandardOutput.BaseStream.ReadAsync(buffer, 0, toRead, cancelToken).ConfigureAwait(false);
|
||||
if (bytesRead == 0)
|
||||
@ -88,6 +88,7 @@ namespace NadekoBot.Services.Music
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Console.WriteLine("DISPOSING");
|
||||
try { this.p.Kill(); }
|
||||
catch { }
|
||||
_outStream.Dispose();
|
||||
|
Loading…
Reference in New Issue
Block a user