Tweaked buffer/player timings to prevent delays, almost-working smooth support.

This commit is contained in:
Thulinma 2013-07-24 13:25:38 +02:00
parent 4d3a500e66
commit 25c7f6f93d
3 changed files with 45 additions and 7 deletions

View file

@ -212,7 +212,10 @@ namespace Buffer {
}
while (buffer_running){
if (thisStream->getIPInput().connected()){
connected = true;
if (!connected){
connected = true;
thisStream->getIPInput().setBlocking(false);
}
if (thisStream->getIPInput().spool()){
while (true){
thisStream->getWriteLock();
@ -225,12 +228,12 @@ namespace Buffer {
thisStream->dropWriteLock(true);
}else{
thisStream->dropWriteLock(false);
Util::sleep(25); //10ms wait
//Util::sleep(10); //10ms wait
break;
}
}
}else{
Util::sleep(1000); //10ms wait
//}else{
//Util::sleep(500); //500ms wait
}
}else{
if (connected){

View file

@ -239,8 +239,8 @@ int main(int argc, char** argv){
if (lastTime == 0){
lastTime = now - source.getJSON()["time"].asInt();
}
if (playing == -1 && playUntil == 0 && source.getJSON()["time"].asInt() > now - lastTime + 1000){
Util::sleep(source.getJSON()["time"].asInt() - (now - lastTime));
if (playing == -1 && playUntil == 0 && source.getJSON()["time"].asInt() > now - lastTime + 7500){
Util::sleep(source.getJSON()["time"].asInt() - (now - lastTime + 5000));
}
if ( playUntil && playUntil < source.getJSON()["time"].asInt()){
playing = 0;