Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions include/st20_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,8 @@ struct st20_rx_tp_meta {
enum st_rx_tp_compliant compliant;
/** the failed cause if compliant is not ST_RX_TP_COMPLIANT_NARROW */
char failed_cause[64];
/** TAI timestamp measured right after first packet of the frame was received */
uint64_t receive_timestamp;

/* packets count in current report meta */
uint32_t pkts_cnt;
Expand Down Expand Up @@ -1876,6 +1878,24 @@ int st20_tx_put_mbuf(st20_tx_handle handle, void* mbuf, uint16_t len);
*/
int st20_tx_get_sch_idx(st20_tx_handle handle);

/**
* Retrieve pacing parameters for a tx st2110-20 session.
*
* @param handle
* The handle to the tx st2110-20(video) session.
* @param tr_offset_ns
* Optional output for the tr offset value in nanoseconds.
* @param trs_ns
* Optional output for the packet spacing (TRS) value in nanoseconds.
* @param vrx_pkts
* Optional output for the VRX packet count.
*
* @return
* 0 on success, negative value otherwise.
*/
int st20_tx_get_pacing_params(st20_tx_handle handle, double* tr_offset_ns, double* trs_ns,
uint32_t* vrx_pkts);

/**
* Retrieve the general statistics(I/O) for one tx st2110-20(video) session.
*
Expand Down
19 changes: 19 additions & 0 deletions include/st_pipeline_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ struct st_frame {
/** timing parser meta for st20p_rx_get_frame, only active if
* ST20P_RX_FLAG_TIMING_PARSER_META */
struct st20_rx_tp_meta* tp[MTL_SESSION_PORT_MAX];
/** TAI timestamp measured right after first packet of the frame was received */
uint64_t receive_timestamp;
};

/** Device type of st plugin */
Expand Down Expand Up @@ -1761,6 +1763,23 @@ size_t st20p_tx_frame_size(st20p_tx_handle handle);
*/
int st20p_tx_get_sch_idx(st20p_tx_handle handle);

/**
* Retrieve pacing parameters for a tx st2110-20(pipeline) session.
*
* @param handle
* The handle to the tx st2110-20(video) session.
* @param tr_offset_ns
* Optional output for the tr offset value in nanoseconds.
* @param trs_ns
* Optional output for the packet spacing (TRS) value in nanoseconds.
* @param vrx_pkts
* Optional output for the VRX packet count.
*
* @return
* 0 on success, negative value otherwise.
*/
int st20p_tx_get_pacing_params(st20p_tx_handle handle, double* tr_offset_ns,
double* trs_ns, uint32_t* vrx_pkts);
/**
* Retrieve the general statistics(I/O) for one tx st2110-20(pipeline) session.
*
Expand Down
2 changes: 2 additions & 0 deletions lib/src/st2110/pipeline/st20_pipeline_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ static int rx_st20p_frame_ready(void* priv, void* frame,
framebuff->src.timestamp = framebuff->dst.timestamp = meta->timestamp;
framebuff->src.rtp_timestamp = framebuff->dst.rtp_timestamp = meta->rtp_timestamp;
framebuff->src.status = framebuff->dst.status = meta->status;
framebuff->src.receive_timestamp = framebuff->dst.receive_timestamp =
meta->timestamp_first_pkt;

framebuff->src.pkts_total = framebuff->dst.pkts_total = meta->pkts_total;
for (enum mtl_session_port s_port = 0; s_port < MTL_SESSION_PORT_MAX; s_port++) {
Expand Down
20 changes: 20 additions & 0 deletions lib/src/st2110/pipeline/st20_pipeline_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,26 @@ int st20p_tx_get_sch_idx(st20p_tx_handle handle) {
return st20_tx_get_sch_idx(ctx->transport);
}

int st20p_tx_get_pacing_params(st20p_tx_handle handle, double* tr_offset_ns,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add st40 support
thank you

double* trs_ns, uint32_t* vrx_pkts) {
struct st20p_tx_ctx* ctx = handle;
int cidx;

if (!handle) {
err("%s, invalid handle %p\n", __func__, handle);
return -EINVAL;
}
ctx = handle;
cidx = ctx->idx;

if (ctx->type != MT_ST20_HANDLE_PIPELINE_TX) {
err("%s(%d), invalid type %d\n", __func__, cidx, ctx->type);
return -EINVAL;
}

return st20_tx_get_pacing_params(ctx->transport, tr_offset_ns, trs_ns, vrx_pkts);
}

int st20p_tx_get_session_stats(st20p_tx_handle handle, struct st20_tx_user_stats* stats) {
struct st20p_tx_ctx* ctx = handle;
int cidx;
Expand Down
21 changes: 21 additions & 0 deletions lib/src/st2110/st_tx_video_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -4343,6 +4343,27 @@ int st20_tx_get_sch_idx(st20_tx_handle handle) {
return s_impl->sch->idx;
}

int st20_tx_get_pacing_params(st20_tx_handle handle, double* tr_offset_ns, double* trs_ns,
uint32_t* vrx_pkts) {
struct st_tx_video_session_handle_impl* s_impl = handle;

if (!handle) {
err("%s, invalid handle %p\n", __func__, handle);
return -EINVAL;
}

if (s_impl->type != MT_HANDLE_TX_VIDEO) {
err("%s, invalid type %d\n", __func__, s_impl->type);
return -EINVAL;
}

struct st_tx_video_session_impl* s = s_impl->impl;
if (tr_offset_ns) *tr_offset_ns = s->pacing.tr_offset;
if (trs_ns) *trs_ns = s->pacing.trs;
if (vrx_pkts) *vrx_pkts = s->pacing.vrx;
return 0;
}

int st20_tx_get_session_stats(st20_tx_handle handle, struct st20_tx_user_stats* stats) {
struct st_tx_video_session_handle_impl* s_impl = handle;

Expand Down
2 changes: 1 addition & 1 deletion lib/src/st2110/st_video_transmitter.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* This adds a superficial difference between the RTP timestamp and the transmission
* time, which makes it look as if the packets have a slight latency immediately after
* entering the wire. This prevents negative latency values. */
#define LATENCY_COMPENSATION 1
#define LATENCY_COMPENSATION 2

static int video_trs_tasklet_start(void* priv) {
struct st_video_transmitter_impl* trs = priv;
Expand Down
9 changes: 9 additions & 0 deletions tests/integration_tests/noctx/noctx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ class FrameTestStrategy {
virtual void txTestFrameModifier(void* frame, size_t frame_size){};
virtual void rxTestFrameModifier(void* frame, size_t frame_size){};

FrameTestStrategy(Handlers* parent = nullptr, bool enable_tx_modifier = false,
bool enable_rx_modifier = false)
: parent(parent),
idx_tx(0),
idx_rx(0),
enable_tx_modifier(enable_tx_modifier),
enable_rx_modifier(enable_rx_modifier) {
}

virtual ~FrameTestStrategy() {
parent = nullptr;
}
Expand Down
Loading
Loading