|
22 | 22 | LOG_MODULE_REGISTER(le_audio_rx, CONFIG_LE_AUDIO_RX_LOG_LEVEL); |
23 | 23 |
|
24 | 24 | struct rx_stats { |
25 | | - uint32_t recv_cnt; |
26 | | - uint32_t good_frame_cnt; |
27 | | - uint32_t bad_frame_cnt; |
28 | | - bool prev_bad_data; |
| 25 | + uint64_t good_frame_cnt; |
| 26 | + uint64_t bad_or_empty_frame_cnt; |
29 | 27 | }; |
30 | 28 |
|
31 | 29 | static bool initialized; |
@@ -109,33 +107,37 @@ void le_audio_rx_data_handler(struct net_buf *audio_frame_rx, struct audio_metad |
109 | 107 | static uint32_t num_overruns; |
110 | 108 | static uint32_t num_thrown; |
111 | 109 |
|
| 110 | + __ASSERT_NO_MSG(audio_frame_rx != NULL); |
| 111 | + __ASSERT_NO_MSG(meta != NULL); |
| 112 | + |
112 | 113 | if (!initialized) { |
113 | 114 | ERR_CHK_MSG(-EPERM, "Data received but le_audio_rx is not initialized"); |
114 | 115 | } |
115 | 116 |
|
116 | | - rx_stats[location_index].recv_cnt++; |
117 | | - |
118 | 117 | if (meta->bad_data) { |
119 | | - rx_stats[location_index].bad_frame_cnt++; |
| 118 | + rx_stats[location_index].bad_or_empty_frame_cnt++; |
120 | 119 | } else { |
121 | 120 | rx_stats[location_index].good_frame_cnt++; |
122 | 121 | } |
123 | 122 |
|
124 | | - if ((rx_stats[location_index].recv_cnt % 100) == 0 && rx_stats[location_index].recv_cnt) { |
125 | | - /* NOTE: The string below is used by the Nordic CI system */ |
126 | | - LOG_DBG("ISO RX SDUs: Loc: %d Total: %d Bad: %d", location_index, |
127 | | - rx_stats[location_index].recv_cnt, rx_stats[location_index].bad_frame_cnt); |
128 | | - } |
| 123 | + uint64_t total_frames = rx_stats[location_index].good_frame_cnt + |
| 124 | + rx_stats[location_index].bad_or_empty_frame_cnt; |
| 125 | + double bad_frame_percentage = |
| 126 | + (total_frames > 0) ? (((double)rx_stats[location_index].bad_or_empty_frame_cnt / |
| 127 | + total_frames) * |
| 128 | + 100) |
| 129 | + : 0.0; |
129 | 130 |
|
130 | | - if (meta->bad_data && !rx_stats[location_index].prev_bad_data) { |
131 | | - LOG_INF_RATELIMIT_RATE(1000, |
132 | | - "Bad or 0 SDU: Loc: %u Total: %u Bad: %u. (Prints " |
133 | | - "good->bad transition)", |
134 | | - location_index, rx_stats[location_index].recv_cnt, |
135 | | - rx_stats[location_index].bad_frame_cnt); |
| 131 | + if ((total_frames % 100) == 0 && (total_frames != 0)) { |
| 132 | + /* NOTE: The string below is used by the Nordic CI system */ |
| 133 | + LOG_DBG("ISO RX SDUs: Loc: %u Total: %llu Bad: %llu", location_index, total_frames, |
| 134 | + rx_stats[location_index].bad_or_empty_frame_cnt); |
136 | 135 | } |
137 | 136 |
|
138 | | - rx_stats[location_index].prev_bad_data = meta->bad_data; |
| 137 | + LOG_DBG_RATELIMIT_RATE( |
| 138 | + 10000, "Bad or 0 SDU: Loc: %u Total: %llu Empty/bad: %llu (%2.3f %%)", |
| 139 | + location_index, total_frames, rx_stats[location_index].bad_or_empty_frame_cnt, |
| 140 | + bad_frame_percentage); |
139 | 141 |
|
140 | 142 | if (stream_state_get() != STATE_STREAMING) { |
141 | 143 | /* Throw away data */ |
@@ -264,6 +266,10 @@ void le_audio_rx_data_handler(struct net_buf *audio_frame_rx, struct audio_metad |
264 | 266 | */ |
265 | 267 | static void audio_datapath_thread(void *dummy1, void *dummy2, void *dummy3) |
266 | 268 | { |
| 269 | + ARG_UNUSED(dummy1); |
| 270 | + ARG_UNUSED(dummy2); |
| 271 | + ARG_UNUSED(dummy3); |
| 272 | + |
267 | 273 | int ret; |
268 | 274 | struct net_buf *audio_frame = NULL; |
269 | 275 |
|
|
0 commit comments