mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-19 12:06:15 +02:00
Do fewer playback speed adaptions
This commit is contained in:
parent
4d4270dad5
commit
d1b4acbfc4
1 changed files with 5 additions and 6 deletions
|
@ -163,9 +163,8 @@ cs::time_point_clk Stream::getNextPlayerChunk(void* outputBuffer, const cs::usec
|
||||||
char* buffer = (char*)malloc(toRead * format_.frameSize);
|
char* buffer = (char*)malloc(toRead * format_.frameSize);
|
||||||
cs::time_point_clk tp = getNextPlayerChunk(buffer, timeout, toRead);
|
cs::time_point_clk tp = getNextPlayerChunk(buffer, timeout, toRead);
|
||||||
|
|
||||||
// float factor = (float)toRead / framesPerBuffer;
|
// if (abs(framesCorrection) > 0)
|
||||||
// if (abs(framesCorrection) > 1)
|
// LOG(DEBUG) << "getNextPlayerChunk, frames: " << framesPerBuffer << ", correction: " << framesCorrection << " (" << toRead << ")\n";
|
||||||
// LOG(INFO) << "correction: " << framesCorrection << ", factor: " << factor << "\n";
|
|
||||||
|
|
||||||
size_t slices = (abs(framesCorrection) + 1);
|
size_t slices = (abs(framesCorrection) + 1);
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
|
@ -361,7 +360,7 @@ bool Stream::getPlayerChunk(void* outputBuffer, const cs::usec& outputBufferDacT
|
||||||
if ((correctAfterXFrames_ != 0) && (playedFrames_ >= (unsigned long)abs(correctAfterXFrames_)))
|
if ((correctAfterXFrames_ != 0) && (playedFrames_ >= (unsigned long)abs(correctAfterXFrames_)))
|
||||||
{
|
{
|
||||||
framesCorrection += (correctAfterXFrames_ > 0) ? 1 : -1;
|
framesCorrection += (correctAfterXFrames_ > 0) ? 1 : -1;
|
||||||
playedFrames_ -= abs(correctAfterXFrames_);
|
playedFrames_ = 0; //-= abs(correctAfterXFrames_);
|
||||||
}
|
}
|
||||||
|
|
||||||
age = std::chrono::duration_cast<cs::usec>(TimeProvider::serverNow() -
|
age = std::chrono::duration_cast<cs::usec>(TimeProvider::serverNow() -
|
||||||
|
@ -373,9 +372,9 @@ bool Stream::getPlayerChunk(void* outputBuffer, const cs::usec& outputBufferDacT
|
||||||
{
|
{
|
||||||
if (buffer_.full())
|
if (buffer_.full())
|
||||||
{
|
{
|
||||||
if (cs::usec(abs(median_)) > cs::msec(1))
|
if (cs::usec(abs(median_)) > cs::msec(2))
|
||||||
{
|
{
|
||||||
LOG(INFO) << "pBuffer->full() && (abs(median_) > 1): " << median_ << "\n";
|
LOG(INFO) << "pBuffer->full() && (abs(median_) > 2): " << median_ << "\n";
|
||||||
sleep_ = cs::usec(median_);
|
sleep_ = cs::usec(median_);
|
||||||
}
|
}
|
||||||
// else if (cs::usec(median_) > cs::usec(300))
|
// else if (cs::usec(median_) > cs::usec(300))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue