|
51 | 51 |
|
52 | 52 | #include "audio/audio_capture.h" // for AUDIO_CAPTURE_ABI_VERSION, audio_ca... |
53 | 53 | #include "audio/types.h" // for audio_frame |
| 54 | +#include "audio/utils.h" |
54 | 55 | #include "host.h" // for INIT_NOERR |
55 | 56 | #include "lib_common.h" // for REGISTER_MODULE, library_class |
56 | 57 | #include "tv.h" // for get_time_in_ns, time_ns_t, NS_TO_US |
@@ -237,17 +238,8 @@ static void aes67_rtp_worker(state_aes67_cap *s, Rtp_stream stream){ |
237 | 238 |
|
238 | 239 | int sample_count = rtp_pkt.data_len / desc.bps; |
239 | 240 |
|
240 | | - unsigned char *src = static_cast<unsigned char *>(rtp_pkt.data); |
241 | | - |
242 | | - const int bps = desc.bps; |
243 | | - const int swap_count = bps / 2; |
244 | | - for(int i = 0; i < sample_count; i++){ |
245 | | - for(int j = 0; j < swap_count; j++){ |
246 | | - unsigned char tmp = src[i * bps + j]; |
247 | | - src[i * bps + j] = src[i * bps + bps - j - 1]; |
248 | | - src[i * bps + bps - j - 1] = tmp;; |
249 | | - } |
250 | | - } |
| 241 | + char *src = static_cast<char *>(rtp_pkt.data); |
| 242 | + swap_endianity(src, desc.bps, sample_count); |
251 | 243 |
|
252 | 244 | size_t to_write = std::min<size_t>(s->back_frame.frame.max_size - s->back_frame.data.size(), sample_count * desc.bps); |
253 | 245 | s->back_frame.data.insert(s->back_frame.data.end(), src, src + to_write); |
|
0 commit comments