for (unsigned card_index = 0; card_index < num_cards; ++card_index) {
{
- unique_lock<mutex> lock(bmusb_mutex);
+ unique_lock<mutex> lock(card_mutex);
cards[card_index].should_quit = true; // Unblock thread.
cards[card_index].new_frames_changed.notify_all();
}
// Still send on the information that we _had_ a frame, even though it's corrupted,
// so that pts can go up accordingly.
{
- unique_lock<mutex> lock(bmusb_mutex);
+ unique_lock<mutex> lock(card_mutex);
CaptureCard::NewFrame new_frame;
new_frame.frame = RefCountedFrame(FrameAllocator::Frame());
new_frame.length = frame_length;
}
{
- unique_lock<mutex> lock(bmusb_mutex);
+ unique_lock<mutex> lock(card_mutex);
CaptureCard::NewFrame new_frame;
new_frame.frame = frame;
new_frame.length = frame_length;
start:
// The first card is the master timer, so wait for it to have a new frame.
// TODO: Add a timeout.
- unique_lock<mutex> lock(bmusb_mutex);
+ unique_lock<mutex> lock(card_mutex);
cards[master_card_index].new_frames_changed.wait(lock, [this, master_card_index]{ return !cards[master_card_index].new_frames.empty() || cards[master_card_index].capture->get_disconnected(); });
if (cards[master_card_index].new_frames.empty()) {
// frame rate is integer, will always stay zero.
unsigned fractional_samples = 0;
- std::mutex bmusb_mutex;
+ std::mutex card_mutex;
bool has_bmusb_thread = false;
struct CaptureCard {
bmusb::CaptureInterface *capture = nullptr;
int last_timecode = -1; // Unwrapped.
};
- CaptureCard cards[MAX_VIDEO_CARDS]; // protected by <bmusb_mutex>
+ CaptureCard cards[MAX_VIDEO_CARDS]; // Protected by <card_mutex>.
AudioMixer audio_mixer; // Same as global_audio_mixer (see audio_mixer.h).
struct OutputFrameInfo {
int dropped_frames; // Since last frame.