Added max_lead_time variable to player process for better readability.
This commit is contained in:
parent
636cb51b05
commit
b95ec25255
1 changed files with 3 additions and 2 deletions
|
@ -116,6 +116,7 @@ int main(int argc, char** argv){
|
||||||
|
|
||||||
bool meta_sent = false;
|
bool meta_sent = false;
|
||||||
int playUntil = -1;
|
int playUntil = -1;
|
||||||
|
long long max_lead_time = 7500;//maximum time in ms that the player can be faster than real-time
|
||||||
long long now, prevTimestamp = 0; //for timing of sending packets
|
long long now, prevTimestamp = 0; //for timing of sending packets
|
||||||
std::set<int> newSelect;
|
std::set<int> newSelect;
|
||||||
Stats sts;
|
Stats sts;
|
||||||
|
@ -249,8 +250,8 @@ int main(int argc, char** argv){
|
||||||
if (prevTimestamp == 0){
|
if (prevTimestamp == 0){
|
||||||
prevTimestamp = now - source.getJSON()["time"].asInt();
|
prevTimestamp = now - source.getJSON()["time"].asInt();
|
||||||
}
|
}
|
||||||
if (playing == -1 && playUntil == 0 && source.getJSON()["time"].asInt() > now - prevTimestamp + 7500){
|
if (playing == -1 && playUntil == 0 && source.getJSON()["time"].asInt() > now - prevTimestamp + max_lead_time){
|
||||||
Util::sleep(source.getJSON()["time"].asInt() - (now - prevTimestamp + 5000));
|
Util::sleep(source.getJSON()["time"].asInt() - (now - prevTimestamp + max_lead_time));
|
||||||
}
|
}
|
||||||
if ( playUntil && playUntil <= source.getJSON()["time"].asInt()){
|
if ( playUntil && playUntil <= source.getJSON()["time"].asInt()){
|
||||||
playing = 0;
|
playing = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue