0
1
mirror of https://github.com/radio95-rnt/fm95.git synced 2026-02-27 11:33:54 +01:00
This commit is contained in:
2025-05-17 21:46:32 +02:00
parent a8108e0b7b
commit 7f23373957

View File

@@ -234,28 +234,24 @@ int main(int argc, char *argv[]) {
if (memcmp(data.packet_data.vban, "VBAN", 4) != 0) continue; // Not VBAN if (memcmp(data.packet_data.vban, "VBAN", 4) != 0) continue; // Not VBAN
if (memcmp(data.packet_data.streamname, stream_name, strlen(stream_name)) != 0) continue; // Not this if (memcmp(data.packet_data.streamname, stream_name, strlen(stream_name)) != 0) continue; // Not this
if (vban_frame == 0) { if (vban_frame == 0 && data.packet_data.frame_num != 0) {
// This means either this is our first packet, if it is we'll sync to the sender and if it isn't we'll set to 0 from 0 // This means either this is our first packet, sync to the sender then
vban_frame = data.packet_data.frame_num; vban_frame = data.packet_data.frame_num;
} else { }
uint32_t expected_frame = vban_frame + 1;
if(vban_frame == UINT32_MAX) {
expected_frame = 1;
vban_frame = 0;
}
if (data.packet_data.frame_num == expected_frame) { if(data.packet_data.frame_num != vban_frame) {
vban_frame++; uint32_t expected_frame = vban_frame + 1;
} else if (data.packet_data.frame_num > expected_frame) {
if (data.packet_data.frame_num > expected_frame) {
// Packets dropped // Packets dropped
uint32_t dropped_packets = data.packet_data.frame_num - expected_frame; uint32_t dropped_packets = data.packet_data.frame_num - expected_frame;
if (quiet == 0) printf("Dropped %u packets\n", dropped_packets); if (quiet == 0) printf("Dropped %u packets\n", dropped_packets);
vban_frame = data.packet_data.frame_num; // Resync to current frame vban_frame += dropped_packets; // Resync to current frame
} else { } else {
if (quiet == 0) printf("Packets received out of order\n"); if (quiet == 0) printf("Packets received out of order\n");
vban_frame = data.packet_data.frame_num + 1; // Resync to current frame
} }
} }
vban_frame++;
if(vban_last_sr != data.packet_data.sample_rate_idx) { if(vban_last_sr != data.packet_data.sample_rate_idx) {
vban_last_sr = data.packet_data.sample_rate_idx; vban_last_sr = data.packet_data.sample_rate_idx;