[x264-devel] x264_encoder_open failed and not closing threads

Koby Shina koby at zixi.com
Tue Oct 9 17:44:53 CEST 2018


Hello
I noticed that I have "live" x264 threads despite the fact that 'x264_encoder_open' failed (probably due to bad configuration from my side)
While trying to debug it, I found that when 'x264_encoder_open' fails, it jumps to 'fail' label (goto fail).

'fail' do not close any opened threads (encoder and look ahead threads)  and it is simply releasing the allocated memory.

This behaviour was observed on windows (compiled using m-sys and msvc 2015 - see here  : http://roxlu.com/2016/057/compiling-x264-on-windows-with-msvc), but I am pretty sure it's reproducible on other platforms as well.

The version that appears in x264_config.h file is  " r2901 7d0ff22" (but as far as I can see, it wasn't fixed in the today's snapshot)

As a temporary work around I added these few lines before the call x264_free (encoder.c : 1754)

       if (h->param.i_threads > 1)
              x264_threadpool_delete(h->threadpool);

       if (h->param.i_lookahead_threads > 1)
              x264_threadpool_delete(h->lookaheadpool);

x264_free( h );

Appreciate if you can add a proper fix (I guess that my workaround is not complete and there are more objects that needs to be deleted)

Thanks
Koby
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20181009/8590dc15/attachment-0001.html>


More information about the x264-devel mailing list