From: Frank Galligan Date: Wed, 1 Sep 2010 20:40:18 +0000 (-0400) Subject: Fix rare deadlock before loop filter X-Git-Tag: v0.9.2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d45e55015e85897c4307959b5f9df94da5b41f33;p=platform%2Fupstream%2Flibvpx.git Fix rare deadlock before loop filter There was an extremely rare deadlock that happened when one thread was waiting to start the loop filter on frame n while the other threads were starting to work on frame n+1. Change-Id: Icc94f728b3b6663405435640d9a2996735ba19ef --- diff --git a/vp8/decoder/threading.c b/vp8/decoder/threading.c index 10e72ce..02edba2 100644 --- a/vp8/decoder/threading.c +++ b/vp8/decoder/threading.c @@ -161,6 +161,8 @@ THREAD_FUNCTION vp8_thread_decoding_proc(void *p_data) while (1) { + int current_filter_level = 0; + if (pbi->b_multithreaded_rd == 0) break; @@ -279,6 +281,11 @@ THREAD_FUNCTION vp8_thread_decoding_proc(void *p_data) } } } + + // If |pbi->common.filter_level| is 0 the value can change in-between + // the sem_post and the check to call vp8_thread_loop_filter. + current_filter_level = pbi->common.filter_level; + // add this to each frame if ((mbrd->mb_row == pbi->common.mb_rows-1) || ((mbrd->mb_row == pbi->common.mb_rows-2) && (pbi->common.mb_rows % (pbi->decoding_thread_count+1))==1)) { @@ -286,7 +293,7 @@ THREAD_FUNCTION vp8_thread_decoding_proc(void *p_data) sem_post(&pbi->h_event_end_decoding); } - if ((pbi->b_multithreaded_lf) &&(pbi->common.filter_level)) + if ((pbi->b_multithreaded_lf) && (current_filter_level)) vp8_thread_loop_filter(pbi, mbrd, ithread); }