[vlmc-devel] [PATCH] Ensure Max Buffer Size after the unlock function in ClipWorkflow

Hugo Beauzée-Luyssen hugo at beauzee.fr
Sat Apr 2 11:37:33 CEST 2016


On 04/02/2016 08:52 AM, Yikai Lu wrote:
> Currently, we only check the buffer size in "getOutput" function; however, it is called by the source renderer in the WorkflowRenderer. So if the source renderer hangs for some reason, it's highly likely that m_computedBuffers will overflow.
> ---
>   src/Workflow/AudioClipWorkflow.cpp | 2 ++
>   src/Workflow/VideoClipWorkflow.cpp | 2 ++
>   2 files changed, 4 insertions(+)
>
> diff --git a/src/Workflow/AudioClipWorkflow.cpp b/src/Workflow/AudioClipWorkflow.cpp
> index 1eb2698..0924f7a 100644
> --- a/src/Workflow/AudioClipWorkflow.cpp
> +++ b/src/Workflow/AudioClipWorkflow.cpp
> @@ -172,6 +172,8 @@ AudioClipWorkflow::unlock( void* data, uint8_t *pcm_buffer, unsigned int channel
>           else
>               cw->m_currentPts = pts;
>       }
> +    if ( cw->getNbComputedBuffers() > cw->getMaxComputedBuffers() ) {
> +        cw->m_renderer->setPause( true );
>       cw->m_renderLock->unlock();
>   }
>
> diff --git a/src/Workflow/VideoClipWorkflow.cpp b/src/Workflow/VideoClipWorkflow.cpp
> index 46b0650..746548a 100644
> --- a/src/Workflow/VideoClipWorkflow.cpp
> +++ b/src/Workflow/VideoClipWorkflow.cpp
> @@ -163,6 +163,8 @@ VideoClipWorkflow::unlock( void *data, uint8_t *buffer, int width,
>       Workflow::Frame     *frame = cw->m_computedBuffers.last();
>       frame->ptsDiff = cw->m_currentPts - cw->m_previousPts;
>       cw->m_renderWaitCond->wakeAll();
> +    if ( cw->getNbComputedBuffers() > cw->getMaxComputedBuffers() )
> +        cw->m_renderer->setPause( true );
>       cw->m_renderLock->unlock();
>   }
>
>
Same reasoning applies, controlling a libvlc input from a libvlc thread 
is generally a really bad idea.

Regards,


More information about the Vlmc-devel mailing list