diff --git a/app/src/rx_video_app.c b/app/src/rx_video_app.c index c8ba34858..12aba5e00 100644 --- a/app/src/rx_video_app.c +++ b/app/src/rx_video_app.c @@ -558,12 +558,9 @@ static int app_rx_video_init(struct st_app_context* ctx, st_json_video_session_t s->slice = false; } if (ctx->enable_hdr_split) ops.flags |= ST20_RX_FLAG_HDR_SPLIT; - struct st_rx_rtcp_ops ops_rtcp; - memset(&ops_rtcp, 0, sizeof(ops_rtcp)); if (video && video->enable_rtcp) { ops.flags |= ST20_RX_FLAG_ENABLE_RTCP; - ops_rtcp.nack_interval_us = 250; - ops.rtcp = &ops_rtcp; + ops.rtcp.nack_interval_us = 250; } if (ctx->enable_timing_parser) ops.flags |= ST20_RX_FLAG_ENABLE_TIMING_PARSER; diff --git a/app/src/tx_video_app.c b/app/src/tx_video_app.c index 4b00e7ab5..a64dec16e 100644 --- a/app/src/tx_video_app.c +++ b/app/src/tx_video_app.c @@ -790,12 +790,9 @@ static int app_tx_video_init(struct st_app_context* ctx, st_json_video_session_t if (ctx->tx_ts_epoch) ops.flags |= ST20_TX_FLAG_RTP_TIMESTAMP_EPOCH; if (ctx->tx_no_bulk) ops.flags |= ST20_TX_FLAG_DISABLE_BULK; - struct st_tx_rtcp_ops ops_rtcp; - memset(&ops_rtcp, 0, sizeof(ops_rtcp)); if (video && video->enable_rtcp) { ops.flags |= ST20_TX_FLAG_ENABLE_RTCP; - ops_rtcp.rtcp_buffer_size = 1024; - ops.rtcp = &ops_rtcp; + ops.rtcp.buffer_size = 1024; } ret = st20_get_pgroup(ops.fmt, &s->st20_pg); diff --git a/doc/design.md b/doc/design.md index a47934281..52fc26ed1 100644 --- a/doc/design.md +++ b/doc/design.md @@ -413,7 +413,7 @@ The TX side maintains a buffer ring that retains recently transmitted packets. U It's important to be mindful that the RTCP retransmission method used by IMTL for packet loss recovery is not a standardized feature within the SMPTE ST 2110 suite. Consequently, this approach may not be compatible with non-IMTL implementations. -It can be enabled by `ST**_TX_FLAG_ENABLE_RTCP` and `ST**_RX_FLAG_ENABLE_RTCP`, and the configuration for RTCP can be customized by `struct st_tx_rtcp_ops` and `struct st_rx_rtcp_ops`. +It can be enabled by `ST**_TX_FLAG_ENABLE_RTCP` and `ST**_RX_FLAG_ENABLE_RTCP`, and the configuration for RTCP can be customized by `ops.rtcp` (`struct st_tx_rtcp_ops` and `struct st_rx_rtcp_ops`). For more details, please refer to [RTCP doc](rtcp.md). diff --git a/doc/rtcp.md b/doc/rtcp.md index b218828b8..a11c131e0 100644 --- a/doc/rtcp.md +++ b/doc/rtcp.md @@ -22,23 +22,19 @@ This real-time detection and correction process serves to maintain the continuit To enable and configure RTCP in IMTL for packet loss handling, the following code snippet provides a template: ```cpp -struct st_tx_rtcp_ops ops_tx_rtcp; ops_tx.flags |= ST20P_TX_FLAG_ENABLE_RTCP; // Enabling RTCP on the transmitter side -ops_tx_rtcp.rtcp_buffer_size = 1024; // Setting RTCP buffer size for retransmission -ops_tx.rtcp = &ops_tx_rtcp; // Linking RTCP operations to the transmitter config +ops.rtcp.buffer_size = 1024; // Setting RTCP buffer size for retransmission -struct st_rx_rtcp_ops ops_rx_rtcp; ops_rx.flags |= ST20P_RX_FLAG_ENABLE_RTCP; // Enabling RTCP on the receiver side -ops_rx_rtcp.nack_interval_us = 250; // Defining the NACK interval for loss detection (in microseconds) -ops_rx_rtcp.seq_bitmap_size = 64; // The size of the sequence number bitmap for tracking packet loss -ops_rx_rtcp.seq_skip_window = 0; // The allowable sequence number skip window -ops_rx.rtcp = &ops_rx_rtcp; // Linking RTCP operations to the receiver config +ops.rtcp.nack_interval_us = 250; // Defining the NACK interval for loss detection (in microseconds) +ops.rtcp.seq_bitmap_size = 64; // The size of the sequence number bitmap for tracking packet loss +ops.rtcp.seq_skip_window = 4; // The allowable sequence number skip window ``` In this configuration: - The `ST20P_TX_FLAG_ENABLE_RTCP` and `ST20P_RX_FLAG_ENABLE_RTCP` flags are set to enable RTCP on both transmission and reception paths, respectively. Other supported session types are `st20`, `st22` and `st22p`. -- The transmitter's `rtcp_buffer_size` sets the buffer capacity for storing packets which might need to be retransmitted. +- The transmitter's `rtcp_buffer_size` sets the buffer capacity for storing packets which might need to be retransmitted. The buffer size should not be less than tx descriptor size. - The receiver's `nack_interval_us` specifies how frequently it will check and potentially request retransmission of lost packets. - The `seq_bitmap_size` determines the range of sequence numbers the receiver will monitor for loss detection. The total number of packets for tracking is `seq_bitmap_size * 8`. - The `seq_skip_window` configures the permissible range within which out-of-order packets will be accepted without triggering a NACK. diff --git a/include/st20_api.h b/include/st20_api.h index 114cf51eb..339b5cf93 100644 --- a/include/st20_api.h +++ b/include/st20_api.h @@ -955,10 +955,11 @@ struct st20_ext_frame { struct st_tx_rtcp_ops { /** * The size of the packets buffer for RTCP, should be power of two. + * This value should not be less than nb_tx_desc. * Only used when ST20(P)/22(P)_TX_FLAG_ENABLE_RTCP flag set. * If leave it to 0 the lib will use ST_TX_VIDEO_RTCP_RING_SIZE. */ - uint16_t rtcp_buffer_size; + uint16_t buffer_size; }; /** @@ -1038,7 +1039,7 @@ struct st20_tx_ops { */ int (*notify_event)(void* priv, enum st_event event, void* args); /** Optional for ST20_TX_FLAG_ENABLE_RTCP. RTCP info */ - struct st_tx_rtcp_ops* rtcp; + struct st_tx_rtcp_ops rtcp; /** * Optional. Session linesize(stride) in bytes, leave to zero if no padding for each * line. Valid linesize should be wider than width size. @@ -1188,7 +1189,7 @@ struct st22_tx_ops { /** Optional. UDP source port number, leave as 0 to use same port as destination port */ uint16_t udp_src_port[MTL_SESSION_PORT_MAX]; /** Optional for ST20_TX_FLAG_ENABLE_RTCP. RTCP info */ - struct st_tx_rtcp_ops* rtcp; + struct st_tx_rtcp_ops rtcp; /** Optional. The tx destination mac address if ST20_TX_FLAG_USER_P(R)_MAC is enabled */ uint8_t tx_dst_mac[MTL_SESSION_PORT_MAX][MTL_MAC_ADDR_LEN]; @@ -1360,7 +1361,7 @@ struct st20_rx_ops { */ int (*notify_event)(void* priv, enum st_event event, void* args); /** Optional for ST20_RX_FLAG_ENABLE_RTCP. RTCP info */ - struct st_rx_rtcp_ops* rtcp; + struct st_rx_rtcp_ops rtcp; /** * Optional. Session linesize(stride) in bytes, leave to zero if no padding for each * line. Valid linesize should be wider than width size. @@ -1504,7 +1505,7 @@ struct st22_rx_ops { */ int (*notify_event)(void* priv, enum st_event event, void* args); /** Optional for ST22_RX_FLAG_ENABLE_RTCP, RTCP info */ - struct st_rx_rtcp_ops* rtcp; + struct st_rx_rtcp_ops rtcp; /** Mandatory for ST22_TYPE_RTP_LEVEL. rtp ring queue size, must be power of 2 */ uint32_t rtp_ring_size; diff --git a/include/st_pipeline_api.h b/include/st_pipeline_api.h index dfc907a6d..ab0546dbe 100644 --- a/include/st_pipeline_api.h +++ b/include/st_pipeline_api.h @@ -792,7 +792,7 @@ struct st20p_tx_ops { size_t transport_linesize; /** Optional for ST20P_TX_FLAG_ENABLE_RTCP. RTCP info */ - struct st_tx_rtcp_ops* rtcp; + struct st_tx_rtcp_ops rtcp; /** * Optional. tx destination mac address. * Valid if ST20P_TX_FLAG_USER_P(R)_MAC is enabled @@ -872,7 +872,7 @@ struct st20p_rx_ops { /** Optional. Array of external frames */ struct st_ext_frame* ext_frames; /** Optional for ST20_RX_FLAG_ENABLE_RTCP. RTCP info */ - struct st_rx_rtcp_ops* rtcp; + struct st_rx_rtcp_ops rtcp; /** * Optional. Callback when the lib query next external frame's data address. * And only non-block method can be used within this callback as it run from lcore @@ -943,7 +943,7 @@ struct st22p_tx_ops { int (*notify_frame_done)(void* priv, struct st_frame* frame); /** Optional for ST22P_TX_FLAG_ENABLE_RTCP. RTCP info */ - struct st_tx_rtcp_ops* rtcp; + struct st_tx_rtcp_ops rtcp; /** * Optional. tx destination mac address. * Valid if ST22P_TX_FLAG_USER_P(R)_MAC is enabled @@ -997,7 +997,7 @@ struct st22p_rx_ops { * interlaced, it's the expected codestream size for each field */ size_t max_codestream_size; /** Optional for ST22P_RX_FLAG_ENABLE_RTCP. RTCP info */ - struct st_rx_rtcp_ops* rtcp; + struct st_rx_rtcp_ops rtcp; /** * Optional. Callback when frame available in the lib. * And only non-block method can be used within this callback as it run from lcore diff --git a/lib/src/mt_rtcp.c b/lib/src/mt_rtcp.c index 463115932..826f01940 100644 --- a/lib/src/mt_rtcp.c +++ b/lib/src/mt_rtcp.c @@ -359,21 +359,29 @@ static int rtcp_rx_stat(void* priv) { struct mt_rtcp_tx* mt_rtcp_tx_create(struct mtl_main_impl* impl, struct mt_rtcp_tx_ops* ops) { + const enum mtl_port port = ops->port; + const char* name = ops->name; struct mt_rtcp_tx* tx = - mt_rte_zmalloc_socket(sizeof(struct mt_rtcp_tx), mt_socket_id(impl, ops->port)); + mt_rte_zmalloc_socket(sizeof(struct mt_rtcp_tx), mt_socket_id(impl, port)); if (!tx) { - err("%s(%s), failed to allocate memory for mt_rtcp_tx\n", __func__, ops->name); + err("%s(%s), failed to allocate memory for mt_rtcp_tx\n", __func__, name); return NULL; } tx->parent = impl; - tx->port = ops->port; + tx->port = port; tx->payload_format = ops->payload_format; + if (ops->buffer_size < mt_if_nb_tx_desc(impl, port)) { + warn("%s(%s), buffer_size(%u) is small, adjust to nb_tx_desc(%u)\n", __func__, name, + ops->buffer_size, mt_if_nb_tx_desc(impl, port)); + ops->buffer_size = mt_if_nb_tx_desc(impl, port); + } + + uint32_t n = ops->buffer_size + mt_if_nb_tx_desc(impl, port); struct rte_mempool* pool = - mt_mempool_create(impl, ops->port, ops->name, ops->buffer_size, MT_MBUF_CACHE_SIZE, - 0, MTL_MTU_MAX_BYTES); + mt_mempool_create(impl, port, name, n, MT_MBUF_CACHE_SIZE, 0, MTL_MTU_MAX_BYTES); if (!pool) { - err("%s(%s), failed to create mempool for mt_rtcp_tx\n", __func__, ops->name); + err("%s(%s), failed to create mempool for mt_rtcp_tx\n", __func__, name); mt_rtcp_tx_free(tx); return NULL; } @@ -383,31 +391,30 @@ struct mt_rtcp_tx* mt_rtcp_tx_create(struct mtl_main_impl* impl, memset(&flow, 0, sizeof(flow)); mtl_memcpy(&flow.dip_addr, &ops->udp_hdr->ipv4.dst_addr, MTL_IP_ADDR_LEN); flow.dst_port = ntohs(ops->udp_hdr->udp.dst_port) - 1; /* rtp port */ - struct mt_txq_entry* q = mt_txq_get(impl, ops->port, &flow); + struct mt_txq_entry* q = mt_txq_get(impl, port, &flow); if (!q) { - err("%s(%s), failed to create queue for mt_rtcp_tx\n", __func__, ops->name); + err("%s(%s), failed to create queue for mt_rtcp_tx\n", __func__, name); mt_rtcp_tx_free(tx); return NULL; } tx->mbuf_queue = q; - struct mt_u64_fifo* ring = - mt_u64_fifo_init(ops->buffer_size, mt_socket_id(impl, ops->port)); + struct mt_u64_fifo* ring = mt_u64_fifo_init(ops->buffer_size, mt_socket_id(impl, port)); if (!ring) { - err("%s(%s), failed to create ring for mt_rtcp_tx\n", __func__, ops->name); + err("%s(%s), failed to create ring for mt_rtcp_tx\n", __func__, name); mt_rtcp_tx_free(tx); return NULL; } tx->mbuf_ring = ring; tx->ssrc = ops->ssrc; - snprintf(tx->name, sizeof(tx->name) - 1, "%s", ops->name); + snprintf(tx->name, sizeof(tx->name) - 1, "%s", name); rte_memcpy(&tx->udp_hdr, ops->udp_hdr, sizeof(tx->udp_hdr)); mt_stat_register(impl, rtcp_tx_stat, tx, tx->name); tx->active = true; - info("%s(%s), suss\n", __func__, tx->name); + info("%s(%s), suss\n", __func__, name); return tx; } @@ -444,25 +451,27 @@ void mt_rtcp_tx_free(struct mt_rtcp_tx* tx) { struct mt_rtcp_rx* mt_rtcp_rx_create(struct mtl_main_impl* impl, struct mt_rtcp_rx_ops* ops) { + const enum mtl_port port = ops->port; + const char* name = ops->name; struct mt_rtcp_rx* rx = - mt_rte_zmalloc_socket(sizeof(struct mt_rtcp_rx), mt_socket_id(impl, ops->port)); + mt_rte_zmalloc_socket(sizeof(struct mt_rtcp_rx), mt_socket_id(impl, port)); if (!rx) { - err("%s(%s), failed to allocate memory for mt_rtcp_rx\n", __func__, ops->name); + err("%s(%s), failed to allocate memory for mt_rtcp_rx\n", __func__, name); return NULL; } rx->parent = impl; - rx->port = ops->port; + rx->port = port; rx->ssrc = 0; rx->nacks_send_interval = ops->nacks_send_interval; rx->nacks_send_time = mt_get_tsc(impl); - snprintf(rx->name, sizeof(rx->name) - 1, "%s", ops->name); + snprintf(rx->name, sizeof(rx->name) - 1, "%s", name); rte_memcpy(&rx->udp_hdr, ops->udp_hdr, sizeof(rx->udp_hdr)); uint8_t* seq_bitmap = mt_rte_zmalloc_socket(sizeof(uint8_t) * ops->seq_bitmap_size, - mt_socket_id(impl, rx->port)); + mt_socket_id(impl, port)); if (!seq_bitmap) { - err("%s(%s), failed to allocate memory for seq_bitmap\n", __func__, rx->name); + err("%s(%s), failed to allocate memory for seq_bitmap\n", __func__, name); mt_rtcp_rx_free(rx); return NULL; } @@ -472,7 +481,7 @@ struct mt_rtcp_rx* mt_rtcp_rx_create(struct mtl_main_impl* impl, mt_stat_register(impl, rtcp_rx_stat, rx, rx->name); rx->active = true; - info("%s(%s), suss\n", __func__, rx->name); + info("%s(%s), suss\n", __func__, name); return rx; } diff --git a/lib/src/st2110/st_rx_video_session.c b/lib/src/st2110/st_rx_video_session.c index f7dc95c0b..4679b8363 100644 --- a/lib/src/st2110/st_rx_video_session.c +++ b/lib/src/st2110/st_rx_video_session.c @@ -2822,16 +2822,16 @@ static int rv_init_rtcp(struct mtl_main_impl* impl, struct st_rx_video_sessions_ if (ret < 0) return ret; char name[MT_RTCP_MAX_NAME_LEN]; snprintf(name, sizeof(name), ST_RX_VIDEO_PREFIX "M%dS%dP%d", mgr_idx, idx, i); + if (!ops->rtcp.nack_interval_us) + ops->rtcp.nack_interval_us = 250; /* default 250 us */ + if (!ops->rtcp.seq_bitmap_size) ops->rtcp.seq_bitmap_size = 64; struct mt_rtcp_rx_ops rtcp_ops = { .port = port, .name = name, .udp_hdr = &uhdr, - .nacks_send_interval = (ops->rtcp && ops->rtcp->nack_interval_us) - ? ops->rtcp->nack_interval_us * NS_PER_US - : 250 * NS_PER_US, - .seq_bitmap_size = - (ops->rtcp && ops->rtcp->seq_bitmap_size) ? ops->rtcp->seq_bitmap_size : 64, - .seq_skip_window = (ops->rtcp) ? ops->rtcp->seq_skip_window : 4, + .nacks_send_interval = ops->rtcp.nack_interval_us * NS_PER_US, + .seq_bitmap_size = ops->rtcp.seq_bitmap_size, + .seq_skip_window = ops->rtcp.seq_skip_window, /* this can be 0 */ }; s->rtcp_rx[i] = mt_rtcp_rx_create(impl, &rtcp_ops); if (!s->rtcp_rx[i]) { @@ -2953,13 +2953,11 @@ static int rv_attach(struct mtl_main_impl* impl, struct st_rx_video_sessions_mgr /* init simulated packet loss for test usage */ if (s->ops.flags & ST20_RX_FLAG_SIMULATE_PKT_LOSS) { - uint16_t burst_loss_max = 32; - float sim_loss_rate = 0.0001; - if (ops->rtcp) { - if (ops->rtcp->burst_loss_max) burst_loss_max = ops->rtcp->burst_loss_max; - if (ops->rtcp->sim_loss_rate > 0.0 && ops->rtcp->sim_loss_rate < 1.0) - sim_loss_rate = ops->rtcp->sim_loss_rate; - } + uint16_t burst_loss_max = 1; + float sim_loss_rate = 0.1; + if (ops->rtcp.burst_loss_max) burst_loss_max = ops->rtcp.burst_loss_max; + if (ops->rtcp.sim_loss_rate > 0.0 && ops->rtcp.sim_loss_rate < 1.0) + sim_loss_rate = ops->rtcp.sim_loss_rate; s->burst_loss_max = burst_loss_max; s->sim_loss_rate = sim_loss_rate; info("%s(%d), simulated packet loss max burst %u rate %f\n", __func__, idx, diff --git a/lib/src/st2110/st_tx_video_session.c b/lib/src/st2110/st_tx_video_session.c index 0e38bb84a..06c4a359c 100644 --- a/lib/src/st2110/st_tx_video_session.c +++ b/lib/src/st2110/st_tx_video_session.c @@ -881,9 +881,8 @@ static int tv_init_rtcp(struct mtl_main_impl* impl, struct st_tx_video_sessions_ mtl_memcpy(&hdr, &s->s_hdr[i], sizeof(hdr)); hdr.udp.dst_port++; rtcp_ops.udp_hdr = &hdr; - rtcp_ops.buffer_size = (ops->rtcp && ops->rtcp->rtcp_buffer_size) - ? ops->rtcp->rtcp_buffer_size - : ST_TX_VIDEO_RTCP_RING_SIZE; + if (!ops->rtcp.buffer_size) ops->rtcp.buffer_size = ST_TX_VIDEO_RTCP_RING_SIZE; + rtcp_ops.buffer_size = ops->rtcp.buffer_size; if (s->st22_info) rtcp_ops.payload_format = MT_RTP_PAYLOAD_FORMAT_RFC9134; else @@ -2568,7 +2567,7 @@ static int tv_mempool_init(struct mtl_main_impl* impl, s->mbuf_mempool_hdr[i], i); } else { n = mt_if_nb_tx_desc(impl, port) + s->ring_count; - if (ops->flags & ST20_TX_FLAG_ENABLE_RTCP) n += ST_TX_VIDEO_RTCP_RING_SIZE; + if (ops->flags & ST20_TX_FLAG_ENABLE_RTCP) n += ops->rtcp.buffer_size; if (ops->type == ST20_TYPE_RTP_LEVEL) n += ops->rtp_ring_size; if (s->mbuf_mempool_hdr[i]) { warn("%s(%d), use previous hdr mempool for port %d\n", __func__, idx, i); @@ -2592,7 +2591,7 @@ static int tv_mempool_init(struct mtl_main_impl* impl, if (!s->tx_no_chain) { port = mt_port_logic2phy(s->port_maps, MTL_SESSION_PORT_P); n = mt_if_nb_tx_desc(impl, port) + s->ring_count; - if (ops->flags & ST20_TX_FLAG_ENABLE_RTCP) n += ST_TX_VIDEO_RTCP_RING_SIZE; + if (ops->flags & ST20_TX_FLAG_ENABLE_RTCP) n += ops->rtcp.buffer_size; if (ops->type == ST20_TYPE_RTP_LEVEL) n += ops->rtp_ring_size; if (s->tx_mono_pool) { diff --git a/manager/mtl_interface.hpp b/manager/mtl_interface.hpp index ce1d5ed27..bceb8203c 100644 --- a/manager/mtl_interface.hpp +++ b/manager/mtl_interface.hpp @@ -156,9 +156,13 @@ int mtl_interface::load_xdp() { xdp_prog = nullptr; } else { if (xdp_program__attach(xdp_prog, ifindex, XDP_MODE_NATIVE, 0) < 0) { - log(log_level::ERROR, "Failed to attach XDP program " + xdp_prog_path); - xdp_program__close(xdp_prog); - return -1; + log(log_level::WARNING, + "Failed to attach XDP program with native mode, try skb mode."); + if (xdp_program__attach(xdp_prog, ifindex, XDP_MODE_SKB, 0) < 0) { + log(log_level::ERROR, "Failed to attach XDP program " + xdp_prog_path); + xdp_program__close(xdp_prog); + return -1; + } } } } diff --git a/tests/src/st20_test.cpp b/tests/src/st20_test.cpp index ed503b821..5bd4ba3be 100644 --- a/tests/src/st20_test.cpp +++ b/tests/src/st20_test.cpp @@ -1880,12 +1880,9 @@ static void st20_rx_digest_test(enum st20_type tx_type[], enum st20_type rx_type if (tx_type[i] == ST20_TYPE_RTP_LEVEL) { rtp_tx_specific_init(&ops_tx, test_ctx_tx[i]); } - struct st_tx_rtcp_ops ops_tx_rtcp; - memset(&ops_tx_rtcp, 0, sizeof(ops_tx_rtcp)); if (enable_rtcp) { ops_tx.flags |= ST20_TX_FLAG_ENABLE_RTCP; - ops_tx_rtcp.rtcp_buffer_size = 1024; - ops_tx.rtcp = &ops_tx_rtcp; + ops_tx.rtcp.buffer_size = 1024; } // out of order @@ -1973,16 +1970,13 @@ static void st20_rx_digest_test(enum st20_type tx_type[], enum st20_type rx_type ops_rx.rtp_ring_size = 1024 * 2; ops_rx.flags = ST20_RX_FLAG_DMA_OFFLOAD; if (hdr_split) ops_rx.flags |= ST20_RX_FLAG_HDR_SPLIT; - struct st_rx_rtcp_ops ops_rx_rtcp; - memset(&ops_rx_rtcp, 0, sizeof(ops_rx_rtcp)); if (enable_rtcp) { ops_rx.flags |= ST20_RX_FLAG_ENABLE_RTCP | ST20_RX_FLAG_SIMULATE_PKT_LOSS; - ops_rx_rtcp.nack_interval_us = 250; - ops_rx_rtcp.seq_bitmap_size = 32; - ops_rx_rtcp.seq_skip_window = 10; - ops_rx_rtcp.burst_loss_max = 32; - ops_rx_rtcp.sim_loss_rate = 0.0001; - ops_rx.rtcp = &ops_rx_rtcp; + ops_rx.rtcp.nack_interval_us = 250; + ops_rx.rtcp.seq_bitmap_size = 32; + ops_rx.rtcp.seq_skip_window = 10; + ops_rx.rtcp.burst_loss_max = 32; + ops_rx.rtcp.sim_loss_rate = 0.0001; } if (rx_type[i] == ST20_TYPE_SLICE_LEVEL) { diff --git a/tests/src/st20p_test.cpp b/tests/src/st20p_test.cpp index 564689ab7..1f6051342 100644 --- a/tests/src/st20p_test.cpp +++ b/tests/src/st20p_test.cpp @@ -765,12 +765,9 @@ static void st20p_rx_digest_test(enum st_fps fps[], int width[], int height[], if (para->user_timestamp) ops_tx.flags |= ST20P_TX_FLAG_USER_TIMESTAMP; if (para->vsync) ops_tx.flags |= ST20P_TX_FLAG_ENABLE_VSYNC; - struct st_tx_rtcp_ops ops_tx_rtcp; - memset(&ops_tx_rtcp, 0, sizeof(ops_tx_rtcp)); if (para->rtcp) { ops_tx.flags |= ST20P_TX_FLAG_ENABLE_RTCP; - ops_tx_rtcp.rtcp_buffer_size = 1024; - ops_tx.rtcp = &ops_tx_rtcp; + ops_tx.rtcp.buffer_size = 1024; } uint8_t planes = st_frame_fmt_planes(tx_fmt[i]); @@ -992,16 +989,13 @@ static void st20p_rx_digest_test(enum st_fps fps[], int width[], int height[], if (para->vsync) ops_rx.flags |= ST20P_RX_FLAG_ENABLE_VSYNC; if (para->pkt_convert) ops_rx.flags |= ST20P_RX_FLAG_PKT_CONVERT; - struct st_rx_rtcp_ops ops_rx_rtcp; - memset(&ops_rx_rtcp, 0, sizeof(ops_rx_rtcp)); if (para->rtcp) { ops_rx.flags |= ST20P_RX_FLAG_ENABLE_RTCP | ST20P_RX_FLAG_SIMULATE_PKT_LOSS; - ops_rx_rtcp.nack_interval_us = 250; - ops_rx_rtcp.seq_bitmap_size = 64; - ops_rx_rtcp.seq_skip_window = 0; - ops_rx_rtcp.burst_loss_max = 1; - ops_rx_rtcp.sim_loss_rate = 0.1; - ops_rx.rtcp = &ops_rx_rtcp; + ops_rx.rtcp.nack_interval_us = 250; + ops_rx.rtcp.seq_bitmap_size = 64; + ops_rx.rtcp.seq_skip_window = 0; + ops_rx.rtcp.burst_loss_max = 1; + ops_rx.rtcp.sim_loss_rate = 0.1; } rx_handle[i] = st20p_rx_create(st, &ops_rx); diff --git a/tests/src/st22_test.cpp b/tests/src/st22_test.cpp index c35e95247..519256a11 100644 --- a/tests/src/st22_test.cpp +++ b/tests/src/st22_test.cpp @@ -1255,12 +1255,9 @@ static void st22_rx_digest_test(enum st_fps fps[], int width[], int height[], ops_tx.rtp_frame_total_pkts = test_ctx_tx[i]->total_pkts_in_frame; ops_tx.notify_frame_done = st22_frame_done; ops_tx.get_next_frame = st22_next_video_frame; - struct st_tx_rtcp_ops ops_tx_rtcp; - memset(&ops_tx_rtcp, 0, sizeof(ops_tx_rtcp)); if (enable_rtcp) { ops_tx.flags |= ST22_TX_FLAG_ENABLE_RTCP; - ops_tx_rtcp.rtcp_buffer_size = 512; - ops_tx.rtcp = &ops_tx_rtcp; + ops_tx.rtcp.buffer_size = 512; } tx_handle[i] = st22_tx_create(m_handle, &ops_tx); @@ -1306,15 +1303,12 @@ static void st22_rx_digest_test(enum st_fps fps[], int width[], int height[], ops_rx.payload_type = ST22_TEST_PAYLOAD_TYPE; ops_rx.type = ST22_TYPE_FRAME_LEVEL; ops_rx.framebuff_cnt = test_ctx_rx[i]->fb_cnt; - struct st_rx_rtcp_ops ops_rx_rtcp; - memset(&ops_rx_rtcp, 0, sizeof(ops_rx_rtcp)); if (enable_rtcp) { ops_rx.flags |= ST22_RX_FLAG_ENABLE_RTCP | ST22_RX_FLAG_SIMULATE_PKT_LOSS; - ops_rx_rtcp.nack_interval_us = 100; - ops_rx_rtcp.seq_skip_window = 0; - ops_rx_rtcp.burst_loss_max = 4; - ops_rx_rtcp.sim_loss_rate = 0.0001; - ops_rx.rtcp = &ops_rx_rtcp; + ops_rx.rtcp.nack_interval_us = 100; + ops_rx.rtcp.seq_skip_window = 0; + ops_rx.rtcp.burst_loss_max = 4; + ops_rx.rtcp.sim_loss_rate = 0.0001; } ops_rx.notify_rtp_ready = st22_rx_rtp_ready; diff --git a/tests/src/st22p_test.cpp b/tests/src/st22p_test.cpp index 1110d26f1..17e4ba59c 100644 --- a/tests/src/st22p_test.cpp +++ b/tests/src/st22p_test.cpp @@ -856,12 +856,9 @@ static void st22p_rx_digest_test(enum st_fps fps[], int width[], int height[], ops_tx.flags |= ST22P_TX_FLAG_EXT_FRAME; } - struct st_tx_rtcp_ops ops_tx_rtcp; - memset(&ops_tx_rtcp, 0, sizeof(ops_tx_rtcp)); if (para->rtcp) { ops_tx.flags |= ST22P_TX_FLAG_ENABLE_RTCP; - ops_tx_rtcp.rtcp_buffer_size = 512; - ops_tx.rtcp = &ops_tx_rtcp; + ops_tx.rtcp.buffer_size = 512; } test_ctx_tx[i]->frame_size = @@ -1036,15 +1033,12 @@ static void st22p_rx_digest_test(enum st_fps fps[], int width[], int height[], ops_rx.query_ext_frame = test_st22p_rx_query_ext_frame; } - struct st_rx_rtcp_ops ops_rx_rtcp; - memset(&ops_rx_rtcp, 0, sizeof(ops_rx_rtcp)); if (para->rtcp) { ops_rx.flags |= ST22P_RX_FLAG_ENABLE_RTCP | ST22P_RX_FLAG_SIMULATE_PKT_LOSS; - ops_rx_rtcp.nack_interval_us = 100; - ops_rx_rtcp.seq_skip_window = 0; - ops_rx_rtcp.burst_loss_max = 4; - ops_rx_rtcp.sim_loss_rate = 0.0001; - ops_rx.rtcp = &ops_rx_rtcp; + ops_rx.rtcp.nack_interval_us = 100; + ops_rx.rtcp.seq_skip_window = 0; + ops_rx.rtcp.burst_loss_max = 4; + ops_rx.rtcp.sim_loss_rate = 0.0001; } test_ctx_rx[i]->frame_size =