Skip to content

Fix: ts for audio frame matches the RTP ts of the 1st pkt #1243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions lib/src/st2110/st_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,8 @@ struct st_rx_audio_session_impl {
int st30_pkt_idx; /* pkt index in current frame */
int latest_seq_id; /* latest seq id */

uint32_t first_pkt_rtp_ts; /* rtp time stamp for the first pkt */

uint32_t tmstamp;
size_t frame_recv_size;

Expand Down
8 changes: 6 additions & 2 deletions lib/src/st2110/st_rx_audio_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ static int rx_audio_session_handle_frame_pkt(struct mtl_main_impl* impl,
uint8_t payload_type = rtp->payload_type;
uint32_t pkt_len = mbuf->data_len - sizeof(struct st_rfc3550_audio_hdr);

if (s->st30_pkt_idx == 0) {
s->first_pkt_rtp_ts = tmstamp;
}

if (ops->payload_type && (payload_type != ops->payload_type)) {
dbg("%s(%d,%d), get payload_type %u but expect %u\n", __func__, s->idx, s_port,
payload_type, ops->payload_type);
Expand Down Expand Up @@ -356,11 +360,11 @@ static int rx_audio_session_handle_frame_pkt(struct mtl_main_impl* impl,
}

meta->tfmt = ST10_TIMESTAMP_FMT_MEDIA_CLK;
meta->timestamp = tmstamp;
meta->timestamp = s->first_pkt_rtp_ts;
meta->fmt = ops->fmt;
meta->sampling = ops->sampling;
meta->channel = ops->channel;
meta->rtp_timestamp = tmstamp;
meta->rtp_timestamp = s->first_pkt_rtp_ts;
meta->frame_recv_size = s->frame_recv_size;

MT_USDT_ST30_RX_FRAME_AVAILABLE(s->mgr->idx, s->idx, frame->idx, frame->addr, tmstamp,
Expand Down
Loading