mirror of
https://github.com/badaix/snapcast.git
synced 2025-07-29 14:28:42 +02:00
buffer size
git-svn-id: svn://elaine/murooma/trunk@20 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
parent
fcb2a40f87
commit
1087df7370
1 changed files with 6 additions and 2 deletions
|
@ -20,6 +20,7 @@
|
||||||
const size_t ms(50);
|
const size_t ms(50);
|
||||||
//44100 / 20 = 2205
|
//44100 / 20 = 2205
|
||||||
const size_t size(44100*4*ms/1000);
|
const size_t size(44100*4*ms/1000);
|
||||||
|
int bufferMs;
|
||||||
|
|
||||||
|
|
||||||
struct Chunk
|
struct Chunk
|
||||||
|
@ -93,11 +94,11 @@ void player()
|
||||||
|
|
||||||
if (playing)
|
if (playing)
|
||||||
{
|
{
|
||||||
int age = getAge(*chunk) - 300;
|
int age = getAge(*chunk) - bufferMs;
|
||||||
while (age < 0)
|
while (age < 0)
|
||||||
{
|
{
|
||||||
usleep((-age) * 1000/ 2);
|
usleep((-age) * 1000/ 2);
|
||||||
age = getAge(*chunk) - 300;
|
age = getAge(*chunk) - bufferMs;
|
||||||
}
|
}
|
||||||
std::cerr << "Playing: " << getAge(*chunk) << "\n";
|
std::cerr << "Playing: " << getAge(*chunk) << "\n";
|
||||||
|
|
||||||
|
@ -116,6 +117,9 @@ void player()
|
||||||
|
|
||||||
int main (int argc, char *argv[])
|
int main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
bufferMs = 300;
|
||||||
|
if (argc > 1)
|
||||||
|
bufferMs = atoi(argv[1]);
|
||||||
zmq::context_t context (1);
|
zmq::context_t context (1);
|
||||||
zmq::socket_t subscriber (context, ZMQ_SUB);
|
zmq::socket_t subscriber (context, ZMQ_SUB);
|
||||||
subscriber.connect("tcp://192.168.0.2:123458");
|
subscriber.connect("tcp://192.168.0.2:123458");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue