Dispose pcm

This commit is contained in:
Master Kwoth 2017-07-05 11:23:31 +02:00
parent b4cf9fee84
commit 54a91b4a79

View File

@ -180,7 +180,6 @@ namespace NadekoBot.Services.Music
// i don't want to spam connection attempts // i don't want to spam connection attempts
continue; continue;
} }
pcm = ac.CreatePCMStream(AudioApplication.Music, bufferMillis: 500);
OnStarted?.Invoke(this, data); OnStarted?.Invoke(this, data);
byte[] buffer = new byte[3840]; byte[] buffer = new byte[3840];
@ -215,6 +214,7 @@ namespace NadekoBot.Services.Music
var flushDelay = Task.Delay(1000, flushToken); var flushDelay = Task.Delay(1000, flushToken);
await Task.WhenAny(flushDelay, pcm.FlushAsync(flushToken)); await Task.WhenAny(flushDelay, pcm.FlushAsync(flushToken));
flushCancel.Cancel(); flushCancel.Cancel();
pcm.Dispose();
} }
OnCompleted?.Invoke(this, data.Song); OnCompleted?.Invoke(this, data.Song);