[vlmc-devel] [PATCH 7/8] TrackWorkflow: Have each m_lastFrame for each TrackType

Hugo Beauzée-Luyssen hugo at beauzee.fr
Fri May 13 11:15:59 CEST 2016


On 05/03/2016 07:24 AM, Yikai Lu wrote:
> We have to do this as we don't separate tracks, which will cause m_lastFrame to confuse TrackType.
> ---
>   src/Workflow/TrackWorkflow.cpp | 16 ++++++++++------
>   src/Workflow/TrackWorkflow.h   |  2 +-
>   2 files changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/src/Workflow/TrackWorkflow.cpp b/src/Workflow/TrackWorkflow.cpp
> index abf8736..e126e09 100644
> --- a/src/Workflow/TrackWorkflow.cpp
> +++ b/src/Workflow/TrackWorkflow.cpp
> @@ -52,6 +52,9 @@ TrackWorkflow::TrackWorkflow( quint32 trackId  ) :
>       m_clipsLock = new QReadWriteLock;
>       m_mixerBuffer = new Workflow::Frame;
>
> +    for ( int i = 0; i < Workflow::NbTrackType; i++ )
> +        m_lastFrame[i] = 0;
> +
>       connect( this, SIGNAL( effectAdded( EffectHelper*, qint64 ) ),
>                this, SLOT( __effectAdded( EffectHelper*, qint64) ) );
>       connect( this, SIGNAL( effectMoved( EffectHelper*, qint64 ) ),
> @@ -268,7 +271,8 @@ TrackWorkflow::stop()
>           stopClipWorkflow( it.value() );
>           ++it;
>       }
> -    m_lastFrame = 0;
> +    for ( int i = 0; i < Workflow::NbTrackType; i++ )
> +        m_lastFrame[i] = 0;
>       m_isRendering = false;
>   }
>
> @@ -285,8 +289,8 @@ TrackWorkflow::getOutput( Workflow::TrackType trackType, qint64 currentFrame, qi
>       quint32                                     frameId = 0;
>       bool                                        renderOneFrame;
>
> -    if ( m_lastFrame == -1 )
> -        m_lastFrame = currentFrame;
> +    if ( m_lastFrame[trackType] == -1 )
> +        m_lastFrame[trackType] = currentFrame;
>       renderOneFrame = m_renderOneFrame.testAndSetRelease( true, false );
>
>       {
> @@ -296,10 +300,10 @@ TrackWorkflow::getOutput( Workflow::TrackType trackType, qint64 currentFrame, qi
>           // If this condition is true, the clipworkflow will flush all its buffer
>           // as we need to resynchronize after a setTime, so this condition has to remain
>           // false. Easy ain't it?
> -        if ( paused == true && subFrame != m_lastFrame && renderOneFrame == false)
> +        if ( paused == true && subFrame != m_lastFrame[trackType] && renderOneFrame == false)
>               needRepositioning = true;
>           else
> -            needRepositioning = ( qAbs( subFrame - m_lastFrame ) > 1 ) ? true : false;
> +            needRepositioning = ( qAbs( subFrame - m_lastFrame[trackType] ) > 1 ) ? true : false;
>       }
>       memset( frames, 0, sizeof(*frames) * EffectsEngine::MaxFramesForMixer );
>       while ( it != end )
> @@ -362,7 +366,7 @@ TrackWorkflow::getOutput( Workflow::TrackType trackType, qint64 currentFrame, qi
>               }
>           }
>       }
> -    m_lastFrame = subFrame;
> +    m_lastFrame[trackType] = subFrame;
>       return ret;
>   }
>
> diff --git a/src/Workflow/TrackWorkflow.h b/src/Workflow/TrackWorkflow.h
> index 6f51cb6..6625068 100644
> --- a/src/Workflow/TrackWorkflow.h
> +++ b/src/Workflow/TrackWorkflow.h
> @@ -124,7 +124,7 @@ class   TrackWorkflow : public EffectUser
>           QReadWriteLock*                         m_clipsLock;
>
>           const Workflow::TrackType               m_trackType;
> -        qint64                                  m_lastFrame;
> +        qint64                                  m_lastFrame[Workflow::NbTrackType];
>           Workflow::Frame                         *m_mixerBuffer;
>           const quint32                           m_trackId;
>
>
This m_lastFrame code is so broken in my memories that I'm willing to 
accept this blindly. I actually hope this will be gone once we're done 
tackling the audio/video sync task :)


More information about the Vlmc-devel mailing list