Skip to content

Commit 72f7556

Browse files
Fix: ST40/ST41 first packet timestamp
Packet timestamps were only calculated when the RTP time differed from the previous frame, which failed for the initial packet. This caused the first TX packet to be transmitted with timestamp 0, resulting in DDoS-like behavior on the RX side.
1 parent bd8a449 commit 72f7556

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed

lib/src/st2110/st_header.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,7 @@ struct st_rx_ancillary_session_impl {
11901190

11911191
struct mt_rtcp_rx* rtcp_rx[MTL_SESSION_PORT_MAX];
11921192

1193-
uint32_t tmstamp;
1193+
int64_t tmstamp;
11941194
/* status */
11951195
rte_atomic32_t stat_frames_received;
11961196
int stat_pkts_dropped;
@@ -1363,7 +1363,8 @@ struct st_rx_fastmetadata_session_impl {
13631363

13641364
struct mt_rtcp_rx* rtcp_rx[MTL_SESSION_PORT_MAX];
13651365

1366-
uint32_t tmstamp;
1366+
/* the timestamp */
1367+
int64_t tmstamp;
13671368
/* status */
13681369
rte_atomic32_t stat_frames_received;
13691370
int stat_pkts_redundant;

lib/src/st2110/st_rx_ancillary_session.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ static int rx_ancillary_session_handle_pkt(struct mtl_main_impl* impl,
152152
dbg("%s(%d,%d), redundant seq now %u session last %d\n", __func__, s->idx, s_port,
153153
seq_id, s->session_seq_id);
154154
} else {
155-
dbg("%s(%d,%d), redundant tmstamp now %u session last %u\n", __func__, s->idx,
155+
dbg("%s(%d,%d), redundant tmstamp now %u session last %ld\n", __func__, s->idx,
156156
s_port, tmstamp, s->tmstamp);
157157
}
158158

lib/src/st2110/st_rx_fastmetadata_session.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ static int rx_fastmetadata_session_handle_pkt(struct mtl_main_impl* impl,
135135
dbg("%s(%d,%d), redundant seq now %u session last %d\n", __func__, s->idx, s_port,
136136
seq_id, s->session_seq_id);
137137
} else {
138-
dbg("%s(%d,%d), redundant tmstamp now %u session last %u\n", __func__, s->idx,
138+
dbg("%s(%d,%d), redundant tmstamp now %u session last %ld\n", __func__, s->idx,
139139
s_port, tmstamp, s->tmstamp);
140140
}
141141

lib/src/st2110/st_tx_ancillary_session.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ static int tx_ancillary_session_init_hdr(struct mtl_main_impl* impl,
189189
rtp->base.ssrc = htonl(ssrc);
190190
s->st40_seq_id = 0;
191191
s->st40_ext_seq_id = 0;
192+
s->st40_rtp_time = -1;
192193

193194
info("%s(%d,%d), ip %u.%u.%u.%u port %u:%u\n", __func__, idx, s_port, dip[0], dip[1],
194195
dip[2], dip[3], s->st40_src_port[s_port], s->st40_dst_port[s_port]);

lib/src/st2110/st_tx_fastmetadata_session.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ static int tx_fastmetadata_session_init_hdr(struct mtl_main_impl* impl,
188188
uint32_t ssrc = ops->ssrc ? ops->ssrc : s->idx + 0x323450;
189189
rtp->base.ssrc = htonl(ssrc);
190190
s->st41_seq_id = 0;
191+
s->st41_rtp_time = -1;
191192

192193
info("%s(%d,%d), ip %u.%u.%u.%u port %u:%u\n", __func__, idx, s_port, dip[0], dip[1],
193194
dip[2], dip[3], s->st41_src_port[s_port], s->st41_dst_port[s_port]);

0 commit comments

Comments
 (0)