]> git.sesse.net Git - casparcg/commitdiff
Changes to prefer try_pop over the previous empty() check.
authorJames Wise <james.wise@bluefish444.com>
Wed, 15 Feb 2017 02:23:37 +0000 (13:23 +1100)
committerJames Wise <james.wise@bluefish444.com>
Wed, 15 Feb 2017 02:23:37 +0000 (13:23 +1100)
modules/bluefish/consumer/bluefish_consumer.cpp

index fc14714a6f421d992c3ea88ba130fdfbbe39f8f5..7fb98adf0768ac467d58aa745f10cd9d637aee7e 100644 (file)
@@ -475,11 +475,9 @@ public:
 
                while (!end_dma_thread_)
                {
-                       if (!live_frames_.empty() && BLUE_OK(blue_->video_playback_allocate(buffer_id, underrun)))
+                       blue_dma_buffer_ptr buf = nullptr;
+                       if (live_frames_.try_pop(buf) && BLUE_OK(blue_->video_playback_allocate(buffer_id, underrun)))
                        {
-                               blue_dma_buffer_ptr buf = nullptr;
-                               live_frames_.pop(buf);
-
                                // Send and display
                                if (embedded_audio_)
                                {
@@ -540,14 +538,12 @@ public:
                        presentation_delay_millis_ = previous_frame_.get_age_millis();
 
                previous_frame_ = frame;
+               blue_dma_buffer_ptr buf = nullptr;
 
                // Copy to local buffers
-               if (!reserved_frames_.empty())
+               if (reserved_frames_.try_pop(buf))
                {
-                       blue_dma_buffer_ptr buf = nullptr;
-                       reserved_frames_.pop(buf);
                        void* dest = buf->image_data();
-
                        if (!frame.image_data().empty())
                        {
                                if (key_only_)