Skip to content

Commit 474b343

Browse files
author
desaulov
committed
added rtp_timestamp_delta_us to st30_pipeline_tx
1 parent daa2f3a commit 474b343

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

include/st30_api.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,12 @@ struct st30_tx_ops {
397397
*/
398398
uint8_t tx_dst_mac[MTL_SESSION_PORT_MAX][MTL_MAC_ADDR_LEN];
399399

400+
/**
401+
* Optional. The rtp timestamp delta(us) to the start time of frame.
402+
* Zero means the rtp timestamp at the start of the frame.
403+
*/
404+
int32_t rtp_timestamp_delta_us;
405+
400406
/** Mandatory for ST30_TYPE_RTP_LEVEL. rtp ring queue size, must be power of 2 */
401407
uint32_t rtp_ring_size;
402408
/**

include/st30_pipeline_api.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ struct st30p_tx_ops {
132132
*/
133133
int (*notify_frame_done)(void* priv, struct st30_frame* frame);
134134

135+
/**
136+
* Optional. The rtp timestamp delta(us) to the start time of frame.
137+
* Zero means the rtp timestamp at the start of the frame.
138+
*/
139+
int32_t rtp_timestamp_delta_us;
140+
135141
/*
136142
* Optional. The size of fifo ring which used between the packet builder and pacing.
137143
* Leave to zero to use default value: the packet number within

lib/src/st2110/pipeline/st30_pipeline_tx.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ static int tx_st30p_create_transport(struct mtl_main_impl* impl, struct st30p_tx
173173
}
174174
if (ops->flags & ST30P_TX_FLAG_USER_PACING) ops_tx.flags |= ST30_TX_FLAG_USER_PACING;
175175
ops_tx.pacing_way = ops->pacing_way;
176+
ops_tx.rtp_timestamp_delta_us = ops->rtp_timestamp_delta_us;
176177

177178
ops_tx.fmt = ops->fmt;
178179
ops_tx.channel = ops->channel;

lib/src/st2110/st_tx_audio_session.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,12 @@ static int tx_audio_session_sync_pacing(struct mtl_main_impl* impl,
316316
pacing->cur_epoch_time = tx_audio_pacing_time(pacing, epochs);
317317
pacing->pacing_time_stamp = tx_audio_pacing_time_stamp(pacing, epochs);
318318
pacing->rtp_time_stamp = pacing->pacing_time_stamp;
319+
if (s->ops.rtp_timestamp_delta_us) {
320+
double rtp_timestamp_delta_us = s->ops.rtp_timestamp_delta_us;
321+
int32_t rtp_timestamp_delta =
322+
(rtp_timestamp_delta_us * NS_PER_US) * pacing->pkt_time_sampling / pacing->trs;
323+
pacing->rtp_time_stamp += rtp_timestamp_delta;
324+
}
319325
pacing->tsc_time_cursor = (double)mt_get_tsc(impl) + to_epoch;
320326
dbg("%s(%d), epochs %" PRIu64 ", rtp_time_stamp %u\n", __func__, s->idx, epochs,
321327
pacing->rtp_time_stamp);

0 commit comments

Comments
 (0)