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.
This commit is contained in:
Vadim Yanitskiy 2017-09-09 20:57:13 +03:00
parent 2286a36ace
commit 408be3638b
7 changed files with 20 additions and 0 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;