diff options
author | schmirl <schmirl> | 2007-05-30 14:20:14 +0000 |
---|---|---|
committer | schmirl <schmirl> | 2007-05-30 14:20:14 +0000 |
commit | 60b44caf3d419fa6794d6f08c49354b96a516c4b (patch) | |
tree | 08e15a5ec28f800c0828571f2567d209793228dd /remux | |
parent | bb1ac54c87ea689e6275838c606fa7224adf4169 (diff) | |
download | vdr-plugin-streamdev-60b44caf3d419fa6794d6f08c49354b96a516c4b.tar.gz vdr-plugin-streamdev-60b44caf3d419fa6794d6f08c49354b96a516c4b.tar.bz2 |
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).
Diffstat (limited to 'remux')
-rw-r--r-- | remux/extern.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/remux/extern.c b/remux/extern.c index 3c95296..01d4b33 100644 --- a/remux/extern.c +++ b/remux/extern.c @@ -118,7 +118,12 @@ void cTSExt::Action(void) if (FD_ISSET(m_Outpipe, &rfds)) { 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) { LOG_ERROR_STR("read failed"); 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_Remux(new cTSExt(m_ResultBuffer)) { - m_ResultBuffer->SetTimeouts(0, 100); + m_ResultBuffer->SetTimeouts(500, 100); } cExternRemux::~cExternRemux() |