From 9f1ada898ebdb52538476829235923ad54b9444d Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Sun, 7 Aug 2016 14:15:55 +0200 Subject: [PATCH] Improve readability of frame completion loop --- src/output/plugins/OSXOutputPlugin.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/output/plugins/OSXOutputPlugin.cxx b/src/output/plugins/OSXOutputPlugin.cxx index 553537eae..38a020021 100644 --- a/src/output/plugins/OSXOutputPlugin.cxx +++ b/src/output/plugins/OSXOutputPlugin.cxx @@ -417,12 +417,16 @@ osx_render(void *vdata, of an incomplete last frame, keep popping until the last frame is complete. */ - size_t remainder; - while ((remainder = available_bytes % input_buffer_frame_size) > 0) + while (true) { + size_t incomplete_frame_bytes = available_bytes % input_buffer_frame_size; + if (incomplete_frame_bytes == 0) + break; + available_bytes += od->ring_buffer->pop( od->render_buffer + available_bytes, - input_buffer_frame_size - remainder + input_buffer_frame_size - incomplete_frame_bytes ); + } od->condition.signal(); // We are done consuming from ring_buffer