[x265] [PATCH] app: fix broken input read
Aruna Matheswaran
aruna at multicorewareinc.com
Thu Apr 16 16:48:48 CEST 2020
# HG changeset patch
# User Aruna Matheswaran <aruna at multicorewareinc.com>
# Date 1587043136 -19800
# Thu Apr 16 18:48:56 2020 +0530
# Node ID 94bfe7f2c0c12616145f8fc1a1762ed55204a0a6
# Parent 6bb2d88029c2e13fa13b5b053aa725d4fa84a084
app: fix broken input read
This patch fixes indefinite wait for input frames that led the encoder to
stuck after encoding all the frames.
diff -r 6bb2d88029c2 -r 94bfe7f2c0c1 source/abrEncApp.cpp
--- a/source/abrEncApp.cpp Thu Apr 09 13:09:15 2020 +0530
+++ b/source/abrEncApp.cpp Thu Apr 16 18:48:56 2020 +0530
@@ -213,7 +213,7 @@
m_input = m_cliopt.input;
m_param = x265_param_alloc();
x265_copy_params(m_param, cliopt.param);
- m_doneReading = false;
+ m_inputOver = false;
m_lastIdx = -1;
m_encoder = NULL;
m_scaler = NULL;
@@ -461,7 +461,7 @@
int ipwrite = m_parent->m_picWriteCnt[m_id].get();
bool isAbrLoad = m_isAnalysisLoad && (m_parent->m_numEncodes > 1);
- while (m_threadActive && (ipread == ipwrite))
+ while (!m_inputOver && (ipread == ipwrite))
{
ipwrite = m_parent->m_picWriteCnt[m_id].waitForChange(ipwrite);
}
@@ -978,7 +978,7 @@
/* unscaled picture is stored in the last index */
uint32_t srcId = m_id - 1;
int QDepth = m_parentEnc->m_parent->m_queueSize;
- while (!m_parentEnc->m_doneReading)
+ while (!m_parentEnc->m_inputOver)
{
uint32_t scaledWritten = m_parentEnc->m_parent->m_picWriteCnt[m_id].get();
@@ -1092,7 +1092,7 @@
x265_picture* src = x265_picture_alloc();
x265_picture_init(m_parentEnc->m_param, src);
- while (!m_parentEnc->m_doneReading)
+ while (m_threadActive)
{
uint32_t written = m_parentEnc->m_parent->m_picWriteCnt[m_id].get();
uint32_t writeIdx = written % QDepth;
@@ -1141,11 +1141,11 @@
}
else
{
+ m_threadActive = false;
+ m_parentEnc->m_inputOver = true;
m_parentEnc->m_parent->m_picWriteCnt[m_id].poke();
- break;
}
}
x265_picture_free(src);
- m_threadActive = false;
}
}
diff -r 6bb2d88029c2 -r 94bfe7f2c0c1 source/abrEncApp.h
--- a/source/abrEncApp.h Thu Apr 09 13:09:15 2020 +0530
+++ b/source/abrEncApp.h Thu Apr 16 18:48:56 2020 +0530
@@ -80,7 +80,7 @@
bool m_isScaled;
bool m_isAnalysisSave;
bool m_isAnalysisLoad;
- bool m_doneReading;
+ bool m_inputOver;
int m_threadActive;
int m_lastIdx;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265_push.patch
Type: text/x-patch
Size: 2665 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20200416/4b63b21b/attachment.bin>
More information about the x265-devel
mailing list