if (card->last_timecode != -1) {
dropped_frames = unwrap_timecode(timecode, card->last_timecode) - card->last_timecode - 1;
}
- card->last_timecode = timecode;
// Convert the audio to stereo fp32 and add it.
vector<float> audio;
unique_lock<mutex> lock(card->audio_mutex);
if (dropped_frames > MAX_FPS * 2) {
- fprintf(stderr, "Card %d lost more than two seconds (or time code jumping around), resetting resampler\n",
- card_index);
+ fprintf(stderr, "Card %d lost more than two seconds (or time code jumping around; from 0x%04x to 0x%04x), resetting resampler\n",
+ card_index, card->last_timecode, timecode);
card->resampling_queue.reset(new ResamplingQueue(OUTPUT_FREQUENCY, OUTPUT_FREQUENCY, 2));
} else if (dropped_frames > 0) {
// Insert silence as needed. (The number of samples could be nonintegral,
card->next_local_pts = local_pts + frame_length;
}
+ card->last_timecode = timecode;
+
// Done with the audio, so release it.
if (audio_frame.owner) {
audio_frame.owner->release_frame(audio_frame);