aboutsummaryrefslogtreecommitdiffstats
path: root/tests/osmo-pcap-test
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2012-07-19 11:43:08 +0200
committerPablo Neira Ayuso <pablo@gnumonks.org>2012-07-19 11:43:08 +0200
commit413513a7045fe1fab6b4f0b2bc8e4f34eec36bea (patch)
tree314c5272a720154e2cb38cf5b133eb311953d0b6 /tests/osmo-pcap-test
parent8ba490fd9615838a03e0b7cb6a423072720ef744 (diff)
tests: osmo-pcap: adapt it to use new osmux_tx_sched
Adapt the test to use the function that allows reconstructing the RTP timing sequence.
Diffstat (limited to 'tests/osmo-pcap-test')
-rw-r--r--tests/osmo-pcap-test/main.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/tests/osmo-pcap-test/main.c b/tests/osmo-pcap-test/main.c
index 8073d4f..8dfa4cb 100644
--- a/tests/osmo-pcap-test/main.c
+++ b/tests/osmo-pcap-test/main.c
@@ -165,18 +165,34 @@ static struct osmux_out_handle h = {
.rtp_timestamp = 10,
};
+static void tx_cb(struct msgb *msg, void *data)
+{
+ printf("now sending message scheduled [emulated], msg=%p\n", msg);
+ /*
+ * Here we should call the real function that sends the message
+ * instead of releasing it.
+ */
+ msgb_free(msg);
+}
+
static void deliver(struct msgb *batch_msg)
{
struct osmux_hdr *osmuxh;
struct msgb *msg;
int i = 0;
+ struct timeval tv = { .tv_sec = 0, .tv_usec = 0 };
+ struct timeval delta = { .tv_sec = 0, .tv_usec = 160000 };
+
+ timerclear(&tv);
printf("sending batch (len=%d) [emulated]\n", batch_msg->len);
while((osmuxh = osmux_xfrm_output_pull(batch_msg)) != NULL) {
msg = osmux_xfrm_output(osmuxh, &h);
- printf("extract message %d\n", ++i);
- /* XXX just to avoid leaking */
- msgb_free(msg);
+ printf("schedule transmision for %lu.%6lu seconds, "
+ "msg=%p (%d in batch)\n",
+ tv.tv_sec, tv.tv_usec, msg, ++i);
+ osmux_tx_sched(msg, &tv, tx_cb, NULL);
+ timeradd(&tv, &delta, &tv);
}
}