chiark / gitweb /
separate thread to add to heap
[disorder] / server / speaker.c
index c5fc668db06008aff26bfd07aa4219178a602635..f9badeb28f28f71b38bb32f063ec4caab4f337d6 100644 (file)
 #define NETWORK_BYTES 1024
 
 /** @brief Maximum RTP playahead (seconds) */
 #define NETWORK_BYTES 1024
 
 /** @brief Maximum RTP playahead (seconds) */
-#define RTP_AHEAD 2
+#define RTP_AHEAD 1
 
 /** @brief Maximum number of FDs to poll for */
 #define NFDS 256
 
 /** @brief Maximum number of FDs to poll for */
 #define NFDS 256
@@ -971,8 +971,8 @@ int main(int argc, char **argv) {
         struct timeval now;
         uint64_t target_us;
         uint64_t target_rtp_time;
         struct timeval now;
         uint64_t target_us;
         uint64_t target_rtp_time;
-        const uint64_t ahead = RTP_AHEAD * config->sample_format.rate
-          * config->sample_format.channels;
+        const uint64_t samples_ahead = RTP_AHEAD * config->sample_format.rate
+                                              * config->sample_format.channels;
 
         static unsigned logit;
 
 
         static unsigned logit;
 
@@ -988,14 +988,16 @@ int main(int argc, char **argv) {
                                      * config->sample_format.channels)
 
                           / 1000000;
                                      * config->sample_format.channels)
 
                           / 1000000;
+#if 0
         /* TODO remove logging guff */
         if(!(logit++ & 1023))
           info("rtp_time %llu target %llu difference %lld [%lld]", 
                rtp_time, target_rtp_time,
                rtp_time - target_rtp_time,
         /* TODO remove logging guff */
         if(!(logit++ & 1023))
           info("rtp_time %llu target %llu difference %lld [%lld]", 
                rtp_time, target_rtp_time,
                rtp_time - target_rtp_time,
-               ahead);
+               samples_ahead);
+#endif
         if(rtp_time < target_rtp_time
         if(rtp_time < target_rtp_time
-           || rtp_time - target_rtp_time < ahead)
+           || rtp_time - target_rtp_time < samples_ahead)
           bfd_slot = addfd(bfd, POLLOUT);
         break;
       }
           bfd_slot = addfd(bfd, POLLOUT);
         break;
       }