- if let Some(c) = self.candidate.take() {
- let start_idx = self.rx_cursor + 1920 - (c.age as usize);
- let start_sample = self.sample - c.age as u64;
- let mut pkt_samples = [0f32; 192];
- for i in 0..192 {
- let rx_idx = (start_idx + i * 10) % 1920;
- pkt_samples[i] = (self.rx_win[rx_idx] - c.shift) / c.gain;
- }
- match c.burst {
- SyncBurst::Lsf => {
- debug!(
- "Found LSF at sample {} diff {} max {} shift {}",
- start_sample, c.diff, c.gain, c.shift
- );
- if let Some(frame) = parse_lsf(&pkt_samples) {
- self.suppress = 191 * 10;
- return Some(Frame::Lsf(frame));
- }
- }
- SyncBurst::Bert => {
- debug!("Found BERT at sample {} diff {}", start_sample, c.diff);
- }
- SyncBurst::Stream => {
- debug!(
- "Found STREAM at sample {} diff {} max {} shift {}",
- start_sample, c.diff, c.gain, c.shift
- );
- if let Some(frame) = parse_stream(&pkt_samples) {
- self.suppress = 191 * 10;
- return Some(Frame::Stream(frame));
- }
- }
- SyncBurst::Packet => {
- debug!("Found PACKET at sample {} diff {}", start_sample, c.diff);
- if let Some(frame) = parse_packet(&pkt_samples) {
- self.suppress = 191 * 10;
- return Some(Frame::Packet(frame));
- }
- }
- }
- }
+ // wait until the rest of the frame is in the buffer
+ let c = self.candidate.as_ref().unwrap();
+ self.samples_until_decode = Some((184 * 10) - (c.age as u16));
+ debug!(
+ "Found {:?} at sample {} diff {}",
+ c.burst,
+ self.sample - c.age as u64,
+ c.diff
+ );