diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2013-01-20 13:40:30 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2013-01-20 13:40:30 +0100 |
commit | 1ba20fa20f632ffb548f57ca9b3b5b9bab5296d0 (patch) | |
tree | 152fc0790eabd7a056aa10138426da942cc3fbe4 /transfer.c | |
parent | abde1d04aeb7beb29c2638389c29ff92ff87a75a (diff) | |
download | vdr-1ba20fa20f632ffb548f57ca9b3b5b9bab5296d0.tar.gz vdr-1ba20fa20f632ffb548f57ca9b3b5b9bab5296d0.tar.bz2 |
Reduced the number of retries in cTransfer::Receive() to avoid blocking recordings in case the primary device can't handle the current live signal1.7.36
Diffstat (limited to 'transfer.c')
-rw-r--r-- | transfer.c | 20 |
1 files changed, 16 insertions, 4 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: transfer.c 2.6 2012/02/29 14:16:23 kls Exp $ + * $Id: transfer.c 2.7 2013/01/20 13:40:30 kls Exp $ */ #include "transfer.h" @@ -15,6 +15,7 @@ cTransfer::cTransfer(const cChannel *Channel) :cReceiver(Channel, TRANSFERPRIORITY) { patPmtGenerator.SetChannel(Channel); + retriesExceeded = false; } cTransfer::~cTransfer() @@ -35,6 +36,10 @@ void cTransfer::Activate(bool On) cPlayer::Detach(); } +#define MAXRETRIES 5 // max. number of retries for a single TS packet +#define RETRYWAIT 5 // time (in ms) between two retries +#define RETRYPAUSE 10000 // time (in ms) for which to pause retrying once a packet has not been accepted + void cTransfer::Receive(uchar *Data, int Length) { if (cPlayer::IsAttached()) { @@ -42,11 +47,18 @@ void cTransfer::Receive(uchar *Data, int Length) // buffering here. The TS packets *must* get through here! However, every // now and then there may be conditions where the packet just can't be // handled when offered the first time, so that's why we try several times: - for (int i = 0; i < 100; i++) { - if (PlayTs(Data, Length) > 0) + for (int i = 0; i < MAXRETRIES; i++) { + if (PlayTs(Data, Length) > 0) { + if (retriesExceeded && timer.TimedOut()) + retriesExceeded = false; + return; + } + if (retriesExceeded) // no retries once a packet has not been accepted return; - cCondWait::SleepMs(10); + cCondWait::SleepMs(RETRYWAIT); } + retriesExceeded = true; + timer.Set(RETRYPAUSE); // wait a while before retrying esyslog("ERROR: TS packet not accepted in Transfer Mode"); } } |