mirror of
https://github.com/badaix/snapcast.git
synced 2025-07-30 14:49:58 +02:00
timeMsg
git-svn-id: svn://elaine/murooma/trunk@260 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
parent
52d0949327
commit
9b14d861f3
3 changed files with 22 additions and 1 deletions
|
@ -97,6 +97,7 @@ void Controller::worker()
|
|||
Player player(stream);
|
||||
player.start();
|
||||
|
||||
DoubleBuffer<long> timeBuffer(100);
|
||||
while (active_)
|
||||
{
|
||||
usleep(1000000);//1000000);
|
||||
|
@ -114,6 +115,8 @@ void Controller::worker()
|
|||
timeMsg.deserialize(*reply->response, reply->buffer);
|
||||
long latency = (timeMsg.received.sec - timeMsg.sent.sec) * 1000000 + (timeMsg.received.usec - timeMsg.sent.usec);
|
||||
cout << "C2S: " << timeMsg.latency << ", S2C: " << latency << ", diff: " << (timeMsg.latency - latency) / 2 << endl;
|
||||
timeBuffer.add((timeMsg.latency - latency) / 2);
|
||||
cout << timeBuffer.median() << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue