magic numbers

This commit is contained in:
Master Kwoth 2017-07-02 10:58:04 +02:00
parent bbe3ac66e3
commit 7de15bf444
2 changed files with 14 additions and 13 deletions

View File

@ -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
{

View File

@ -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();