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

yikei lu luyikei.qmltu at gmail.com
Sat Apr 2 08:54:14 CEST 2016


I think this simple version also works

2016-04-02 15:52 GMT+09:00 Yikai Lu <luyikei.qmltu at gmail.com>:
> 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();
>  }
>
> --
> 1.9.1
>


More information about the Vlmc-devel mailing list