<div dir="ltr">Pushed to default.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 16, 2020 at 8:19 PM Aruna Matheswaran <<a href="mailto:aruna@multicorewareinc.com">aruna@multicorewareinc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"># HG changeset patch<br>
# User Aruna Matheswaran <<a href="mailto:aruna@multicorewareinc.com" target="_blank">aruna@multicorewareinc.com</a>><br>
# Date 1587043136 -19800<br>
# Thu Apr 16 18:48:56 2020 +0530<br>
# Node ID 94bfe7f2c0c12616145f8fc1a1762ed55204a0a6<br>
# Parent 6bb2d88029c2e13fa13b5b053aa725d4fa84a084<br>
app: fix broken input read<br>
<br>
This patch fixes indefinite wait for input frames that led the encoder to<br>
stuck after encoding all the frames.<br>
<br>
diff -r 6bb2d88029c2 -r 94bfe7f2c0c1 source/abrEncApp.cpp<br>
--- a/source/abrEncApp.cpp Thu Apr 09 13:09:15 2020 +0530<br>
+++ b/source/abrEncApp.cpp Thu Apr 16 18:48:56 2020 +0530<br>
@@ -213,7 +213,7 @@<br>
m_input = m_cliopt.input;<br>
m_param = x265_param_alloc();<br>
x265_copy_params(m_param, cliopt.param);<br>
- m_doneReading = false;<br>
+ m_inputOver = false;<br>
m_lastIdx = -1;<br>
m_encoder = NULL;<br>
m_scaler = NULL;<br>
@@ -461,7 +461,7 @@<br>
int ipwrite = m_parent->m_picWriteCnt[m_id].get();<br>
<br>
bool isAbrLoad = m_isAnalysisLoad && (m_parent->m_numEncodes > 1);<br>
- while (m_threadActive && (ipread == ipwrite))<br>
+ while (!m_inputOver && (ipread == ipwrite))<br>
{<br>
ipwrite = m_parent->m_picWriteCnt[m_id].waitForChange(ipwrite);<br>
}<br>
@@ -978,7 +978,7 @@<br>
/* unscaled picture is stored in the last index */<br>
uint32_t srcId = m_id - 1;<br>
int QDepth = m_parentEnc->m_parent->m_queueSize;<br>
- while (!m_parentEnc->m_doneReading)<br>
+ while (!m_parentEnc->m_inputOver)<br>
{<br>
<br>
uint32_t scaledWritten = m_parentEnc->m_parent->m_picWriteCnt[m_id].get();<br>
@@ -1092,7 +1092,7 @@<br>
x265_picture* src = x265_picture_alloc();<br>
x265_picture_init(m_parentEnc->m_param, src);<br>
<br>
- while (!m_parentEnc->m_doneReading)<br>
+ while (m_threadActive)<br>
{<br>
uint32_t written = m_parentEnc->m_parent->m_picWriteCnt[m_id].get();<br>
uint32_t writeIdx = written % QDepth;<br>
@@ -1141,11 +1141,11 @@<br>
}<br>
else<br>
{<br>
+ m_threadActive = false;<br>
+ m_parentEnc->m_inputOver = true;<br>
m_parentEnc->m_parent->m_picWriteCnt[m_id].poke();<br>
- break;<br>
}<br>
}<br>
x265_picture_free(src);<br>
- m_threadActive = false;<br>
}<br>
}<br>
diff -r 6bb2d88029c2 -r 94bfe7f2c0c1 source/abrEncApp.h<br>
--- a/source/abrEncApp.h Thu Apr 09 13:09:15 2020 +0530<br>
+++ b/source/abrEncApp.h Thu Apr 16 18:48:56 2020 +0530<br>
@@ -80,7 +80,7 @@<br>
bool m_isScaled;<br>
bool m_isAnalysisSave;<br>
bool m_isAnalysisLoad;<br>
- bool m_doneReading;<br>
+ bool m_inputOver;<br>
<br>
int m_threadActive;<br>
int m_lastIdx;<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font face="georgia, serif">Regards,</font><div><b><font face="georgia, serif">Aruna Matheswaran,</font></b></div><div><font face="georgia, serif">Video Codec Engineer,</font></div><div><font face="georgia, serif">Media & AI analytics BU,</font></div><div><span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span style="border:none;display:inline-block;overflow:hidden;width:153px;height:58px"><img src="https://lh5.googleusercontent.com/gjX5cPNIZgwUrhfqkTwQUZWztIKmmo0qs3kbwvkS5H-bDVE2ftte9pMTVnFLSjOcjYWLtfc6_OGpxW4vraLg2r5QAIf1Q3MpldFDgWtzK_gXi8ptw5B3joIbsGL6mxj-JRdjHzT5" width="96" height="36" style="margin-left: 0px; margin-top: 0px;"></span></span></span><font face="georgia, serif"><br></font></div><div><span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span style="border:none;display:inline-block;overflow:hidden;width:153px;height:58px"><img src="https://lh5.googleusercontent.com/gjX5cPNIZgwUrhfqkTwQUZWztIKmmo0qs3kbwvkS5H-bDVE2ftte9pMTVnFLSjOcjYWLtfc6_OGpxW4vraLg2r5QAIf1Q3MpldFDgWtzK_gXi8ptw5B3joIbsGL6mxj-JRdjHzT5" style="margin-left: 0px; margin-top: 0px;"></span></span></span><font face="georgia, serif"><br></font></div><div><font face="georgia, serif"><br></font></div></div></div></div></div></div></div></div></div>