Rename struct audio format to audio_format_handler
[paraslash.git] / ortp_recv.c
index 5824509..905d580 100644 (file)
@@ -67,7 +67,7 @@ uint32_t chunk_ts;
 };
 
 static int ortp_recv_pre_select(struct receiver_node *rn,
-               __unused fd_set *rfds, __unused fd_set *wfds,
+               __a_unused fd_set *rfds, __a_unused fd_set *wfds,
                struct timeval *timeout)
 {
        struct private_ortp_recv_data *pord = rn->private_data;
@@ -83,7 +83,7 @@ static int ortp_recv_pre_select(struct receiver_node *rn,
        return -1; /* we did not modify the fd sets */
 }
 
-static void compute_next_chunk(struct timeval *now, unsigned chunk_time,
+static void compute_next_chunk(unsigned chunk_time,
                struct private_ortp_recv_data *pord)
 {
        struct timeval chunk_tv = {0, chunk_time};
@@ -96,14 +96,10 @@ static void compute_next_chunk(struct timeval *now, unsigned chunk_time,
                pord->timestamp, pord->next_chunk.tv_sec,
                pord->next_chunk.tv_usec);
 }
-/** \cond */
-#define BUF_TO_VAL(buf) (((unsigned)(buf)[1] & 0xff) +  256 \
-       * ((unsigned)(buf)[0] & 0xff))
-/** \endcond */
 
-
-static int ortp_recv_post_select(struct receiver_node *rn, int select_ret,
-       __unused fd_set *rfds, __unused fd_set *wfds)
+static int ortp_recv_post_select(struct receiver_node *rn,
+               __a_unused int select_ret, __a_unused fd_set *rfds,
+               __a_unused fd_set *wfds)
 {
        struct private_ortp_recv_data *pord = rn->private_data;
        mblk_t *mp;
@@ -208,7 +204,7 @@ success:
                pord->c_bad = 0;
                pord->next_chunk = now;
        }
-       compute_next_chunk(&now, chunk_time, pord);
+       compute_next_chunk(chunk_time, pord);
        return 1;
 err_out:
        freemsg(mp);
@@ -234,7 +230,7 @@ static void *ortp_recv_parse_config(int argc, char **argv)
 {
        int ret;
 
-       struct gengetopt_args_info *tmp = para_calloc(sizeof(struct gengetopt_args_info));
+       struct ortp_recv_args_info *tmp = para_calloc(sizeof(struct ortp_recv_args_info));
 
        ret = ortp_recv_cmdline_parser(argc, argv, tmp)? -E_ORTP_SYNTAX : 1;
        if (ret > 0)
@@ -246,7 +242,7 @@ static void *ortp_recv_parse_config(int argc, char **argv)
 static int ortp_recv_open(struct receiver_node *rn)
 {
        struct private_ortp_recv_data *pord;
-       struct gengetopt_args_info *conf = rn->conf;
+       struct ortp_recv_args_info *conf = rn->conf;
 
        rn->buf = para_calloc(CHUNK_SIZE);
 
@@ -256,8 +252,11 @@ static int ortp_recv_open(struct receiver_node *rn)
        PARA_NOTICE_LOG("receiving from %s:%d\n", conf->host_arg, conf->port_arg);
        rtp_session_set_local_addr(pord->session, conf->host_arg, conf->port_arg);
        rtp_session_set_payload_type(pord->session, PAYLOAD_AUDIO_CONTINUOUS);
-       rtp_session_enable_adaptive_jitter_compensation(pord->session, TRUE);
-       rtp_session_set_jitter_compensation(pord->session, 40);
+       if (conf->jitter_compensation_arg) {
+               rtp_session_enable_adaptive_jitter_compensation(pord->session, TRUE);
+               rtp_session_set_jitter_compensation(pord->session,
+                       conf->jitter_compensation_arg);
+       }
        return 1;
 }