]> git.sesse.net Git - nageru/commitdiff
Always flush after setting a fence, since we could otherwise get unbounded delay...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 14 Apr 2016 08:24:26 +0000 (10:24 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 14 Apr 2016 08:24:26 +0000 (10:24 +0200)
h264encode.cpp
mixer.cpp

index c923f475a94e7720316aa29d4aef3ee60549fead..523eae9a47a2ff299807e6444070e259b397354b 100644 (file)
@@ -1913,6 +1913,8 @@ RefCountedGLsync H264EncoderImpl::end_frame(int64_t pts, const vector<RefCounted
 
        RefCountedGLsync fence = RefCountedGLsync(GL_SYNC_GPU_COMMANDS_COMPLETE, /*flags=*/0);
        check_error();
+       glFlush();  // Make the H.264 thread see the fence as soon as possible.
+       check_error();
 
        {
                unique_lock<mutex> lock(frame_queue_mutex);
index 08d2d0140b6afffa501df67936ef6aa30ea7a72c..42d854817b57c10c7dce162c9b149cceb62a8ed3 100644 (file)
--- a/mixer.cpp
+++ b/mixer.cpp
@@ -563,6 +563,8 @@ void Mixer::bm_frame(unsigned card_index, uint16_t timecode,
                RefCountedGLsync fence(GL_SYNC_GPU_COMMANDS_COMPLETE, /*flags=*/0);
                check_error();
                assert(fence.get() != nullptr);
+               glFlush();  // Make sure the main thread doesn't have to wait until we push out enough frames to make a new command buffer.
+               check_error();
 
                if (field == 1) {
                        // Don't upload the second field as fast as we can; wait until