From 28359cf48a3f6abc99c0fa0beb641fc9a351c40b Mon Sep 17 00:00:00 2001 From: Pete Watts Date: Fri, 28 Mar 2014 21:36:06 +0000 Subject: [PATCH] Replaced _run recursive call with a while loop. Provides exactly the same functionality with the benefits of no longer gradually increasing memory usage of the PHP process while transcoding. No longer trips up on xdebug.max_nesting_level setting. --- src/PHPVideoToolkit/ExecBuffer.php | 37 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/PHPVideoToolkit/ExecBuffer.php b/src/PHPVideoToolkit/ExecBuffer.php index 288733f..3ef8931 100644 --- a/src/PHPVideoToolkit/ExecBuffer.php +++ b/src/PHPVideoToolkit/ExecBuffer.php @@ -230,25 +230,26 @@ public function getRunTime() */ protected function _run($callback) { -// get the buffer regardless of wether or not there is a callback as it updates and -// checks for the completion of the command. - $buffer = $this->getBuffer(); - -// get the buffer to give to the - if($callback !== null && is_callable($callback) === true) - { - call_user_func($callback, $this, $buffer, false); - } - -// if we have finished running the loop then break here. - if($this->_running === false) - { - return; + while($this->_running !== false) { +// get the buffer regardless of wether or not there is a callback as it updates and +// checks for the completion of the command. + $buffer = $this->getBuffer(); + +// get the buffer to give to the + if($callback !== null && is_callable($callback) === true) + { + call_user_func($callback, $this, $buffer, false); + } + +// if we have finished running the loop then break here. + if($this->_running === false) + { + break; + } + +// still running so wait and then run again. + $this->wait($this->_callback_period_interval); } - -// still running so wait and then run again. - $this->wait($this->_callback_period_interval); - $this->_run($callback); } /**