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