resetting buffer?
This commit is contained in:
parent
c6af3a6c3e
commit
1195a4c9c8
@ -31,7 +31,7 @@ namespace NadekoBot.Modules.Music.Classes
|
|||||||
public SongInfo SongInfo { get; }
|
public SongInfo SongInfo { get; }
|
||||||
public string QueuerName { get; set; }
|
public string QueuerName { get; set; }
|
||||||
|
|
||||||
private PoopyBuffer songBuffer { get; } = new PoopyBuffer(NadekoBot.Config.BufferSize);
|
private PoopyBuffer songBuffer { get; set; }
|
||||||
|
|
||||||
private bool prebufferingComplete { get; set; } = false;
|
private bool prebufferingComplete { get; set; } = false;
|
||||||
public MusicPlayer MusicPlayer { get; set; }
|
public MusicPlayer MusicPlayer { get; set; }
|
||||||
@ -137,6 +137,9 @@ namespace NadekoBot.Modules.Music.Classes
|
|||||||
|
|
||||||
internal async Task Play(IAudioClient voiceClient, CancellationToken cancelToken)
|
internal async Task Play(IAudioClient voiceClient, CancellationToken cancelToken)
|
||||||
{
|
{
|
||||||
|
// initialize the buffer here because if this song was playing before (requeued), we must delete old buffer data
|
||||||
|
songBuffer = new PoopyBuffer(NadekoBot.Config.BufferSize);
|
||||||
|
|
||||||
var bufferTask = BufferSong(cancelToken).ConfigureAwait(false);
|
var bufferTask = BufferSong(cancelToken).ConfigureAwait(false);
|
||||||
var bufferAttempts = 0;
|
var bufferAttempts = 0;
|
||||||
const int waitPerAttempt = 500;
|
const int waitPerAttempt = 500;
|
||||||
@ -145,7 +148,6 @@ namespace NadekoBot.Modules.Music.Classes
|
|||||||
{
|
{
|
||||||
await Task.Delay(waitPerAttempt, cancelToken).ConfigureAwait(false);
|
await Task.Delay(waitPerAttempt, cancelToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
cancelToken.ThrowIfCancellationRequested();
|
|
||||||
Console.WriteLine($"Prebuffering done? in {waitPerAttempt * bufferAttempts}");
|
Console.WriteLine($"Prebuffering done? in {waitPerAttempt * bufferAttempts}");
|
||||||
const int blockSize = 3840;
|
const int blockSize = 3840;
|
||||||
var attempt = 0;
|
var attempt = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user