Skip to content

Commit dc5ca0c

Browse files
Magda-PytelDawidWesierski4
authored andcommitted
Fix: ts for audio frame matches the RTP ts of the 1st pkt
1 parent 41c8b51 commit dc5ca0c

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
@@ -1019,6 +1019,8 @@ struct st_rx_audio_session_impl {
10191019
int st30_pkt_idx; /* pkt index in current frame */
10201020
int latest_seq_id; /* latest seq id */
10211021

1022+
uint32_t first_pkt_rtp_ts; /* rtp time stamp for the first pkt */
1023+
10221024
uint32_t tmstamp;
10231025
size_t frame_recv_size;
10241026

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);
@@ -359,11 +363,11 @@ static int rx_audio_session_handle_frame_pkt(struct mtl_main_impl* impl,
359363
}
360364

361365
meta->tfmt = ST10_TIMESTAMP_FMT_MEDIA_CLK;
362-
meta->timestamp = tmstamp;
366+
meta->timestamp = s->first_pkt_rtp_ts;
363367
meta->fmt = ops->fmt;
364368
meta->sampling = ops->sampling;
365369
meta->channel = ops->channel;
366-
meta->rtp_timestamp = tmstamp;
370+
meta->rtp_timestamp = s->first_pkt_rtp_ts;
367371
meta->frame_recv_size = s->frame_recv_size;
368372

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

0 commit comments

Comments
 (0)