<div dir="ltr"><div>Hi. I've compiled x264 from master on Windows 7 with mingw 4.8.2 POSIX threading, DWARF exceptions (from here: <a href="https://sourceforge.net/projects/mingw-w64/files/Toolchains" target="_blank">https://sourceforge.net/projects/mingw-w64/files/Toolchains</a> targetting Win32/Personal Builds/mingw-builds/4.8.2). I've wrote a small application to grab the screen contents and encode it with x264. The screen itself displays a live metal concert, so the bitrate is rather high. I see that <span style="color:#000000">x264_encoder_encode() hangs randomly. Pseudo code:<br><br></span></div><div><span style="color:#000000">while(true)<br>{<br></span></div><div><span style="color:#000000">    print "Grabbing"<br></span></div><div><span style="color:#000000">    grab screen<br></span></div><div><span style="color:#000000"><br></span><div><span style="color:#000000">    print "Converting"<br></span></div><span style="color:#000000"></span><span style="color:#000000">    convert to YUV<br></span><span style="color:#000000"><br></span><div><span style="color:#000000">    print "Encoding"<br></span></div><span style="color:#000000"></span><span style="color:#000000">    x264_encoder_encode()</span></div><div><span style="color:#000000">}<br><br></span></div><div><span style="color:#000000">So I see something like that:<br><br></span><span style="color:#000000">Grabbing<br></span><span style="color:#000000">Converting</span><br><span style="color:#000000">Encoding</span><br></div><div><span style="color:#000000">Grabbing<br></span><span style="color:#000000">Converting</span><br><span style="color:#000000">Encoding</span><br><div><span style="color:#000000"><nothing, the application in hanged up><br><br></span></div><div><span style="color:#000000">The hang may happen in 1 minute, or in 3 minutes, or in 5 minutes, it's completely random.<br><br></span></div>Parameters I use:<br><br>param.i_log_level = X264_LOG_DEBUG;<br>param.i_threads = 8; // Number of my CPU cores<br>param.i_csp = X264_CSP_I420;<br>param.i_keyint_max = param.i_fps_num * 5;<br>param.i_width  = ...; // screen width<br>param.i_height = ...; // screen height<br>param.b_vfr_input = 0;<br>param.b_repeat_headers = 1;<br>param.b_annexb = 1;<br><br>I've tried to debug this with adding debug messages into x264, but the hang occurs in different places. It looks like the common place in all hangs is threading. For example, last hang occured in encode.c at line 3094 here:<br><br>        if( x264_stack_align( x264_slice_write, h ) ) // <===<br>            goto fail;<br><br><br>Any ideas how tot fix/debug this?<br></div></div>