changeset 9608:e1b402399735

slicetype: clear m_helpWanted with input lock held to prevent race
author Steve Borho <steve@borho.org>
date Mon, 02 Mar 2015 19:24:06 -0600
parents 9eceacadf27b
children 1ce139389b3b
files source/encoder/slicetype.cpp
diffstat 1 files changed, 3 insertions(+-), 3 deletions(-) [+]
line wrap: on
line diff
--- a/source/encoder/slicetype.cpp	Mon Mar 02 18:52:34 2015 -0600
+++ b/source/encoder/slicetype.cpp	Mon Mar 02 19:24:06 2015 -0600
@@ -685,7 +685,9 @@ void Lookahead::findJob(int workerThread
              * slicetypeDecide() */
             m_inputLock.acquire();
             if (!m_sliceTypeBusy && !m_preTotal && m_inputQueue.size() >= m_fullQueueSize && m_isActive)
-                 doDecide = m_sliceTypeBusy = true;
+                doDecide = m_sliceTypeBusy = true;
+            else
+                m_helpWanted = false;
             m_inputLock.release();
         }
         m_preLookaheadLock.release();
@@ -726,8 +728,6 @@ void Lookahead::findJob(int workerThread
         }
     }
     while (preFrame || doDecide);
-
-    m_helpWanted = false;
 }
 
 /* Called by API thread */