]> git.sesse.net Git - nageru/commitdiff
Rename bmusb_mutex to card_mutex; it is not really bound to bmusb anymore.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 11 Jan 2017 23:59:41 +0000 (00:59 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 15 Jan 2017 21:05:46 +0000 (22:05 +0100)
mixer.cpp
mixer.h

index 1be5660fb7f9219d17a1a39a15841f6d0c5c47b5..05013b10e3569387d0b0538a3afd6d42b9267640 100644 (file)
--- 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<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();
                }
@@ -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<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;
@@ -483,7 +483,7 @@ void Mixer::bm_frame(unsigned card_index, uint16_t timecode,
                }
 
                {
-                       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;
@@ -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<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()) {
diff --git a/mixer.h b/mixer.h
index 0e1d2959ccf6dfb3a125e5bed4da3e367fde3c78..b5ae946575937dd6cb2bcacd29b8a831064a2173 100644 (file)
--- 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 <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.