aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2013-02-19 17:14:33 +0100
committerPablo Neira Ayuso <pablo@gnumonks.org>2013-02-19 17:14:33 +0100
commitd32caea9ea848cb99698dfa6afd785022ac64973 (patch)
tree21950f317cb3d52bd4f4ff2ee524cd46592e6231 /examples
parentaeeb4399a235e7dd25708adf59b3413133adbed2 (diff)
osmux: add osmux_snprintf
Useful for debugging purposes. Modify also examples to use it.
Diffstat (limited to 'examples')
-rw-r--r--examples/osmux-test-input.c13
-rw-r--r--examples/osmux-test-output.c8
2 files changed, 15 insertions, 6 deletions
diff --git a/examples/osmux-test-input.c b/examples/osmux-test-input.c
index f611dce..b4e5b24 100644
--- a/examples/osmux-test-input.c
+++ b/examples/osmux-test-input.c
@@ -71,7 +71,11 @@ static struct osmo_rtp_handle *rtp;
static void osmux_deliver(struct msgb *batch_msg, void *data)
{
- printf("sending batch (len=%d)\n", batch_msg->len);
+ char buf[1024];
+
+ osmux_snprintf(buf, sizeof(buf), batch_msg);
+ LOGP(DOSMUX_TEST, LOGL_DEBUG, "sending batch (len=%d): %s\n",
+ batch_msg->len, buf);
osmo_dgram_send(conn, batch_msg);
}
@@ -131,8 +135,6 @@ int read_cb(struct osmo_dgram *conn)
struct rtp_hdr *rtph;
int ret, ccid;
- LOGP(DOSMUX_TEST, LOGL_DEBUG, "received message from datagram\n");
-
msg = msgb_alloc(RTP_MSGB_SIZE, "OSMUX/test");
if (msg == NULL) {
LOGP(DOSMUX_TEST, LOGL_ERROR, "cannot allocate message\n");
@@ -154,6 +156,11 @@ int read_cb(struct osmo_dgram *conn)
if (rtph->payload_type == RTP_PT_AMR)
amr_write(msg);
+ char buf[1024];
+
+ osmo_rtp_snprintf(buf, sizeof(buf), msg);
+ LOGP(DOSMUX_TEST, LOGL_DEBUG, "received RTP (len=%d): %s\n", msg->len, buf);
+
ccid = get_ccid(rtph->ssrc);
if (ccid < 0)
register_ccid(rtph->ssrc);
diff --git a/examples/osmux-test-output.c b/examples/osmux-test-output.c
index 5fe2bba..ea07606 100644
--- a/examples/osmux-test-output.c
+++ b/examples/osmux-test-output.c
@@ -78,7 +78,7 @@ static void tx_cb(struct msgb *msg, void *data)
char buf[4096];
osmo_rtp_snprintf(buf, sizeof(buf), msg);
- printf("sending: %s\n", buf);
+ LOGP(DOSMUX_TEST, LOGL_DEBUG, "sending: %s\n", buf);
osmo_dgram_send(conn, msg);
amr_write(msg);
@@ -102,10 +102,12 @@ int read_cb(struct osmo_dgram *conn)
return -1;
}
- LOGP(DOSMUX_TEST, LOGL_DEBUG, "received OSMUX message (len=%d)\n", msg->len);
+ char buf[1024];
+ osmux_snprintf(buf, sizeof(buf), msg);
+ LOGP(DOSMUX_TEST, LOGL_DEBUG, "received OSMUX message (len=%d) %s\n",
+ msg->len, buf);
while((osmuxh = osmux_xfrm_output_pull(msg)) != NULL) {
- printf("tx_sched\n");
osmux_xfrm_output(osmuxh, &h_output, &list);
osmux_tx_sched(&list, tx_cb, NULL);
}