@ -570,11 +570,12 @@ void ff_thread_report_progress(ThreadFrame *f, int n, int field)
p = f - > owner [ field ] - > internal - > thread_ctx ;
p = f - > owner [ field ] - > internal - > thread_ctx ;
pthread_mutex_lock ( & p - > progress_mutex ) ;
if ( atomic_load_explicit ( & p - > debug_threads , memory_order_relaxed ) )
if ( atomic_load_explicit ( & p - > debug_threads , memory_order_relaxed ) )
av_log ( f - > owner [ field ] , AV_LOG_DEBUG ,
av_log ( f - > owner [ field ] , AV_LOG_DEBUG ,
" %p finished %d field %d \n " , progress , n , field ) ;
" %p finished %d field %d \n " , progress , n , field ) ;
pthread_mutex_lock ( & p - > progress_mutex ) ;
atomic_store_explicit ( & progress [ field ] , n , memory_order_release ) ;
atomic_store_explicit ( & progress [ field ] , n , memory_order_release ) ;
pthread_cond_broadcast ( & p - > progress_cond ) ;
pthread_cond_broadcast ( & p - > progress_cond ) ;
@ -592,10 +593,11 @@ void ff_thread_await_progress(ThreadFrame *f, int n, int field)
p = f - > owner [ field ] - > internal - > thread_ctx ;
p = f - > owner [ field ] - > internal - > thread_ctx ;
pthread_mutex_lock ( & p - > progress_mutex ) ;
if ( atomic_load_explicit ( & p - > debug_threads , memory_order_relaxed ) )
if ( atomic_load_explicit ( & p - > debug_threads , memory_order_relaxed ) )
av_log ( f - > owner [ field ] , AV_LOG_DEBUG ,
av_log ( f - > owner [ field ] , AV_LOG_DEBUG ,
" thread awaiting %d field %d from %p \n " , n , field , progress ) ;
" thread awaiting %d field %d from %p \n " , n , field , progress ) ;
pthread_mutex_lock ( & p - > progress_mutex ) ;
while ( atomic_load_explicit ( & progress [ field ] , memory_order_relaxed ) < n )
while ( atomic_load_explicit ( & progress [ field ] , memory_order_relaxed ) < n )
pthread_cond_wait ( & p - > progress_cond , & p - > progress_mutex ) ;
pthread_cond_wait ( & p - > progress_cond , & p - > progress_mutex ) ;
pthread_mutex_unlock ( & p - > progress_mutex ) ;
pthread_mutex_unlock ( & p - > progress_mutex ) ;