diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-04-19 12:29:45 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-04-19 18:24:25 +0200 |
commit | df0ad6c1a4e23a96428e435af7ba54c2f367546b (patch) | |
tree | c84e3b426235bcbddc83b871a2aee23f48ea2211 /tests | |
parent | e259c8ab18ce53bd58d022b2c6a193b4a2ec5b1b (diff) |
osmux: Move examples and tests to use new output APIs
Change-Id: Ie69c427308eb7d81aedab7fbb71f1bdaf43f0275
Diffstat (limited to 'tests')
-rw-r--r-- | tests/jibuf/jibuf_tool.c | 14 | ||||
-rw-r--r-- | tests/osmo-pcap-test/osmux_test.c | 9 | ||||
-rw-r--r-- | tests/osmux/osmux_test.c | 8 |
3 files changed, 13 insertions, 18 deletions
diff --git a/tests/jibuf/jibuf_tool.c b/tests/jibuf/jibuf_tool.c index 8fa9f2e..bd444a7 100644 --- a/tests/jibuf/jibuf_tool.c +++ b/tests/jibuf/jibuf_tool.c @@ -114,7 +114,6 @@ static uint32_t packets_too_much_jitter; static struct osmo_pcap osmo_pcap; static bool pcap_finished; static struct osmux_out_handle pcap_osmux_h; -static struct llist_head osmux_list; /* ----------------------------- */ static void sigalarm_handler(int foo) @@ -438,10 +437,8 @@ int pcap_read_osmux(struct msgb *msg) struct osmux_hdr *osmuxh; /* This code below belongs to the osmux receiver */ - while((osmuxh = osmux_xfrm_output_pull(msg)) != NULL) { - osmux_xfrm_output(osmuxh, &pcap_osmux_h, &osmux_list); - osmux_tx_sched(&osmux_list, glue_cb, NULL); - } + while((osmuxh = osmux_xfrm_output_pull(msg)) != NULL) + osmux_xfrm_output_sched(&pcap_osmux_h, osmuxh); msgb_free(msg); return 0; } @@ -520,8 +517,8 @@ void pcap_test() { osmo_pcap.timer.cb = pcap_pkt_timer_cb; if(opt_osmux) { - INIT_LLIST_HEAD(&osmux_list); osmux_xfrm_output_init(&pcap_osmux_h, 0); + osmux_xfrm_output_set_tx_cb(&pcap_osmux_h, glue_cb, NULL); } jb = osmo_jibuf_alloc(NULL); @@ -533,8 +530,11 @@ void pcap_test() { /* first run */ pcap_pkt_timer_cb(NULL); - while(!pcap_finished || !osmo_jibuf_empty(jb)) + while(!pcap_finished || !osmo_jibuf_empty(jb)) { + if (pcap_finished && opt_osmux) /* Flushing once should be enough */ + osmux_xfrm_output_flush(&pcap_osmux_h); osmo_select_main(0); + } osmo_jibuf_delete(jb); diff --git a/tests/osmo-pcap-test/osmux_test.c b/tests/osmo-pcap-test/osmux_test.c index 463b212..7ec78a0 100644 --- a/tests/osmo-pcap-test/osmux_test.c +++ b/tests/osmo-pcap-test/osmux_test.c @@ -52,16 +52,12 @@ static void tx_cb(struct msgb *msg, void *data) static void deliver(struct msgb *batch_msg) { struct osmux_hdr *osmuxh; - struct llist_head list; printf("sending batch (len=%d) [emulated]\n", batch_msg->len); /* This code below belongs to the osmux receiver */ - while((osmuxh = osmux_xfrm_output_pull(batch_msg)) != NULL) { - - osmux_xfrm_output(osmuxh, &h_output, &list); - osmux_tx_sched(&list, tx_cb, NULL); - } + while((osmuxh = osmux_xfrm_output_pull(batch_msg)) != NULL) + osmux_xfrm_output_sched(&h_output, osmuxh); msgb_free(batch_msg); } @@ -194,6 +190,7 @@ int main(int argc, char *argv[]) osmux_xfrm_input_init(&h_input); osmux_xfrm_output_init(&h_output); + osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, NULL); /* first run */ osmo_pcap_pkt_timer_cb(NULL); diff --git a/tests/osmux/osmux_test.c b/tests/osmux/osmux_test.c index 631ade8..704ccbc 100644 --- a/tests/osmux/osmux_test.c +++ b/tests/osmux/osmux_test.c @@ -103,7 +103,6 @@ static struct osmux_out_handle h_output; static void osmux_deliver(struct msgb *batch_msg, void *data) { struct osmux_hdr *osmuxh; - LLIST_HEAD(list); char buf[2048]; osmux_snprintf(buf, sizeof(buf), batch_msg); @@ -112,10 +111,8 @@ static void osmux_deliver(struct msgb *batch_msg, void *data) /* For each OSMUX message, extract the RTP messages and put them * in a list. Then, reconstruct transmission timing. */ - while((osmuxh = osmux_xfrm_output_pull(batch_msg)) != NULL) { - osmux_xfrm_output(osmuxh, &h_output, &list); - osmux_tx_sched(&list, tx_cb, NULL); - } + while((osmuxh = osmux_xfrm_output_pull(batch_msg)) != NULL) + osmux_xfrm_output_sched(&h_output, osmuxh); msgb_free(batch_msg); } @@ -273,6 +270,7 @@ int main(void) log_set_log_level(osmo_stderr_target, LOGL_DEBUG); osmux_xfrm_output_init(&h_output, 0x7000000); + osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, NULL); /* If the test takes longer than 10 seconds, abort it */ alarm(10); |