(Vector) Fix deadlock issue: remove lock 84/258884/1
authorHeeyong Song <heeyong.song@samsung.com>
Thu, 27 May 2021 05:55:05 +0000 (14:55 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Thu, 27 May 2021 05:55:05 +0000 (14:55 +0900)
Change-Id: I145d138f6a6a16e425dae577d2ecc88fd2dbfcbb

dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp

index a1659bf..3966d0c 100644 (file)
@@ -373,7 +373,7 @@ VectorAnimationTask::UploadCompletedSignalType& VectorAnimationTask::UploadCompl
 bool VectorAnimationTask::Rasterize()
 {
   bool     stopped = false;
-  uint32_t currentFrame, droppedFrames = 0;
+  uint32_t currentFrame;
 
   {
     ConditionalWait::ScopedLock lock(mConditionalWait);
@@ -382,14 +382,13 @@ bool VectorAnimationTask::Rasterize()
       // The task will be destroyed. We don't need rasterization.
       return false;
     }
-    droppedFrames = mDroppedFrames;
   }
 
   ApplyAnimationData();
 
   if(mPlayState == PlayState::PLAYING && mUpdateFrameNumber)
   {
-    mCurrentFrame = mForward ? mCurrentFrame + droppedFrames + 1 : mCurrentFrame - droppedFrames - 1;
+    mCurrentFrame = mForward ? mCurrentFrame + mDroppedFrames + 1 : mCurrentFrame - mDroppedFrames - 1;
     Dali::ClampInPlace(mCurrentFrame, mStartFrame, mEndFrame);
   }
 
@@ -525,8 +524,6 @@ uint32_t VectorAnimationTask::GetStoppedFrame(uint32_t startFrame, uint32_t endF
 
 VectorAnimationTask::TimePoint VectorAnimationTask::CalculateNextFrameTime(bool renderNow)
 {
-  uint32_t droppedFrames = 0;
-
   // std::chrono::time_point template has second parameter duration which defaults to the std::chrono::system_clock supported
   // duration. In some C++11 implementations it is a milliseconds duration, so it fails to compile unless mNextFrameStartTime
   // is casted to use the default duration.
@@ -535,21 +532,20 @@ VectorAnimationTask::TimePoint VectorAnimationTask::CalculateNextFrameTime(bool
   if(renderNow)
   {
     mNextFrameStartTime = current;
+    mDroppedFrames      = 0;
   }
   else if(mNextFrameStartTime < current)
   {
+    uint32_t droppedFrames = 0;
+
     while(current > std::chrono::time_point_cast<TimePoint::duration>(mNextFrameStartTime + std::chrono::microseconds(mFrameDurationMicroSeconds)))
     {
       droppedFrames++;
       mNextFrameStartTime = std::chrono::time_point_cast<TimePoint::duration>(mNextFrameStartTime + std::chrono::microseconds(mFrameDurationMicroSeconds));
     }
 
-    {
-      ConditionalWait::ScopedLock lock(mConditionalWait);
-      mDroppedFrames = droppedFrames;
-    }
-
     mNextFrameStartTime = current;
+    mDroppedFrames      = droppedFrames;
   }
 
   return mNextFrameStartTime;