Skip to content

Commit

Permalink
Added the second instance of st40 with the name of st41 (as copy of s…
Browse files Browse the repository at this point in the history
…t40). Both are functional and work according to st40 standard independently.

The substitutes are:
st40 -> st41,
st2110-40 -> st2110-41,
ancillary -> fast metadata (in comments, descriptions etc.),
ancillary -> fastmetadata (in names of functions / variables, constants, files etc.),
anc -> fmd,
(with small and capital letters accordingly.)
  • Loading branch information
skolelis committed Aug 22, 2024
1 parent 097d13b commit 2cfae95
Show file tree
Hide file tree
Showing 31 changed files with 5,644 additions and 18 deletions.
55 changes: 55 additions & 0 deletions app/src/app_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <mtl/st30_api.h>
#include <mtl/st30_pipeline_api.h>
#include <mtl/st40_api.h>
#include <mtl/st41_api.h>
#include <mtl/st_pipeline_api.h>
#include <pcap.h>
#include <pthread.h>
Expand Down Expand Up @@ -41,6 +42,9 @@
#define ST_APP_MAX_TX_ANC_SESSIONS (180)
#define ST_APP_MAX_RX_ANC_SESSIONS (180)

#define ST_APP_MAX_TX_FMD_SESSIONS (180)
#define ST_APP_MAX_RX_FMD_SESSIONS (180)

#define ST_APP_MAX_LCORES (32)

#define ST_APP_DEFAULT_FB_CNT (3)
Expand Down Expand Up @@ -226,6 +230,35 @@ struct st_app_tx_anc_session {
uint32_t st40_seq_id;
};

struct st_app_tx_fmd_session {
int idx;
st41_tx_handle handle;

uint16_t framebuff_cnt;

uint16_t framebuff_producer_idx;
uint16_t framebuff_consumer_idx;
struct st_tx_frame* framebuffs;

uint32_t st41_frame_done_cnt;
uint32_t st41_packet_done_cnt;

char st41_source_url[ST_APP_URL_MAX_LEN + 1];
int st41_source_fd;
pcap_t* st41_pcap;
bool st41_pcap_input;
bool st41_rtp_input;
uint8_t* st41_source_begin;
uint8_t* st41_source_end;
uint8_t* st41_frame_cursor; /* cursor to current frame */
pthread_t st41_app_thread;
bool st41_app_thread_stop;
pthread_cond_t st41_wake_cond;
pthread_mutex_t st41_wake_mutex;
uint32_t st41_rtp_tmstamp;
uint32_t st41_seq_id;
};

struct st_app_rx_video_session {
int idx;
mtl_handle st;
Expand Down Expand Up @@ -327,6 +360,19 @@ struct st_app_rx_anc_session {
uint64_t stat_frame_first_rx_time;
};

struct st_app_rx_fmd_session {
int idx;
st41_rx_handle handle;
pthread_t st41_app_thread;
pthread_cond_t st41_wake_cond;
pthread_mutex_t st41_wake_mutex;
bool st41_app_thread_stop;

/* stat */
int stat_frame_total_received;
uint64_t stat_frame_first_rx_time;
};

struct st22_app_tx_session {
int idx;
st22_tx_handle handle;
Expand Down Expand Up @@ -610,6 +656,12 @@ struct st_app_context {
int tx_anc_rtp_ring_size; /* the ring size for tx anc rtp type */
bool tx_anc_dedicate_queue;

struct st_app_tx_fmd_session* tx_fmd_sessions;
char tx_fmd_url[ST_APP_URL_MAX_LEN];
int tx_fmd_session_cnt;
int tx_fmd_rtp_ring_size; /* the ring size for tx fmd rtp type */
bool tx_fmd_dedicate_queue;

char tx_st22p_url[ST_APP_URL_MAX_LEN]; /* send st22p content url*/
struct st_app_tx_st22p_session* tx_st22p_sessions;
int tx_st22p_session_cnt;
Expand Down Expand Up @@ -640,6 +692,9 @@ struct st_app_context {
struct st_app_rx_anc_session* rx_anc_sessions;
int rx_anc_session_cnt;

struct st_app_rx_fmd_session* rx_fmd_sessions;
int rx_fmd_session_cnt;

struct st_app_rx_st22p_session* rx_st22p_sessions;
int rx_st22p_session_cnt;

Expand Down
27 changes: 27 additions & 0 deletions app/src/args.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ enum st_args_cmd {
ST_ARG_TX_ANC_URL,
ST_ARG_TX_ANC_SESSIONS_CNT,
ST_ARG_TX_ANC_RTP_RING_SIZE,
ST_ARG_TX_FMD_URL,
ST_ARG_TX_FMD_SESSIONS_CNT,
ST_ARG_TX_FMD_RTP_RING_SIZE,
ST22_ARG_TX_SESSIONS_CNT,
ST22_ARG_TX_URL,
ST_ARG_RX_VIDEO_SESSIONS_CNT,
Expand All @@ -48,6 +51,7 @@ enum st_args_cmd {
ST_ARG_RX_AUDIO_RTP_RING_SIZE,
ST_ARG_RX_AUDIO_DUMP_TIME_S,
ST_ARG_RX_ANC_SESSIONS_CNT,
ST_ARG_RX_FMD_SESSIONS_CNT,
ST22_ARG_RX_SESSIONS_CNT,
ST_ARG_HDR_SPLIT,
ST_ARG_PACING_WAY,
Expand Down Expand Up @@ -134,6 +138,7 @@ enum st_args_cmd {
ST_ARG_AUDIO_RL_OFFSET_US,
ST_ARG_AUDIO_FIFO_SIZE,
ST_ARG_ANC_DEDICATE_QUEUE,
ST_ARG_FMD_DEDICATE_QUEUE,
ST_ARG_TX_NO_BURST_CHECK,
ST_ARG_DHCP,
ST_ARG_IOVA_MODE,
Expand Down Expand Up @@ -183,6 +188,9 @@ static struct option st_app_args_options[] = {
{"tx_anc_url", required_argument, 0, ST_ARG_TX_ANC_URL},
{"tx_anc_sessions_count", required_argument, 0, ST_ARG_TX_ANC_SESSIONS_CNT},
{"tx_anc_rtp_ring_size", required_argument, 0, ST_ARG_TX_ANC_RTP_RING_SIZE},
{"tx_fmd_url", required_argument, 0, ST_ARG_TX_FMD_URL},
{"tx_fmd_sessions_count", required_argument, 0, ST_ARG_TX_FMD_SESSIONS_CNT},
{"tx_fmd_rtp_ring_size", required_argument, 0, ST_ARG_TX_FMD_RTP_RING_SIZE},
{"tx_st22_sessions_count", required_argument, 0, ST22_ARG_TX_SESSIONS_CNT},
{"tx_st22_url", required_argument, 0, ST22_ARG_TX_URL},

Expand All @@ -195,6 +203,7 @@ static struct option st_app_args_options[] = {
{"rx_audio_rtp_ring_size", required_argument, 0, ST_ARG_RX_AUDIO_RTP_RING_SIZE},
{"rx_audio_dump_time_s", required_argument, 0, ST_ARG_RX_AUDIO_DUMP_TIME_S},
{"rx_anc_sessions_count", required_argument, 0, ST_ARG_RX_ANC_SESSIONS_CNT},
{"rx_fmd_sessions_count", required_argument, 0, ST_ARG_RX_FMD_SESSIONS_CNT},
{"rx_st22_sessions_count", required_argument, 0, ST22_ARG_RX_SESSIONS_CNT},
{"hdr_split", no_argument, 0, ST_ARG_HDR_SPLIT},
{"pacing_way", required_argument, 0, ST_ARG_PACING_WAY},
Expand Down Expand Up @@ -277,6 +286,7 @@ static struct option st_app_args_options[] = {
{"audio_rl_offset", required_argument, 0, ST_ARG_AUDIO_RL_OFFSET_US},
{"audio_fifo_size", required_argument, 0, ST_ARG_AUDIO_FIFO_SIZE},
{"anc_dedicate_queue", no_argument, 0, ST_ARG_ANC_DEDICATE_QUEUE},
{"fmd_dedicate_queue", no_argument, 0, ST_ARG_FMD_DEDICATE_QUEUE},
{"tx_no_burst_check", no_argument, 0, ST_ARG_TX_NO_BURST_CHECK},
{"dhcp", no_argument, 0, ST_ARG_DHCP},
{"iova_mode", required_argument, 0, ST_ARG_IOVA_MODE},
Expand Down Expand Up @@ -351,12 +361,14 @@ static int app_args_json(struct st_app_context* ctx, struct mtl_init_params* p,
ctx->tx_video_session_cnt = ctx->json_ctx->tx_video_session_cnt;
ctx->tx_audio_session_cnt = ctx->json_ctx->tx_audio_session_cnt;
ctx->tx_anc_session_cnt = ctx->json_ctx->tx_anc_session_cnt;
ctx->tx_fmd_session_cnt = ctx->json_ctx->tx_fmd_session_cnt;
ctx->tx_st22p_session_cnt = ctx->json_ctx->tx_st22p_session_cnt;
ctx->tx_st20p_session_cnt = ctx->json_ctx->tx_st20p_session_cnt;
ctx->tx_st30p_session_cnt = ctx->json_ctx->tx_st30p_session_cnt;
ctx->rx_video_session_cnt = ctx->json_ctx->rx_video_session_cnt;
ctx->rx_audio_session_cnt = ctx->json_ctx->rx_audio_session_cnt;
ctx->rx_anc_session_cnt = ctx->json_ctx->rx_anc_session_cnt;
ctx->rx_fmd_session_cnt = ctx->json_ctx->rx_fmd_session_cnt;
ctx->rx_st22p_session_cnt = ctx->json_ctx->rx_st22p_session_cnt;
ctx->rx_st20p_session_cnt = ctx->json_ctx->rx_st20p_session_cnt;
ctx->rx_st30p_session_cnt = ctx->json_ctx->rx_st30p_session_cnt;
Expand Down Expand Up @@ -513,6 +525,15 @@ int st_app_parse_args(struct st_app_context* ctx, struct mtl_init_params* p, int
case ST_ARG_TX_ANC_SESSIONS_CNT:
ctx->tx_anc_session_cnt = atoi(optarg);
break;
case ST_ARG_TX_FMD_URL:
snprintf(ctx->tx_fmd_url, sizeof(ctx->tx_fmd_url), "%s", optarg);
break;
case ST_ARG_TX_FMD_RTP_RING_SIZE:
ctx->tx_fmd_rtp_ring_size = atoi(optarg);
break;
case ST_ARG_TX_FMD_SESSIONS_CNT:
ctx->tx_fmd_session_cnt = atoi(optarg);
break;
case ST_ARG_RX_VIDEO_SESSIONS_CNT:
ctx->rx_video_session_cnt = atoi(optarg);
break;
Expand Down Expand Up @@ -540,6 +561,9 @@ int st_app_parse_args(struct st_app_context* ctx, struct mtl_init_params* p, int
case ST_ARG_RX_ANC_SESSIONS_CNT:
ctx->rx_anc_session_cnt = atoi(optarg);
break;
case ST_ARG_RX_FMD_SESSIONS_CNT:
ctx->rx_fmd_session_cnt = atoi(optarg);
break;
case ST22_ARG_TX_SESSIONS_CNT:
ctx->tx_st22_session_cnt = atoi(optarg);
break;
Expand Down Expand Up @@ -856,6 +880,9 @@ int st_app_parse_args(struct st_app_context* ctx, struct mtl_init_params* p, int
case ST_ARG_ANC_DEDICATE_QUEUE:
ctx->tx_anc_dedicate_queue = true;
break;
case ST_ARG_FMD_DEDICATE_QUEUE:
ctx->tx_fmd_dedicate_queue = true;
break;
case ST_ARG_DHCP:
for (int port = 0; port < MTL_PORT_MAX; ++port)
p->net_proto[port] = MTL_PROTO_DHCP;
Expand Down
1 change: 1 addition & 0 deletions app/src/fmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#define ST_APP_PAYLOAD_TYPE_AUDIO (111)
#define ST_APP_PAYLOAD_TYPE_ANCILLARY (113)
#define ST_APP_PAYLOAD_TYPE_ST22 (114)
#define ST_APP_PAYLOAD_TYPE_FASTMETADATA (115)

#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))

Expand Down
1 change: 1 addition & 0 deletions app/src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ sources = files('rxtx_app.c', 'args.c', 'parse_json.c', 'fmt.c',
'tx_st20p_app.c', 'rx_st20p_app.c',
'tx_st22p_app.c', 'rx_st22p_app.c',
'tx_ancillary_app.c', 'rx_ancillary_app.c',
'tx_fastmetadata_app.c', 'rx_fastmetadata_app.c',
'tx_st30p_app.c', 'rx_st30p_app.c',
)

Expand Down
Loading

0 comments on commit 2cfae95

Please sign in to comment.