vss: Let the transport specify whether periodic headers are necessary.
authorAndre Noll <maan@systemlinux.org>
Sun, 17 Oct 2010 09:45:57 +0000 (11:45 +0200)
committerAndre Noll <maan@systemlinux.org>
Sat, 27 Nov 2010 08:32:44 +0000 (09:32 +0100)
This adds the new flag need_periodic_header to struct fec_client_parms. It is
true for the UDP transport and false for the DCCP transport.

vss checks this flag in need_audio_header() and does not send the header
periodically if the flag is false.

command.c
dccp_send.c
http_send.c
send.h
server.c
udp_send.c
vss.c

index 1ca5db3..664d257 100644 (file)
--- a/command.c
+++ b/command.c
@@ -13,6 +13,7 @@
 #include <dirent.h>
 #include <openssl/rc4.h>
 #include <osl.h>
+#include <stdbool.h>
 
 #include "para.h"
 #include "error.h"
index a2ee027..38e4b7c 100644 (file)
@@ -145,6 +145,7 @@ static void dccp_post_select(fd_set *rfds, __a_unused fd_set *wfds)
        dfc->fcp.slices_per_group       = conf.dccp_slices_per_group_arg;
        dfc->fcp.init_fec               = dccp_init_fec;
        dfc->fcp.send_fec               = dccp_send_fec;
+       dfc->fcp.need_periodic_header   = false;
        dfc->fc = vss_add_fec_client(sc, &dfc->fcp);
 }
 
index e376c46..d5c6397 100644 (file)
@@ -10,6 +10,7 @@
 #include <sys/types.h>
 #include <dirent.h>
 #include <osl.h>
+#include <stdbool.h>
 
 #include "para.h"
 #include "error.h"
diff --git a/send.h b/send.h
index 2201beb..52f7a10 100644 (file)
--- a/send.h
+++ b/send.h
@@ -131,6 +131,8 @@ struct fec_client_parms {
        uint8_t slices_per_group;
        /** Number of slices minus number of redundant slices. */
        uint8_t data_slices_per_group;
+       /** Whether the header must be sent periodically. */
+       bool need_periodic_header;
        /**
         * Transport-layer initialisation for FEC support.
         *
index 48ef55e..11397d0 100644 (file)
--- a/server.c
+++ b/server.c
@@ -68,6 +68,7 @@
 #include <openssl/rc4.h>
 #include <regex.h>
 #include <osl.h>
+#include <stdbool.h>
 
 #include "para.h"
 #include "error.h"
index 0343feb..7d4f1c7 100644 (file)
@@ -14,6 +14,7 @@
 #include <netinet/udp.h>
 #include <net/if.h>
 #include <osl.h>
+#include <stdbool.h>
 
 #include "server.cmdline.h"
 #include "para.h"
@@ -344,6 +345,7 @@ static int udp_com_add(struct sender_command_data *scd)
        ut->fcp.data_slices_per_group = scd->data_slices_per_group;
        ut->fcp.init_fec              = udp_init_fec;
        ut->fcp.send_fec              = udp_send_fec;
+       ut->fcp.need_periodic_header  = true;
 
        sc->private_data = ut;
        sc->fd = -1;
diff --git a/vss.c b/vss.c
index 96b2ba9..8c16c95 100644 (file)
--- a/vss.c
+++ b/vss.c
@@ -227,8 +227,12 @@ static bool need_audio_header(struct fec_client *fc, struct vss_task *vsst)
                return false;
        if (vsst->header_len == 0)
                return false;
-       if (fc->group.num && tv_diff(&fc->next_header_time, now, NULL) > 0)
-               return false;
+       if (fc->group.num > 0) {
+               if (!fc->fcp->need_periodic_header)
+                       return false;
+               if (tv_diff(&fc->next_header_time, now, NULL) > 0)
+                       return false;
+       }
        tv_add(now, &vsst->header_interval, &fc->next_header_time);
        return true;
 }