Skip to content

Commit 425131e

Browse files
committed
Fix: ts for audio frame matches the RTP ts of the 1st pkt
1 parent 9168009 commit 425131e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/src/st2110/st_header.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,8 @@ struct st_rx_audio_session_impl {
10081008
int st30_pkt_idx; /* pkt index in current frame */
10091009
int latest_seq_id; /* latest seq id */
10101010

1011+
uint32_t first_pkt_rtp_ts; /* rtp time stamp for the first pkt */
1012+
10111013
uint32_t tmstamp;
10121014
size_t frame_recv_size;
10131015

lib/src/st2110/st_rx_audio_session.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,10 @@ static int rx_audio_session_handle_frame_pkt(struct mtl_main_impl* impl,
262262
uint8_t payload_type = rtp->payload_type;
263263
uint32_t pkt_len = mbuf->data_len - sizeof(struct st_rfc3550_audio_hdr);
264264

265+
if (s->st30_pkt_idx == 0) {
266+
s->first_pkt_rtp_ts = tmstamp;
267+
}
268+
265269
if (ops->payload_type && (payload_type != ops->payload_type)) {
266270
dbg("%s(%d,%d), get payload_type %u but expect %u\n", __func__, s->idx, s_port,
267271
payload_type, ops->payload_type);
@@ -356,11 +360,11 @@ static int rx_audio_session_handle_frame_pkt(struct mtl_main_impl* impl,
356360
}
357361

358362
meta->tfmt = ST10_TIMESTAMP_FMT_MEDIA_CLK;
359-
meta->timestamp = tmstamp;
363+
meta->timestamp = s->first_pkt_rtp_ts;
360364
meta->fmt = ops->fmt;
361365
meta->sampling = ops->sampling;
362366
meta->channel = ops->channel;
363-
meta->rtp_timestamp = tmstamp;
367+
meta->rtp_timestamp = s->first_pkt_rtp_ts;
364368
meta->frame_recv_size = s->frame_recv_size;
365369

366370
MT_USDT_ST30_RX_FRAME_AVAILABLE(s->mgr->idx, s->idx, frame->idx, frame->addr, tmstamp,

0 commit comments

Comments
 (0)