summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-09-09 20:57:13 +0300
committerVadim Yanitskiy <axilirator@gmail.com>2017-12-31 12:20:59 +0100
commit408be3638b3cd84462632ae8fe0b92e93064ca57 (patch)
tree6578b8cd0d8225d8a6fcd28090b2d1f759db794e
parent2286a36ace915864bce935f49374f12cb9384e5d (diff)
procqueue: add item type enum (source, sink, proc)
There are currently three types of prcessing queue items: - source (file, alsa, rtp) - proc (format, codec) - sink (file, alsa, rtp) Let's assign corresponding type for each item. This would facilitate logging and the queue checking.
-rw-r--r--include/osmocom/gapk/procqueue.h8
-rw-r--r--src/libosmogapk.map1
-rw-r--r--src/pq_alsa.c3
-rw-r--r--src/pq_codec.c1
-rw-r--r--src/pq_file.c3
-rw-r--r--src/pq_format.c1
-rw-r--r--src/pq_rtp.c3
7 files changed, 20 insertions, 0 deletions
diff --git a/include/osmocom/gapk/procqueue.h b/include/osmocom/gapk/procqueue.h
index dfd0db1..f5b8d53 100644
--- a/include/osmocom/gapk/procqueue.h
+++ b/include/osmocom/gapk/procqueue.h
@@ -24,6 +24,12 @@
#include <osmocom/core/linuxlist.h>
+enum osmo_gapk_pq_item_type {
+ OSMO_GAPK_ITEM_TYPE_SOURCE,
+ OSMO_GAPK_ITEM_TYPE_SINK,
+ OSMO_GAPK_ITEM_TYPE_PROC,
+};
+
struct osmo_gapk_pq_item {
/*! input frame size (in bytes). '0' in case of variable frames */
unsigned int len_in;
@@ -45,6 +51,8 @@ struct osmo_gapk_pq_item {
/*! \brief link to a processing queue */
struct llist_head list;
+ /*! \brief type of item */
+ enum osmo_gapk_pq_item_type type;
};
#define VAR_BUF_SIZE 320
diff --git a/src/libosmogapk.map b/src/libosmogapk.map
index a6ce08d..e704c31 100644
--- a/src/libosmogapk.map
+++ b/src/libosmogapk.map
@@ -6,6 +6,7 @@ osmo_gapk_set_talloc_ctx;
osmo_gapk_pq;
osmo_gapk_pq_item;
+osmo_gapk_pq_item_type;
osmo_gapk_pq_create;
osmo_gapk_pq_prepare;
diff --git a/src/pq_alsa.c b/src/pq_alsa.c
index 8355349..3025c2a 100644
--- a/src/pq_alsa.c
+++ b/src/pq_alsa.c
@@ -140,6 +140,9 @@ pq_queue_alsa_op(struct osmo_gapk_pq *pq, const char *alsa_dev, unsigned int blk
goto out_close;
}
+ item->type = in_out_n ?
+ OSMO_GAPK_ITEM_TYPE_SOURCE : OSMO_GAPK_ITEM_TYPE_SINK;
+
item->len_in = in_out_n ? 0 : blk_len;
item->len_out = in_out_n ? blk_len : 0;
item->state = state;
diff --git a/src/pq_codec.c b/src/pq_codec.c
index e033a7d..db99d5c 100644
--- a/src/pq_codec.c
+++ b/src/pq_codec.c
@@ -70,6 +70,7 @@ osmo_gapk_pq_queue_codec(struct osmo_gapk_pq *pq, const struct osmo_gapk_codec_d
item->proc = codec->codec_decode;
}
+ item->type = OSMO_GAPK_ITEM_TYPE_PROC;
item->exit = codec->codec_exit;
item->wait = NULL;
diff --git a/src/pq_file.c b/src/pq_file.c
index f3bb9a3..73a7099 100644
--- a/src/pq_file.c
+++ b/src/pq_file.c
@@ -78,6 +78,9 @@ pq_queue_file_op(struct osmo_gapk_pq *pq, FILE *fh, unsigned int blk_len, int in
return -ENOMEM;
}
+ item->type = in_out_n ?
+ OSMO_GAPK_ITEM_TYPE_SOURCE : OSMO_GAPK_ITEM_TYPE_SINK;
+
item->len_in = in_out_n ? 0 : blk_len;
item->len_out = in_out_n ? blk_len : 0;
item->state = state;
diff --git a/src/pq_format.c b/src/pq_format.c
index 8ea8b86..dad1d9e 100644
--- a/src/pq_format.c
+++ b/src/pq_format.c
@@ -69,6 +69,7 @@ osmo_gapk_pq_queue_fmt_convert(struct osmo_gapk_pq *pq, const struct osmo_gapk_f
item->state = fmt->conv_to_canon;
}
+ item->type = OSMO_GAPK_ITEM_TYPE_PROC;
item->proc = pq_cb_fmt_convert;
item->wait = NULL;
diff --git a/src/pq_rtp.c b/src/pq_rtp.c
index 27b868c..799b324 100644
--- a/src/pq_rtp.c
+++ b/src/pq_rtp.c
@@ -224,6 +224,9 @@ pq_queue_rtp_op(struct osmo_gapk_pq *pq, int udp_fd, unsigned int blk_len, int i
return -ENOMEM;
}
+ item->type = in_out_n ?
+ OSMO_GAPK_ITEM_TYPE_SOURCE : OSMO_GAPK_ITEM_TYPE_SINK;
+
item->len_in = in_out_n ? 0 : blk_len;
item->len_out = in_out_n ? blk_len : 0;
item->state = state;