From c39fcdc6d7692ed50203087840bfb40da708f863 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Thu, 12 Jan 2017 00:59:41 +0100 Subject: [PATCH] Rename bmusb_mutex to card_mutex; it is not really bound to bmusb anymore. --- mixer.cpp | 8 ++++---- mixer.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mixer.cpp b/mixer.cpp index 1be5660..05013b1 100644 --- a/mixer.cpp +++ b/mixer.cpp @@ -203,7 +203,7 @@ Mixer::~Mixer() for (unsigned card_index = 0; card_index < num_cards; ++card_index) { { - unique_lock lock(bmusb_mutex); + unique_lock lock(card_mutex); cards[card_index].should_quit = true; // Unblock thread. cards[card_index].new_frames_changed.notify_all(); } @@ -347,7 +347,7 @@ void Mixer::bm_frame(unsigned card_index, uint16_t timecode, // Still send on the information that we _had_ a frame, even though it's corrupted, // so that pts can go up accordingly. { - unique_lock lock(bmusb_mutex); + unique_lock lock(card_mutex); CaptureCard::NewFrame new_frame; new_frame.frame = RefCountedFrame(FrameAllocator::Frame()); new_frame.length = frame_length; @@ -483,7 +483,7 @@ void Mixer::bm_frame(unsigned card_index, uint16_t timecode, } { - unique_lock lock(bmusb_mutex); + unique_lock lock(card_mutex); CaptureCard::NewFrame new_frame; new_frame.frame = frame; new_frame.length = frame_length; @@ -653,7 +653,7 @@ Mixer::OutputFrameInfo Mixer::get_one_frame_from_each_card(unsigned master_card_ start: // The first card is the master timer, so wait for it to have a new frame. // TODO: Add a timeout. - unique_lock lock(bmusb_mutex); + unique_lock 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()) { diff --git a/mixer.h b/mixer.h index 0e1d295..b5ae946 100644 --- a/mixer.h +++ b/mixer.h @@ -321,7 +321,7 @@ private: // 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; @@ -348,7 +348,7 @@ private: int last_timecode = -1; // Unwrapped. }; - CaptureCard cards[MAX_VIDEO_CARDS]; // protected by + CaptureCard cards[MAX_VIDEO_CARDS]; // Protected by . AudioMixer audio_mixer; // Same as global_audio_mixer (see audio_mixer.h). struct OutputFrameInfo { int dropped_frames; // Since last frame. -- 2.39.2