mirror of
https://projects.vdr-developer.org/git/vdr-plugin-streamdev.git
synced 2023-10-10 19:16:51 +02:00
cRingBufferLinear::Read() will return 0 either if EOF is encountered
or if the buffer is full. We need to check the buffer space to distinguish these two cases (#307).
This commit is contained in:
parent
bb1ac54c87
commit
60b44caf3d
@ -118,7 +118,12 @@ void cTSExt::Action(void)
|
|||||||
|
|
||||||
if (FD_ISSET(m_Outpipe, &rfds)) {
|
if (FD_ISSET(m_Outpipe, &rfds)) {
|
||||||
int result;
|
int result;
|
||||||
if ((result = m_ResultBuffer->Read(m_Outpipe)) == -1) {
|
//Read returns 0 if buffer full or EOF
|
||||||
|
bool bufferFull = m_ResultBuffer->Free() <= 0; //Free may be < 0
|
||||||
|
while ((result = m_ResultBuffer->Read(m_Outpipe)) == 0 && bufferFull)
|
||||||
|
dsyslog("streamdev-server: buffer full while reading from externremux");
|
||||||
|
|
||||||
|
if (result == -1) {
|
||||||
if (errno != EINTR) {
|
if (errno != EINTR) {
|
||||||
LOG_ERROR_STR("read failed");
|
LOG_ERROR_STR("read failed");
|
||||||
m_Active = false;
|
m_Active = false;
|
||||||
@ -149,7 +154,7 @@ cExternRemux::cExternRemux(int VPid, const int *APids, const int *Dpids, const i
|
|||||||
m_ResultBuffer(new cRingBufferLinear(WRITERBUFSIZE, TS_SIZE * 2)),
|
m_ResultBuffer(new cRingBufferLinear(WRITERBUFSIZE, TS_SIZE * 2)),
|
||||||
m_Remux(new cTSExt(m_ResultBuffer))
|
m_Remux(new cTSExt(m_ResultBuffer))
|
||||||
{
|
{
|
||||||
m_ResultBuffer->SetTimeouts(0, 100);
|
m_ResultBuffer->SetTimeouts(500, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
cExternRemux::~cExternRemux()
|
cExternRemux::~cExternRemux()
|
||||||
|
Loading…
Reference in New Issue
Block a user