[FFmpeg-devel] h264 threading fate tests

Clément Bœsch ubitux at gmail.com
Wed Jul 11 17:48:50 CEST 2012

On Mon, Apr 16, 2012 at 04:43:42PM +0200, Clément Bœsch wrote:
> Hi,
> I recently setup a few fate instances to test the threading (2, 8, 16 and
> auto), and regularly one of the h264 conformance test fails; look at the
> yellow entries here for instance:
> http://fate.ffmpeg.org/history.cgi?slot=x86_64-archlinux-gcc-threads-8
> The other day, I tried to run an automated git bisect run, but
> unfortunately testing the potential regression would requires to run
> something like "while true; do make fate-h264 -j20 THREADS=8; done" for
> around 15 minutes at least each time, and it might not even be reliable.
> I'm not familiar at all with AVC decoding or threading in FFmpeg, but
> maybe someone has an idea of what could cause this?

I added a helgrind box on FATE and it seems to detect a few races:

If anyone is up to fix the more obvious ones...

Some of them look simple to fix at first sight, for instance:

diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 7f2ea09..597aeba 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -975,9 +975,9 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f)
         avctx->get_buffer == avcodec_default_get_buffer) {
         err = avctx->get_buffer(avctx, f);
     } else {
+        pthread_mutex_lock(&p->progress_mutex);
         p->requested_frame = f;
         p->state = STATE_GET_BUFFER;
-        pthread_mutex_lock(&p->progress_mutex);
         while (p->state != STATE_SETTING_UP)

BTW, the run took ~3 hours, I will likely switch to --history-level=approx, and
maybe THREADS=2 to make it faster (since it's also blocking the other fate

If anyone is willing to keep a "full" version, here is my config:


Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120711/c49599ff/attachment.asc>

More information about the ffmpeg-devel mailing list