[vlmc-devel] TrackWorkflow: Have each m_lastFrame for each TrackType

Yikai Lu git at videolan.org
Wed Jun 1 18:14:53 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Tue May  3 13:09:01 2016 +0900| [b11457a50fdbdeba6205e5212b4bb3c1d02aafde] | committer: Hugo Beauzée-Luyssen

TrackWorkflow: Have each m_lastFrame for each TrackType

We have to do this as we don't separate tracks, which will cause m_lastFrame to confuse TrackType.

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

> https://code.videolan.org/videolan/vlmc/commit/b11457a50fdbdeba6205e5212b4bb3c1d02aafde
---

 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..08213ef 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;
 



More information about the Vlmc-devel mailing list