[x264-devel] Problem with x264 multithreding enabled

Steven Walters kemuri9 at gmail.com
Wed Sep 16 15:47:23 CEST 2009


On Wed, Sep 16, 2009 at 4:43 AM, Alessandro Ferrari
<alessandroferrari87 at gmail.com> wrote:
> Hi,
>      i'm developing a program using x264 api starting by the source code of
> x264.c, and I encurr in a problem that probably i miss any operations. I
> need to minimize the frame delay, so for this reason initially i have
> developed forcing using only one thread. The program in this case works
> correctly. Then, for maximize the performance i simply set the i_threads=2
> to enabling multi-threading, and I expect a frame delay of one frame, but
> the result is very different. I test the encoder on a sequence of 100
> frames, and for all 100 frames the encoder function return a zero value for
> i_nal, at the end in the flush _delayed_frame loop  i  have again  2 encoder
> function calling with i_nal null, and then at the third passing i have
> i_nal=1 but i have this error:
> test_x264_2thread: common/frame.c:971: x264_frame_push_unused: Assertion
> `frame->i_reference_count > 0' failed.
> The strange things is that with param.i_threads=1 always works without
> problem.
> If i force the settings of x264.c by specifying it before calling the
> encoder function to be equal at the settings that i specify in my program i
> haven't this error. What could be the problem?
> I also include my encoding functions:
>
> Thanks for the attention.
> Best regards.
>

with threads >1, the lookahead thread is enabled by default as well
which adds more delay itself.
It does not seem you are compensating for this in your logic so try
disabling it by adding a
param.i_sync_lookahead = 0;
line in your section where you modify the parameters.


More information about the x264-devel mailing list