} while (!success);
}
- audio_mixer.add_audio(device, audio_frame.data + audio_offset, num_samples, audio_format, frame_length, audio_frame.received_timestamp);
+ if (num_samples > 0) {
+ audio_mixer.add_audio(device, audio_frame.data + audio_offset, num_samples, audio_format, frame_length, audio_frame.received_timestamp);
+ }
// Done with the audio, so release it.
if (audio_frame.owner) {
card->last_timecode = timecode;
- // Calculate jitter for this card here. We do it on arrival so that we
- // make sure every frame counts, even the dropped ones -- and it will also
- // make sure the jitter number is as recent as possible, should it change.
- card->jitter_history.frame_arrived(video_frame.received_timestamp, frame_length, dropped_frames);
-
PBOFrameAllocator::Userdata *userdata = (PBOFrameAllocator::Userdata *)video_frame.userdata;
size_t cbcr_width, cbcr_height, cbcr_offset, y_offset;
new_frame.dropped_frames = dropped_frames;
new_frame.received_timestamp = video_frame.received_timestamp;
card->new_frames.push_back(move(new_frame));
- card->new_frames_changed.notify_all();
+ card->jitter_history.frame_arrived(video_frame.received_timestamp, frame_length, dropped_frames);
}
+ card->new_frames_changed.notify_all();
return;
}
new_frame.dropped_frames = dropped_frames;
new_frame.received_timestamp = video_frame.received_timestamp; // Ignore the audio timestamp.
card->new_frames.push_back(move(new_frame));
- card->new_frames_changed.notify_all();
+ card->jitter_history.frame_arrived(video_frame.received_timestamp, frame_length, dropped_frames);
}
+ card->new_frames_changed.notify_all();
}
}
// The theme can't (or at least shouldn't!) call connect_signal() on
// each FFmpeg input, so we'll do it here.
for (const pair<LiveInputWrapper *, FFmpegCapture *> &conn : theme->get_signal_connections()) {
- conn.first->connect_signal_raw(conn.second->get_card_index());
+ conn.first->connect_signal_raw(conn.second->get_card_index(), input_state);
}
// If HDMI/SDI output is active and the user has requested auto mode,