Skip to content

Commit

Permalink
mcast: refactor igmp implementation (#627)
Browse files Browse the repository at this point in the history
1. Allow joining groups with source addresses
2. Add sending leave membership report
3. Allow membership report on query

---------

Signed-off-by: Ric Li <[email protected]>
  • Loading branch information
ricmli authored Dec 6, 2023
1 parent 70348ff commit 8ea0346
Show file tree
Hide file tree
Showing 31 changed files with 855 additions and 166 deletions.
3 changes: 2 additions & 1 deletion app/src/app_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,8 @@ struct st_app_context {
struct st_app_tx_st20p_session* tx_st20p_sessions;
int tx_st20p_session_cnt;

uint8_t rx_sip_addr[MTL_PORT_MAX][MTL_IP_ADDR_LEN]; /* rx source IP */
uint8_t rx_sip_addr[MTL_PORT_MAX][MTL_IP_ADDR_LEN]; /* rx source IP */
uint8_t rx_mcast_sip_addr[MTL_PORT_MAX][MTL_IP_ADDR_LEN]; /* rx multicast source IP */

struct st_app_rx_video_session* rx_video_sessions;
int rx_video_session_cnt;
Expand Down
10 changes: 10 additions & 0 deletions app/src/args.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ enum st_args_cmd {
ST_ARG_R_NETMASK,
ST_ARG_P_GATEWAY,
ST_ARG_R_GATEWAY,
ST_ARG_P_RX_MCAST_SIP,
ST_ARG_R_RX_MCAST_SIP,

ST_ARG_TX_VIDEO_URL = 0x200,
ST_ARG_TX_VIDEO_SESSIONS_CNT,
Expand Down Expand Up @@ -143,6 +145,8 @@ static struct option st_app_args_options[] = {
{"r_netmask", required_argument, 0, ST_ARG_R_NETMASK},
{"p_gateway", required_argument, 0, ST_ARG_P_GATEWAY},
{"r_gateway", required_argument, 0, ST_ARG_R_GATEWAY},
{"p_rx_mcast_sip", required_argument, 0, ST_ARG_P_RX_MCAST_SIP},
{"r_rx_mcast_sip", required_argument, 0, ST_ARG_R_RX_MCAST_SIP},

{"tx_video_url", required_argument, 0, ST_ARG_TX_VIDEO_URL},
{"tx_video_sessions_count", required_argument, 0, ST_ARG_TX_VIDEO_SESSIONS_CNT},
Expand Down Expand Up @@ -397,6 +401,12 @@ int st_app_parse_args(struct st_app_context* ctx, struct mtl_init_params* p, int
case ST_ARG_R_GATEWAY:
inet_pton(AF_INET, optarg, p->gateway[MTL_PORT_R]);
break;
case ST_ARG_P_RX_MCAST_SIP:
inet_pton(AF_INET, optarg, ctx->rx_mcast_sip_addr[MTL_PORT_P]);
break;
case ST_ARG_R_RX_MCAST_SIP:
inet_pton(AF_INET, optarg, ctx->rx_mcast_sip_addr[MTL_PORT_R]);
break;
case ST_ARG_TX_VIDEO_URL:
snprintf(ctx->tx_video_url, sizeof(ctx->tx_video_url), "%s", optarg);
break;
Expand Down
79 changes: 78 additions & 1 deletion app/src/parse_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -1797,6 +1797,19 @@ static int parse_session_ip(const char* str_ip, struct st_json_session_base* bas
return 0;
}

static int parse_mcast_src_ip(const char* str_ip, struct st_json_session_base* base,
enum mtl_session_port port) {
int ret;

ret = inet_pton(AF_INET, str_ip, base->mcast_src_ip[port]);
if (ret != 1) {
err("%s, %s is not a valid ip\n", __func__, str_ip);
return -EIO;
}

return 0;
}

void st_app_free_json(st_json_context_t* ctx) {
if (ctx->interfaces) {
st_app_free(ctx->interfaces);
Expand Down Expand Up @@ -2366,9 +2379,13 @@ int st_app_parse_json(st_json_context_t* ctx, const char* filename) {
json_object* ip_p = NULL;
json_object* ip_r = NULL;
json_object* ip_array = st_json_object_object_get(rx_group, "ip");
json_object* mcast_src_ip_p = NULL;
json_object* mcast_src_ip_r = NULL;
json_object* mcast_src_ip_array = /* mcast_src_ip field is optional */
st_json_object_object_get(rx_group, "mcast_src_ip");
if (ip_array != NULL && json_object_get_type(ip_array) == json_type_array) {
int len = json_object_array_length(ip_array);
if (len < 1 || len > MTL_PORT_MAX) {
if (len < 1 || len > MTL_SESSION_PORT_MAX) {
err("%s, wrong dip number\n", __func__);
ret = -ST_JSON_NOT_VALID;
goto error;
Expand All @@ -2383,6 +2400,19 @@ int st_app_parse_json(st_json_context_t* ctx, const char* filename) {
ret = -ST_JSON_PARSE_FAIL;
goto error;
}
if (mcast_src_ip_array != NULL &&
json_object_get_type(mcast_src_ip_array) == json_type_array) {
int len = json_object_array_length(mcast_src_ip_array);
if (len < 1 || len > MTL_SESSION_PORT_MAX) {
err("%s, wrong mcast_src_ip number\n", __func__);
ret = -ST_JSON_NOT_VALID;
goto error;
}
mcast_src_ip_p = json_object_array_get_idx(mcast_src_ip_array, 0);
if (len == 2) {
mcast_src_ip_r = json_object_array_get_idx(mcast_src_ip_array, 1);
}
}

/* parse interface */
int inf_p, inf_r = 0;
Expand Down Expand Up @@ -2430,12 +2460,20 @@ int st_app_parse_json(st_json_context_t* ctx, const char* filename) {
for (int k = 0; k < replicas; ++k) {
parse_session_ip(json_object_get_string(ip_p),
&ctx->rx_video_sessions[num_video].base, MTL_SESSION_PORT_P);
if (mcast_src_ip_p)
parse_mcast_src_ip(json_object_get_string(mcast_src_ip_p),
&ctx->rx_video_sessions[num_video].base,
MTL_SESSION_PORT_P);
ctx->rx_video_sessions[num_video].base.inf[0] = &ctx->interfaces[inf_p];
ctx->interfaces[inf_p].rx_video_sessions_cnt++;
if (num_inf == 2) {
parse_session_ip(json_object_get_string(ip_r),
&ctx->rx_video_sessions[num_video].base,
MTL_SESSION_PORT_R);
if (mcast_src_ip_r)
parse_mcast_src_ip(json_object_get_string(mcast_src_ip_r),
&ctx->rx_video_sessions[num_video].base,
MTL_SESSION_PORT_R);
ctx->rx_video_sessions[num_video].base.inf[1] = &ctx->interfaces[inf_r];
ctx->interfaces[inf_r].rx_video_sessions_cnt++;
}
Expand Down Expand Up @@ -2464,12 +2502,20 @@ int st_app_parse_json(st_json_context_t* ctx, const char* filename) {
for (int k = 0; k < replicas; ++k) {
parse_session_ip(json_object_get_string(ip_p),
&ctx->rx_audio_sessions[num_audio].base, MTL_SESSION_PORT_P);
if (mcast_src_ip_p)
parse_mcast_src_ip(json_object_get_string(mcast_src_ip_p),
&ctx->rx_audio_sessions[num_audio].base,
MTL_SESSION_PORT_P);
ctx->rx_audio_sessions[num_audio].base.inf[0] = &ctx->interfaces[inf_p];
ctx->interfaces[inf_p].rx_audio_sessions_cnt++;
if (num_inf == 2) {
parse_session_ip(json_object_get_string(ip_r),
&ctx->rx_audio_sessions[num_audio].base,
MTL_SESSION_PORT_R);
if (mcast_src_ip_r)
parse_mcast_src_ip(json_object_get_string(mcast_src_ip_r),
&ctx->rx_audio_sessions[num_audio].base,
MTL_SESSION_PORT_R);
ctx->rx_audio_sessions[num_audio].base.inf[1] = &ctx->interfaces[inf_r];
ctx->interfaces[inf_r].rx_audio_sessions_cnt++;
}
Expand Down Expand Up @@ -2497,11 +2543,18 @@ int st_app_parse_json(st_json_context_t* ctx, const char* filename) {
for (int k = 0; k < replicas; ++k) {
parse_session_ip(json_object_get_string(ip_p),
&ctx->rx_anc_sessions[num_anc].base, MTL_SESSION_PORT_P);
if (mcast_src_ip_p)
parse_mcast_src_ip(json_object_get_string(mcast_src_ip_p),
&ctx->rx_anc_sessions[num_anc].base, MTL_SESSION_PORT_P);
ctx->rx_anc_sessions[num_anc].base.inf[0] = &ctx->interfaces[inf_p];
ctx->interfaces[inf_p].rx_anc_sessions_cnt++;
if (num_inf == 2) {
parse_session_ip(json_object_get_string(ip_r),
&ctx->rx_anc_sessions[num_anc].base, MTL_SESSION_PORT_R);
if (mcast_src_ip_r)
parse_mcast_src_ip(json_object_get_string(mcast_src_ip_r),
&ctx->rx_anc_sessions[num_anc].base,
MTL_SESSION_PORT_R);
ctx->rx_anc_sessions[num_anc].base.inf[1] = &ctx->interfaces[inf_r];
ctx->interfaces[inf_r].rx_anc_sessions_cnt++;
}
Expand All @@ -2528,12 +2581,20 @@ int st_app_parse_json(st_json_context_t* ctx, const char* filename) {
for (int k = 0; k < replicas; ++k) {
parse_session_ip(json_object_get_string(ip_p),
&ctx->rx_st22p_sessions[num_st22p].base, MTL_SESSION_PORT_P);
if (mcast_src_ip_p)
parse_mcast_src_ip(json_object_get_string(mcast_src_ip_p),
&ctx->rx_st22p_sessions[num_st22p].base,
MTL_SESSION_PORT_P);
ctx->rx_st22p_sessions[num_st22p].base.inf[0] = &ctx->interfaces[inf_p];
ctx->interfaces[inf_p].rx_video_sessions_cnt++;
if (num_inf == 2) {
parse_session_ip(json_object_get_string(ip_r),
&ctx->rx_st22p_sessions[num_st22p].base,
MTL_SESSION_PORT_R);
if (mcast_src_ip_r)
parse_mcast_src_ip(json_object_get_string(mcast_src_ip_r),
&ctx->rx_st22p_sessions[num_st22p].base,
MTL_SESSION_PORT_R);
ctx->rx_st22p_sessions[num_st22p].base.inf[1] = &ctx->interfaces[inf_r];
ctx->interfaces[inf_r].rx_video_sessions_cnt++;
}
Expand Down Expand Up @@ -2562,12 +2623,20 @@ int st_app_parse_json(st_json_context_t* ctx, const char* filename) {
for (int k = 0; k < replicas; ++k) {
parse_session_ip(json_object_get_string(ip_p),
&ctx->rx_st20p_sessions[num_st20p].base, MTL_SESSION_PORT_P);
if (mcast_src_ip_p)
parse_mcast_src_ip(json_object_get_string(mcast_src_ip_p),
&ctx->rx_st20p_sessions[num_st20p].base,
MTL_SESSION_PORT_P);
ctx->rx_st20p_sessions[num_st20p].base.inf[0] = &ctx->interfaces[inf_p];
ctx->interfaces[inf_p].rx_video_sessions_cnt++;
if (num_inf == 2) {
parse_session_ip(json_object_get_string(ip_r),
&ctx->rx_st20p_sessions[num_st20p].base,
MTL_SESSION_PORT_R);
if (mcast_src_ip_r)
parse_mcast_src_ip(json_object_get_string(mcast_src_ip_r),
&ctx->rx_st20p_sessions[num_st20p].base,
MTL_SESSION_PORT_R);
ctx->rx_st20p_sessions[num_st20p].base.inf[1] = &ctx->interfaces[inf_r];
ctx->interfaces[inf_r].rx_video_sessions_cnt++;
}
Expand Down Expand Up @@ -2601,12 +2670,20 @@ int st_app_parse_json(st_json_context_t* ctx, const char* filename) {
for (int k = 0; k < replicas; ++k) {
parse_session_ip(json_object_get_string(ip_p),
&ctx->rx_st20r_sessions[num_st20r].base, MTL_SESSION_PORT_P);
if (mcast_src_ip_p)
parse_mcast_src_ip(json_object_get_string(mcast_src_ip_p),
&ctx->rx_st20r_sessions[num_st20r].base,
MTL_SESSION_PORT_P);
ctx->rx_st20r_sessions[num_st20r].base.inf[0] = &ctx->interfaces[inf_p];
ctx->interfaces[inf_p].rx_video_sessions_cnt++;
if (num_inf == 2) {
parse_session_ip(json_object_get_string(ip_r),
&ctx->rx_st20r_sessions[num_st20r].base,
MTL_SESSION_PORT_R);
if (mcast_src_ip_r)
parse_mcast_src_ip(json_object_get_string(mcast_src_ip_r),
&ctx->rx_st20r_sessions[num_st20r].base,
MTL_SESSION_PORT_R);
ctx->rx_st20r_sessions[num_st20r].base.inf[1] = &ctx->interfaces[inf_r];
ctx->interfaces[inf_r].rx_video_sessions_cnt++;
}
Expand Down
1 change: 1 addition & 0 deletions app/src/parse_json.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ enum st_json_ip_type {

typedef struct st_json_session_base {
uint8_t ip[MTL_SESSION_PORT_MAX][MTL_IP_ADDR_LEN];
uint8_t mcast_src_ip[MTL_SESSION_PORT_MAX][MTL_IP_ADDR_LEN];
st_json_interface_t* inf[MTL_SESSION_PORT_MAX];
int num_inf;
uint16_t udp_port;
Expand Down
6 changes: 6 additions & 0 deletions app/src/rx_ancillary_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ static int app_rx_anc_init(struct st_app_context* ctx, st_json_ancillary_session
anc ? st_json_ip(ctx, &anc->base, MTL_SESSION_PORT_P)
: ctx->rx_sip_addr[MTL_PORT_P],
MTL_IP_ADDR_LEN);
memcpy(ops.mcast_sip_addr[MTL_SESSION_PORT_P],
anc ? anc->base.mcast_src_ip[MTL_PORT_P] : ctx->rx_mcast_sip_addr[MTL_PORT_P],
MTL_IP_ADDR_LEN);
snprintf(ops.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s",
anc ? anc->base.inf[MTL_SESSION_PORT_P]->name : ctx->para.port[MTL_PORT_P]);
ops.udp_port[MTL_SESSION_PORT_P] = anc ? anc->base.udp_port : (10200 + s->idx);
Expand All @@ -138,6 +141,9 @@ static int app_rx_anc_init(struct st_app_context* ctx, st_json_ancillary_session
anc ? st_json_ip(ctx, &anc->base, MTL_SESSION_PORT_R)
: ctx->rx_sip_addr[MTL_PORT_R],
MTL_IP_ADDR_LEN);
memcpy(ops.mcast_sip_addr[MTL_SESSION_PORT_R],
anc ? anc->base.mcast_src_ip[MTL_PORT_R] : ctx->rx_mcast_sip_addr[MTL_PORT_R],
MTL_IP_ADDR_LEN);
snprintf(ops.port[MTL_SESSION_PORT_R], MTL_PORT_MAX_LEN, "%s",
anc ? anc->base.inf[MTL_SESSION_PORT_R]->name : ctx->para.port[MTL_PORT_R]);
ops.udp_port[MTL_SESSION_PORT_R] = anc ? anc->base.udp_port : (10200 + s->idx);
Expand Down
8 changes: 8 additions & 0 deletions app/src/rx_audio_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,10 @@ static int app_rx_audio_init(struct st_app_context* ctx, st_json_audio_session_t
audio ? st_json_ip(ctx, &audio->base, MTL_SESSION_PORT_P)
: ctx->rx_sip_addr[MTL_PORT_P],
MTL_IP_ADDR_LEN);
memcpy(
ops.mcast_sip_addr[MTL_SESSION_PORT_P],
audio ? audio->base.mcast_src_ip[MTL_PORT_P] : ctx->rx_mcast_sip_addr[MTL_PORT_P],
MTL_IP_ADDR_LEN);
snprintf(
ops.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s",
audio ? audio->base.inf[MTL_SESSION_PORT_P]->name : ctx->para.port[MTL_PORT_P]);
Expand All @@ -240,6 +244,10 @@ static int app_rx_audio_init(struct st_app_context* ctx, st_json_audio_session_t
audio ? st_json_ip(ctx, &audio->base, MTL_SESSION_PORT_R)
: ctx->rx_sip_addr[MTL_PORT_R],
MTL_IP_ADDR_LEN);
memcpy(
ops.mcast_sip_addr[MTL_SESSION_PORT_R],
audio ? audio->base.mcast_src_ip[MTL_PORT_R] : ctx->rx_mcast_sip_addr[MTL_PORT_R],
MTL_IP_ADDR_LEN);
snprintf(ops.port[MTL_SESSION_PORT_R], MTL_PORT_MAX_LEN, "%s",
audio ? audio->base.inf[MTL_PORT_R]->name : ctx->para.port[MTL_PORT_R]);
ops.udp_port[MTL_SESSION_PORT_R] = audio ? audio->base.udp_port : (10100 + s->idx);
Expand Down
8 changes: 8 additions & 0 deletions app/src/rx_st20p_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ static int app_rx_st20p_init(struct st_app_context* ctx,
st20p ? st_json_ip(ctx, &st20p->base, MTL_SESSION_PORT_P)
: ctx->rx_sip_addr[MTL_PORT_P],
MTL_IP_ADDR_LEN);
memcpy(
ops.port.mcast_sip_addr[MTL_SESSION_PORT_P],
st20p ? st20p->base.mcast_src_ip[MTL_PORT_P] : ctx->rx_mcast_sip_addr[MTL_PORT_P],
MTL_IP_ADDR_LEN);
snprintf(
ops.port.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s",
st20p ? st20p->base.inf[MTL_SESSION_PORT_P]->name : ctx->para.port[MTL_PORT_P]);
Expand All @@ -208,6 +212,10 @@ static int app_rx_st20p_init(struct st_app_context* ctx,
st20p ? st_json_ip(ctx, &st20p->base, MTL_SESSION_PORT_R)
: ctx->rx_sip_addr[MTL_PORT_R],
MTL_IP_ADDR_LEN);
memcpy(
ops.port.mcast_sip_addr[MTL_SESSION_PORT_R],
st20p ? st20p->base.mcast_src_ip[MTL_PORT_R] : ctx->rx_mcast_sip_addr[MTL_PORT_R],
MTL_IP_ADDR_LEN);
snprintf(
ops.port.port[MTL_SESSION_PORT_R], MTL_PORT_MAX_LEN, "%s",
st20p ? st20p->base.inf[MTL_SESSION_PORT_R]->name : ctx->para.port[MTL_PORT_R]);
Expand Down
8 changes: 8 additions & 0 deletions app/src/rx_st20r_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ static int app_rx_st20r_init(struct st_app_context* ctx, st_json_video_session_t
video ? st_json_ip(ctx, &video->base, MTL_SESSION_PORT_P)
: ctx->rx_sip_addr[MTL_PORT_P],
MTL_IP_ADDR_LEN);
memcpy(
ops.mcast_sip_addr[MTL_SESSION_PORT_P],
video ? video->base.mcast_src_ip[MTL_PORT_P] : ctx->rx_mcast_sip_addr[MTL_PORT_P],
MTL_IP_ADDR_LEN);
snprintf(ops.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s",
video ? video->base.inf[MTL_PORT_P]->name : ctx->para.port[MTL_PORT_P]);
ops.udp_port[MTL_SESSION_PORT_P] = video ? video->base.udp_port : (10000 + s->idx);
Expand All @@ -267,6 +271,10 @@ static int app_rx_st20r_init(struct st_app_context* ctx, st_json_video_session_t
video ? st_json_ip(ctx, &video->base, MTL_SESSION_PORT_R)
: ctx->rx_sip_addr[MTL_PORT_R],
MTL_IP_ADDR_LEN);
memcpy(
ops.mcast_sip_addr[MTL_SESSION_PORT_R],
video ? video->base.mcast_src_ip[MTL_PORT_R] : ctx->rx_mcast_sip_addr[MTL_PORT_R],
MTL_IP_ADDR_LEN);
snprintf(
ops.port[MTL_SESSION_PORT_R], MTL_PORT_MAX_LEN, "%s",
video ? video->base.inf[MTL_SESSION_PORT_R]->name : ctx->para.port[MTL_PORT_R]);
Expand Down
4 changes: 4 additions & 0 deletions app/src/rx_st22_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,16 @@ static int app_rx_st22_init(struct st_app_context* ctx, struct st22_app_rx_sessi
ops.priv = s;
ops.num_port = ctx->para.num_ports;
memcpy(ops.sip_addr[MTL_SESSION_PORT_P], ctx->rx_sip_addr[MTL_PORT_P], MTL_IP_ADDR_LEN);
memcpy(ops.mcast_sip_addr[MTL_SESSION_PORT_P], ctx->rx_mcast_sip_addr[MTL_PORT_P],
MTL_IP_ADDR_LEN);
snprintf(ops.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s",
ctx->para.port[MTL_PORT_P]);
ops.udp_port[MTL_SESSION_PORT_P] = 15000 + s->idx;
if (ops.num_port > 1) {
memcpy(ops.sip_addr[MTL_SESSION_PORT_R], ctx->rx_sip_addr[MTL_PORT_R],
MTL_IP_ADDR_LEN);
memcpy(ops.mcast_sip_addr[MTL_SESSION_PORT_R], ctx->rx_mcast_sip_addr[MTL_PORT_R],
MTL_IP_ADDR_LEN);
snprintf(ops.port[MTL_SESSION_PORT_R], MTL_PORT_MAX_LEN, "%s",
ctx->para.port[MTL_PORT_R]);
ops.udp_port[MTL_SESSION_PORT_R] = 15000 + s->idx;
Expand Down
8 changes: 8 additions & 0 deletions app/src/rx_st22p_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ static int app_rx_st22p_init(struct st_app_context* ctx,
st22p ? st_json_ip(ctx, &st22p->base, MTL_SESSION_PORT_P)
: ctx->rx_sip_addr[MTL_PORT_P],
MTL_IP_ADDR_LEN);
memcpy(
ops.port.mcast_sip_addr[MTL_SESSION_PORT_P],
st22p ? st22p->base.mcast_src_ip[MTL_PORT_P] : ctx->rx_mcast_sip_addr[MTL_PORT_P],
MTL_IP_ADDR_LEN);
snprintf(
ops.port.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s",
st22p ? st22p->base.inf[MTL_SESSION_PORT_P]->name : ctx->para.port[MTL_PORT_P]);
Expand All @@ -153,6 +157,10 @@ static int app_rx_st22p_init(struct st_app_context* ctx,
st22p ? st_json_ip(ctx, &st22p->base, MTL_SESSION_PORT_R)
: ctx->rx_sip_addr[MTL_PORT_R],
MTL_IP_ADDR_LEN);
memcpy(
ops.port.mcast_sip_addr[MTL_SESSION_PORT_R],
st22p ? st22p->base.mcast_src_ip[MTL_PORT_R] : ctx->rx_mcast_sip_addr[MTL_PORT_R],
MTL_IP_ADDR_LEN);
snprintf(
ops.port.port[MTL_SESSION_PORT_R], MTL_PORT_MAX_LEN, "%s",
st22p ? st22p->base.inf[MTL_SESSION_PORT_R]->name : ctx->para.port[MTL_PORT_R]);
Expand Down
8 changes: 8 additions & 0 deletions app/src/rx_video_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,10 @@ static int app_rx_video_init(struct st_app_context* ctx, st_json_video_session_t
video ? st_json_ip(ctx, &video->base, MTL_SESSION_PORT_P)
: ctx->rx_sip_addr[MTL_PORT_P],
MTL_IP_ADDR_LEN);
memcpy(
ops.mcast_sip_addr[MTL_SESSION_PORT_P],
video ? video->base.mcast_src_ip[MTL_PORT_P] : ctx->rx_mcast_sip_addr[MTL_PORT_P],
MTL_IP_ADDR_LEN);
snprintf(
ops.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s",
video ? video->base.inf[MTL_SESSION_PORT_P]->name : ctx->para.port[MTL_PORT_P]);
Expand All @@ -511,6 +515,10 @@ static int app_rx_video_init(struct st_app_context* ctx, st_json_video_session_t
video ? st_json_ip(ctx, &video->base, MTL_SESSION_PORT_R)
: ctx->rx_sip_addr[MTL_PORT_R],
MTL_IP_ADDR_LEN);
memcpy(
ops.mcast_sip_addr[MTL_SESSION_PORT_R],
video ? video->base.mcast_src_ip[MTL_PORT_R] : ctx->rx_mcast_sip_addr[MTL_PORT_R],
MTL_IP_ADDR_LEN);
snprintf(
ops.port[MTL_SESSION_PORT_R], MTL_PORT_MAX_LEN, "%s",
video ? video->base.inf[MTL_SESSION_PORT_R]->name : ctx->para.port[MTL_PORT_R]);
Expand Down
Loading

0 comments on commit 8ea0346

Please sign in to comment.