[vlmc-devel] [PATCH] Ensure Max Buffer Size after the unlock function in ClipWorkflow
yikei lu
luyikei.qmltu at gmail.com
Sat Apr 2 06:58:58 CEST 2016
Sorry this patch has a problem: when the renderer stops by
limitBufferSize() in unlock, it never gets up again! I'll send another
patch...
2016-04-02 13:47 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 | 1 +
> src/Workflow/ClipWorkflow.cpp | 8 +++++++-
> src/Workflow/ClipWorkflow.h | 1 +
> src/Workflow/VideoClipWorkflow.cpp | 1 +
> 4 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/src/Workflow/AudioClipWorkflow.cpp b/src/Workflow/AudioClipWorkflow.cpp
> index 1eb2698..3b08877 100644
> --- a/src/Workflow/AudioClipWorkflow.cpp
> +++ b/src/Workflow/AudioClipWorkflow.cpp
> @@ -172,6 +172,7 @@ AudioClipWorkflow::unlock( void* data, uint8_t *pcm_buffer, unsigned int channel
> else
> cw->m_currentPts = pts;
> }
> + cw->limitBufferSize();
> cw->m_renderLock->unlock();
> }
>
> diff --git a/src/Workflow/ClipWorkflow.cpp b/src/Workflow/ClipWorkflow.cpp
> index d5e5432..8da3646 100644
> --- a/src/Workflow/ClipWorkflow.cpp
> +++ b/src/Workflow/ClipWorkflow.cpp
> @@ -155,7 +155,7 @@ ClipWorkflow::waitForCompleteInit()
> }
>
> void
> -ClipWorkflow::postGetOutput()
> +ClipWorkflow::limitBufferSize()
> {
> //If we're running out of computed buffers, refill our stack.
> if ( getNbComputedBuffers() < getMaxComputedBuffers() / 3 )
> @@ -171,6 +171,12 @@ ClipWorkflow::postGetOutput()
> }
>
> void
> +ClipWorkflow::postGetOutput()
> +{
> + limitBufferSize();
> +}
> +
> +void
> ClipWorkflow::computePtsDiff( qint64 pts )
> {
> if ( m_pauseDuration != -1 )
> diff --git a/src/Workflow/ClipWorkflow.h b/src/Workflow/ClipWorkflow.h
> index cdac341..19a6823 100644
> --- a/src/Workflow/ClipWorkflow.h
> +++ b/src/Workflow/ClipWorkflow.h
> @@ -98,6 +98,7 @@ class ClipWorkflow : public EffectUser
> * of the rendering process advancement.
> */
> virtual Workflow::OutputBuffer *getOutput( ClipWorkflow::GetMode mode, qint64 currentFrame ) = 0;
> + void limitBufferSize();
> void postGetOutput();
> /**
> * @brief Initialize base variables for the SourceRenderer.
> diff --git a/src/Workflow/VideoClipWorkflow.cpp b/src/Workflow/VideoClipWorkflow.cpp
> index 46b0650..39765f9 100644
> --- a/src/Workflow/VideoClipWorkflow.cpp
> +++ b/src/Workflow/VideoClipWorkflow.cpp
> @@ -163,6 +163,7 @@ 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();
> + cw->limitBufferSize();
> cw->m_renderLock->unlock();
> }
>
> --
> 1.9.1
>
More information about the Vlmc-devel
mailing list