|
a/src/httpgate.cpp |
|
b/src/httpgate.cpp |
|
... |
|
... |
306 |
if (NULL == daemon) {
|
306 |
if (NULL == daemon) {
|
307 |
audioqueue.workerExit();
|
307 |
audioqueue.workerExit();
|
308 |
return (void *)0;
|
308 |
return (void *)0;
|
309 |
}
|
309 |
}
|
310 |
delete ctxt;
|
310 |
delete ctxt;
|
311 |
|
311 |
while (true) {
|
312 |
for (int seq=0;;seq++) {
|
|
|
313 |
AudioMessage *tsk = 0;
|
312 |
AudioMessage *tsk = 0;
|
314 |
size_t qsz;
|
313 |
size_t qsz;
|
315 |
if (!audioqueue.take(&tsk, &qsz)) {
|
314 |
if (!audioqueue.take(&tsk, &qsz)) {
|
316 |
MHD_stop_daemon (daemon);
|
315 |
MHD_stop_daemon (daemon);
|
317 |
audioqueue.workerExit();
|
316 |
audioqueue.workerExit();
|
318 |
return (void*)1;
|
317 |
return (void*)1;
|
319 |
}
|
318 |
}
|
320 |
#if 0
|
|
|
321 |
if (seq % 200 == 0) {
|
|
|
322 |
LOGDEB("audioEater: msg: " << tsk->m_bytes << " bytes " << endl);
|
|
|
323 |
}
|
|
|
324 |
#endif
|
|
|
325 |
PTMutexLocker lock(dataqueueLock);
|
319 |
PTMutexLocker lock(dataqueueLock);
|
326 |
/* limit size of queuing. If there is a client but it is not
|
320 |
/* limit size of queuing. If there is a client but it is not
|
327 |
eating blocks fast enough, there will be audio pops */
|
321 |
eating blocks fast enough, there will be audio pops */
|
328 |
while (dataqueue.size() > 2) {
|
322 |
while (dataqueue.size() > 2) {
|
329 |
//LOGINF("audioEater: discarding buffer !" << endl);
|
323 |
LOGDEB("audioEater: discarding buffer !" << endl);
|
330 |
delete dataqueue.front();
|
324 |
delete dataqueue.front();
|
331 |
dataqueue.pop();
|
325 |
dataqueue.pop();
|
332 |
}
|
326 |
}
|
333 |
dataqueue.push(tsk);
|
327 |
dataqueue.push(tsk);
|
334 |
pthread_cond_broadcast(&dataqueueWaitCond);
|
328 |
pthread_cond_broadcast(&dataqueueWaitCond);
|