Skip to content

Commit ff631dd

Browse files
Style: adhere to linter
1 parent 3e8c10f commit ff631dd

15 files changed

+111
-92
lines changed

lib/src/mt_util.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ static inline bool mt_seq32_greater(uint32_t a, uint32_t b) {
115115
return (diff & 0x80000000u) == 0 && diff != 0;
116116
}
117117

118-
119-
static inline bool st_rx_seq_redundant_drop(uint16_t new_id, int* sessions_redundant, enum mtl_session_port s_port, int num_port) {
118+
static inline bool st_rx_seq_redundant_drop(uint16_t new_id, int* sessions_redundant,
119+
enum mtl_session_port s_port, int num_port) {
120120
for (int i = MTL_SESSION_PORT_P; i < num_port; i++) {
121121
if (i == s_port) continue;
122122

@@ -125,7 +125,7 @@ static inline bool st_rx_seq_redundant_drop(uint16_t new_id, int* sessions_redun
125125
return true;
126126
}
127127
}
128-
128+
129129
return false;
130130
}
131131

lib/src/st2110/st_header.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ struct st_rx_audio_session_impl {
10161016
uint32_t st30_pkt_size; /* size for each pkt which include the header */
10171017
int st30_total_pkts; /* total pkts in one frame */
10181018
int st30_pkt_idx; /* pkt index in current frame */
1019-
int latest_seq_id[MTL_SESSION_PORT_MAX]; /* latest seq id */
1019+
int latest_seq_id[MTL_SESSION_PORT_MAX]; /* latest seq id */
10201020

10211021
uint32_t first_pkt_rtp_ts; /* rtp time stamp for the first pkt */
10221022
int64_t tmstamp;

lib/src/st2110/st_rx_ancillary_session.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,10 @@ static int rx_ancillary_session_handle_pkt(struct mtl_main_impl* impl,
131131
}
132132
/* 0b00: progressive or not specified, do nothing */
133133

134-
if (unlikely(s->latest_seq_id[MTL_PORT_P] == -1)) s->latest_seq_id[MTL_PORT_P] = seq_id - 1;
135-
if (unlikely(s->latest_seq_id[MTL_PORT_R] == -1)) s->latest_seq_id[MTL_PORT_R] = seq_id - 1;
134+
if (unlikely(s->latest_seq_id[MTL_PORT_P] == -1))
135+
s->latest_seq_id[MTL_PORT_P] = seq_id - 1;
136+
if (unlikely(s->latest_seq_id[MTL_PORT_R] == -1))
137+
s->latest_seq_id[MTL_PORT_R] = seq_id - 1;
136138
if (unlikely(s->tmstamp == -1)) s->tmstamp = tmstamp - 1;
137139

138140
if (seq_id != (uint16_t)(s->latest_seq_id[s_port] + 1)) {
@@ -141,12 +143,13 @@ static int rx_ancillary_session_handle_pkt(struct mtl_main_impl* impl,
141143
ST_SESSION_STAT_INC(s, port_user_stats.common, stat_pkts_out_of_order);
142144
}
143145

144-
/* in ancillary we assume packet is redundant when the seq_id is old (it's possible to get
145-
multiple packets with the same timestamp)) */
146-
if ((mt_seq32_greater(s->tmstamp, tmstamp)) || st_rx_seq_redundant_drop(seq_id, s->latest_seq_id, s_port, s->ops.num_port)) {
147-
148-
if (mt_seq32_greater(s->tmstamp, tmstamp)){
149-
dbg ("%s(%d,%d), drop as pkt tmstamp %u is old\n", __func__, s->idx, s_port, tmstamp);
146+
/* in ancillary we assume packet is redundant when the seq_id is old (it's possible to
147+
get multiple packets with the same timestamp)) */
148+
if ((mt_seq32_greater(s->tmstamp, tmstamp)) ||
149+
st_rx_seq_redundant_drop(seq_id, s->latest_seq_id, s_port, s->ops.num_port)) {
150+
if (mt_seq32_greater(s->tmstamp, tmstamp)) {
151+
dbg("%s(%d,%d), drop as pkt tmstamp %u is old\n", __func__, s->idx, s_port,
152+
tmstamp);
150153
} else {
151154
dbg("%s(%d,%d), drop as pkt seq %d is old\n", __func__, s->idx, s_port, seq_id);
152155
}

lib/src/st2110/st_rx_audio_session.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,15 +296,18 @@ static int rx_audio_session_handle_frame_pkt(struct mtl_main_impl* impl,
296296

297297
/* all packets need to have increasing tmstamp */
298298
if (!mt_seq32_greater(tmstamp, s->tmstamp)) {
299-
dbg ("%s(%d,%d), drop as pkt seq_id %u (%u) or tmstamp %u (%ld) is old\n", __func__, s->idx, s_port, seq_id, s->latest_seq_id[s_port], tmstamp, s->tmstamp);
299+
dbg("%s(%d,%d), drop as pkt seq_id %u (%u) or tmstamp %u (%ld) is old\n", __func__,
300+
s->idx, s_port, seq_id, s->latest_seq_id[s_port], tmstamp, s->tmstamp);
300301
ST_SESSION_STAT_INC(s, port_user_stats, stat_pkts_redundant);
301302
s->latest_seq_id[s_port] = seq_id;
302303
return -EIO;
303304
}
304305
s->tmstamp = tmstamp;
305306

306-
if (unlikely(s->latest_seq_id[MTL_PORT_P] == -1)) s->latest_seq_id[MTL_PORT_P] = seq_id - 1;
307-
if (unlikely(s->latest_seq_id[MTL_PORT_R] == -1)) s->latest_seq_id[MTL_PORT_R] = seq_id - 1;
307+
if (unlikely(s->latest_seq_id[MTL_PORT_P] == -1))
308+
s->latest_seq_id[MTL_PORT_P] = seq_id - 1;
309+
if (unlikely(s->latest_seq_id[MTL_PORT_R] == -1))
310+
s->latest_seq_id[MTL_PORT_R] = seq_id - 1;
308311

309312
if (seq_id != (uint16_t)(s->latest_seq_id[s_port] + 1)) {
310313
dbg("%s(%d,%d), non-continuous seq now %u last %d\n", __func__, s->idx, s_port,
@@ -414,7 +417,7 @@ static int rx_audio_session_handle_rtp_pkt(struct mtl_main_impl* impl,
414417
size_t hdr_offset =
415418
sizeof(struct st_rfc3550_audio_hdr) - sizeof(struct st_rfc3550_rtp_hdr);
416419
struct st_rfc3550_rtp_hdr* rtp =
417-
rte_pktmbuf_mtod_offset(mbuf, struct st_rfc3550_rtp_hdr*, hdr_offset);
420+
rte_pktmbuf_mtod_offset(mbuf, struct st_rfc3550_rtp_hdr*, hdr_offset);
418421
MTL_MAY_UNUSED(impl);
419422
MTL_MAY_UNUSED(s_port);
420423

@@ -492,7 +495,7 @@ static int rv_stop_pcap_dump(struct st_rx_audio_session_impl* s) {
492495
for (int s_port = 0; s_port < s->ops.num_port; s_port++) {
493496
ra_stop_pcap(s, s_port);
494497
}
495-
return 0;
498+
return 0;
496499
}
497500

498501
static int ra_start_pcap(struct st_rx_audio_session_impl* s, enum mtl_session_port s_port,
@@ -517,7 +520,7 @@ static int ra_start_pcap(struct st_rx_audio_session_impl* s, enum mtl_session_po
517520
pcap->pcap = mt_pcap_open(s->mgr->parent, port, fd);
518521
if (!pcap->pcap) {
519522
err("%s(%d,%d), failed to open pcap file %s\n", __func__, idx, s_port,
520-
pcap->file_name);
523+
pcap->file_name);
521524
close(fd);
522525
return -EIO;
523526
}

lib/src/st2110/st_rx_fastmetadata_session.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,10 @@ static int rx_fastmetadata_session_handle_pkt(struct mtl_main_impl* impl,
114114
}
115115
}
116116

117-
if (unlikely(s->latest_seq_id[MTL_PORT_P] == -1)) s->latest_seq_id[MTL_PORT_P] = seq_id - 1;
118-
if (unlikely(s->latest_seq_id[MTL_PORT_R] == -1)) s->latest_seq_id[MTL_PORT_R] = seq_id - 1;
117+
if (unlikely(s->latest_seq_id[MTL_PORT_P] == -1))
118+
s->latest_seq_id[MTL_PORT_P] = seq_id - 1;
119+
if (unlikely(s->latest_seq_id[MTL_PORT_R] == -1))
120+
s->latest_seq_id[MTL_PORT_R] = seq_id - 1;
119121
if (unlikely(s->tmstamp == -1)) s->tmstamp = tmstamp - 1;
120122

121123
if (seq_id != (uint16_t)(s->latest_seq_id[s_port] + 1)) {
@@ -124,12 +126,13 @@ static int rx_fastmetadata_session_handle_pkt(struct mtl_main_impl* impl,
124126
ST_SESSION_STAT_INC(s, port_user_stats.common, stat_pkts_out_of_order);
125127
}
126128

127-
/* in fastmetadata we assume packet is redundant when the seq_id is old (it's possible to get
128-
multiple packets with the same timestamp)) */
129-
if ((mt_seq32_greater(s->tmstamp, tmstamp)) || st_rx_seq_redundant_drop(seq_id, s->latest_seq_id, s_port, s->ops.num_port)) {
130-
131-
if (mt_seq32_greater(s->tmstamp, tmstamp)){
132-
dbg ("%s(%d,%d), drop as pkt tmstamp %u is old\n", __func__, s->idx, s_port, tmstamp);
129+
/* in fastmetadata we assume packet is redundant when the seq_id is old (it's possible
130+
to get multiple packets with the same timestamp)) */
131+
if ((mt_seq32_greater(s->tmstamp, tmstamp)) ||
132+
st_rx_seq_redundant_drop(seq_id, s->latest_seq_id, s_port, s->ops.num_port)) {
133+
if (mt_seq32_greater(s->tmstamp, tmstamp)) {
134+
dbg("%s(%d,%d), drop as pkt tmstamp %u is old\n", __func__, s->idx, s_port,
135+
tmstamp);
133136
} else {
134137
dbg("%s(%d,%d), drop as pkt seq %d is old\n", __func__, s->idx, s_port, seq_id);
135138
}

lib/src/st2110/st_rx_video_session.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,8 @@ static void rv_frame_notify(struct st_rx_video_session_impl* s,
901901
double reactive = 1080.0 / 1125.0;
902902
s->trs = s->frame_time * reactive / meta->pkts_total;
903903
} else {
904-
dbg("%s(%d): frame_recv_size %" PRIu64 ", frame_total_size %" PRIu64 ", tmstamp %ld\n",
904+
dbg("%s(%d): frame_recv_size %" PRIu64 ", frame_total_size %" PRIu64
905+
", tmstamp %ld\n",
905906
__func__, s->idx, meta->frame_recv_size, meta->frame_total_size, slot->tmstamp);
906907
MT_USDT_ST20_RX_FRAME_INCOMPLETE(s->parent->idx, s->idx, frame->idx, slot->tmstamp,
907908
meta->frame_recv_size, s->st20_frame_size);
@@ -1109,7 +1110,6 @@ static struct st_rx_video_slot_impl* rv_slot_by_tmstamp(
11091110
}
11101111
}
11111112

1112-
11131113
/* if the slot timestamp is in the past just drop it */
11141114
bool timestamp_is_in_the_past = true;
11151115
for (i = 0; i < s->slot_max; i++) {
@@ -1128,7 +1128,6 @@ static struct st_rx_video_slot_impl* rv_slot_by_tmstamp(
11281128

11291129
dbg("%s(%d): new tmstamp %u\n", __func__, s->idx, tmstamp);
11301130

1131-
11321131
if (s->dma_dev && !mt_dma_empty(s->dma_dev)) {
11331132
/* still in progress of previous frame, drop current pkt */
11341133
rte_atomic32_inc(&s->dma_previous_busy_cnt);

lib/src/st2110/st_tx_video_session.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2308,7 +2308,8 @@ static int tv_tasklet_st22(struct mtl_main_impl* impl,
23082308
tv_sync_pacing_st22(impl, s, required_tai, st22_info->st22_total_pkts);
23092309
if (ops->flags & ST20_TX_FLAG_USER_TIMESTAMP) {
23102310
pacing->rtp_time_stamp =
2311-
st10_get_media_clk(meta.tfmt + (s->ops.rtp_timestamp_delta_us * NS_PER_US), meta.timestamp, s->fps_tm.sampling_clock_rate);
2311+
st10_get_media_clk(meta.tfmt + (s->ops.rtp_timestamp_delta_us * NS_PER_US),
2312+
meta.timestamp, s->fps_tm.sampling_clock_rate);
23122313
} else {
23132314
uint64_t tai_for_rtp_ts;
23142315
if (s->ops.flags & ST20_TX_FLAG_RTP_TIMESTAMP_EPOCH) {

lib/src/st2110/st_video_transmitter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static uint16_t video_trs_burst(struct mtl_main_impl* impl,
8888
for (uint16_t i = 0; i < tx; i++) {
8989
s->stat_bytes_tx[s_port] += tx_pkts[i]->pkt_len;
9090
s->port_user_stats.common.port[s_port].bytes += tx_pkts[i]->pkt_len;
91-
s->port_user_stats.common.port[s_port].packets ++;
91+
s->port_user_stats.common.port[s_port].packets++;
9292
}
9393

9494
s->last_burst_succ_time_tsc[s_port] = mt_get_tsc(impl);

tests/integration_tests/noctx/St20pHandler.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
#include "noctx.hpp"
66

77
St20pHandler::St20pHandler(st_tests_context* ctx, FrameTestStrategy* sessionUserData,
8-
st20p_tx_ops ops_tx, st20p_rx_ops ops_rx, bool create, bool start)
8+
st20p_tx_ops ops_tx, st20p_rx_ops ops_rx, bool create,
9+
bool start)
910
: Handlers(ctx, sessionUserData) {
1011
if (ops_tx.name == nullptr && ops_rx.name == nullptr) {
1112
fillSt20Ops();
@@ -27,7 +28,8 @@ St20pHandler::St20pHandler(st_tests_context* ctx, FrameTestStrategy* sessionUser
2728
}
2829
}
2930

30-
St20pHandler::St20pHandler(st_tests_context* ctx, st20p_tx_ops ops_tx, st20p_rx_ops ops_rx)
31+
St20pHandler::St20pHandler(st_tests_context* ctx, st20p_tx_ops ops_tx,
32+
st20p_rx_ops ops_rx)
3133
: Handlers(ctx) {
3234
if (ops_tx.name == nullptr && ops_rx.name == nullptr) {
3335
fillSt20Ops();
@@ -49,9 +51,9 @@ St20pHandler::~St20pHandler() {
4951
}
5052

5153
void St20pHandler::fillSt20Ops(uint transmissionPort, uint framebufferQueueSize,
52-
enum st20_fmt fmt, uint width, uint height,
53-
uint payloadType, enum st_fps fps, bool interlaced,
54-
enum st20_packing packing) {
54+
enum st20_fmt fmt, uint width, uint height,
55+
uint payloadType, enum st_fps fps, bool interlaced,
56+
enum st20_packing packing) {
5557
memset(&sessionsOpsTx, 0, sizeof(sessionsOpsTx));
5658
sessionsOpsTx.name = "st20p_noctx_test_tx";
5759
sessionsOpsTx.priv = ctx;
@@ -98,9 +100,9 @@ void St20pHandler::fillSt20Ops(uint transmissionPort, uint framebufferQueueSize,
98100
sessionsOpsRx.interlaced = interlaced;
99101
sessionsOpsRx.framebuff_cnt = framebufferQueueSize;
100102

101-
102103
nsFrameTime = st_frame_rate(fps);
103-
if (nsFrameTime == 0) nsFrameTime = NS_PER_S / 25;
104+
if (nsFrameTime == 0)
105+
nsFrameTime = NS_PER_S / 25;
104106
else
105107
nsFrameTime = NS_PER_S / nsFrameTime;
106108
}
@@ -246,7 +248,7 @@ void St20pHandler::startSession(
246248
* SESSION_SKIP_PORT to skip.
247249
*/
248250
void St20pHandler::setSessionPorts(int txPortIdx, int rxPortIdx, int txPortRedundantIdx,
249-
int rxPortRedundantIdx) {
251+
int rxPortRedundantIdx) {
250252
setSessionPortsTx(&(this->sessionsOpsTx.port), txPortIdx, txPortRedundantIdx);
251253
setSessionPortsRx(&(this->sessionsOpsRx.port), rxPortIdx, rxPortRedundantIdx);
252254
}

tests/integration_tests/noctx/noctx.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ void NoCtxTest::SetUp() {
1818

1919
if (ctx->handle) {
2020
throw std::runtime_error(
21-
"NoCtxTest::SetUp: ctx->handle is already initialized!\n"
22-
"This likely means the global context was not properly reset between tests.\n"
23-
"To run NOCTX tests, please use the '--no_ctx_tests' option to ensure a clean context.");
21+
"NoCtxTest::SetUp: ctx->handle is already initialized!\n"
22+
"This likely means the global context was not properly reset between tests.\n"
23+
"To run NOCTX tests, please use the '--no_ctx_tests' option to ensure a clean "
24+
"context.");
2425
}
2526

2627
ctx->level = ST_TEST_LEVEL_MANDATORY;
@@ -88,7 +89,7 @@ uint64_t NoCtxTest::TestPtpSourceSinceEpoch(void* priv) {
8889
uint64_t temp_adjustment = (uint64_t)spec_adjustment_to_epoch.tv_sec * NS_PER_S +
8990
spec_adjustment_to_epoch.tv_nsec;
9091

91-
adjustment_ns.store(temp_adjustment);
92+
adjustment_ns.store(temp_adjustment);
9293
}
9394

9495
clock_gettime(CLOCK_MONOTONIC, &spec);

0 commit comments

Comments
 (0)