<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;">Hi,</span></font><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;">I have tried latest git-1342 library with my x264Encoder (QuickTime Component for MacOS X).</span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;">Mostly works well, but I have found an intermittent hang on threaded lookahead.</span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;">It could happen only when "encoding single frame" repeatedly (e.g. updating preview images).</span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div>//</div><div><br></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;">My component uses libx264 via patched libavcodec, and it could stop </span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;">- when tried to take out delayed output frame from libx264 (passing NULL buffer) - </span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;">Code snippet like:</span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "> glob->frame_size = avcodec_encode_video(glob->codecCont, </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "> glob->encode_buffer, glob->encode_buffer_size, <span style="color: #0000ff">NULL</span>);</div></div><div><br></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;">Tried to dump stacks, and found that, there is x264_lookahead_thread() remaining inside stack trace.</span></font></div><div><br></div><div><div><font class="Apple-style-span" face="Monaco" size="1"><span class="Apple-style-span" style="font-size: 9px; "> Thread id: 5872ba0</span></font></div><div><font class="Apple-style-span" face="Monaco" size="1"><span class="Apple-style-span" style="font-size: 9px;"> User stack:</span></font></div><div><font class="Apple-style-span" face="Monaco" size="1"><span class="Apple-style-span" style="font-size: 9px;"> 586 _thread_start + 34 (in libSystem.B.dylib) [0x94b9a012]</span></font></div><div><font class="Apple-style-span" face="Monaco" size="1"><span class="Apple-style-span" style="font-size: 9px;"> 586 _x264_lookahead_thread + 169 (in x264Encoder) [0x15bb7e89]</span></font></div><div><font class="Apple-style-span" face="Monaco" size="1"><span class="Apple-style-span" style="font-size: 9px;"> 586 _semaphore_wait_signal_trap + 10 (in libSystem.B.dylib) [0x94b692ce]</span></font></div><div><br></div><div>Disassemble in debugger, and found it is waiting at <span class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Monaco; font-size: 10px; ">pthread_cond_wait</span>.</div><div><br></div><div>encoder/lookahead.c</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><font class="Apple-style-span" size="1"><span class="Apple-style-span" style="font-size: 9px; "> 88: static</span></font><font class="Apple-style-span" size="1"><span class="Apple-style-span" style="font-size: 9px;"> </span></font><font class="Apple-style-span" size="1"><span class="Apple-style-span" style="font-size: 9px;">void</span></font><font class="Apple-style-span" size="1"><span class="Apple-style-span" style="font-size: 9px;"> x264_lookahead_thread( x264_t *h )</span></font></div><div><font class="Apple-style-span" face="Monaco" size="1"><span class="Apple-style-span" style="font-size: 9px;">:</span></font></div><div><font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><font class="Apple-style-span" size="1"><span class="Apple-style-span" style="font-size: 9px;">104: </span></font><font class="Apple-style-span" size="1"><span class="Apple-style-span" style="font-size: 9px;">while</span></font><font class="Apple-style-span" size="1"><span class="Apple-style-span" style="font-size: 9px;">( !h->lookahead->ifbuf.i_size && !h->lookahead->b_exit_thread )</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><font class="Apple-style-span" size="1"><span class="Apple-style-span" style="font-size: 9px;">105: x264_pthread_cond_wait( &h->lookahead->ifbuf.cv_fill, &h->lookahead->ifbuf.mutex );</span></font></div><div><br></div><div><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">Do you have any idea about what is happening?</span></font></div><div><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">//</span></font></div><div><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; ">Takashi Mochizuki</span></div></span></font></div></div><div><br></div></div></body></html>