mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Reduced the number of retries in cTransfer::Receive() to avoid blocking recordings in case the primary device can't handle the current live signal
This commit is contained in:
parent
abde1d04ae
commit
1ba20fa20f
2
HISTORY
2
HISTORY
@ -7531,3 +7531,5 @@ Video Disk Recorder Revision History
|
|||||||
exists (suggested by Malte Forkel).
|
exists (suggested by Malte Forkel).
|
||||||
- Implemented scaling of SPU bitmaps (thanks to Johann Friedrichs).
|
- Implemented scaling of SPU bitmaps (thanks to Johann Friedrichs).
|
||||||
- Improved cutting MPEG-2 video (thanks to Sören Moch).
|
- Improved cutting MPEG-2 video (thanks to Sören Moch).
|
||||||
|
- Reduced the number of retries in cTransfer::Receive() to avoid blocking recordings
|
||||||
|
in case the primary device can't handle the current live signal.
|
||||||
|
20
transfer.c
20
transfer.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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"
|
#include "transfer.h"
|
||||||
@ -15,6 +15,7 @@ cTransfer::cTransfer(const cChannel *Channel)
|
|||||||
:cReceiver(Channel, TRANSFERPRIORITY)
|
:cReceiver(Channel, TRANSFERPRIORITY)
|
||||||
{
|
{
|
||||||
patPmtGenerator.SetChannel(Channel);
|
patPmtGenerator.SetChannel(Channel);
|
||||||
|
retriesExceeded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
cTransfer::~cTransfer()
|
cTransfer::~cTransfer()
|
||||||
@ -35,6 +36,10 @@ void cTransfer::Activate(bool On)
|
|||||||
cPlayer::Detach();
|
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)
|
void cTransfer::Receive(uchar *Data, int Length)
|
||||||
{
|
{
|
||||||
if (cPlayer::IsAttached()) {
|
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
|
// 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
|
// 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:
|
// handled when offered the first time, so that's why we try several times:
|
||||||
for (int i = 0; i < 100; i++) {
|
for (int i = 0; i < MAXRETRIES; i++) {
|
||||||
if (PlayTs(Data, Length) > 0)
|
if (PlayTs(Data, Length) > 0) {
|
||||||
|
if (retriesExceeded && timer.TimedOut())
|
||||||
|
retriesExceeded = false;
|
||||||
return;
|
return;
|
||||||
cCondWait::SleepMs(10);
|
|
||||||
}
|
}
|
||||||
|
if (retriesExceeded) // no retries once a packet has not been accepted
|
||||||
|
return;
|
||||||
|
cCondWait::SleepMs(RETRYWAIT);
|
||||||
|
}
|
||||||
|
retriesExceeded = true;
|
||||||
|
timer.Set(RETRYPAUSE); // wait a while before retrying
|
||||||
esyslog("ERROR: TS packet not accepted in Transfer Mode");
|
esyslog("ERROR: TS packet not accepted in Transfer Mode");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: transfer.h 2.2 2010/01/29 16:38:09 kls Exp $
|
* $Id: transfer.h 2.3 2013/01/20 13:12:38 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __TRANSFER_H
|
#ifndef __TRANSFER_H
|
||||||
@ -13,10 +13,13 @@
|
|||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "receiver.h"
|
#include "receiver.h"
|
||||||
#include "remux.h"
|
#include "remux.h"
|
||||||
|
#include "tools.h"
|
||||||
|
|
||||||
class cTransfer : public cReceiver, public cPlayer {
|
class cTransfer : public cReceiver, public cPlayer {
|
||||||
private:
|
private:
|
||||||
cPatPmtGenerator patPmtGenerator;
|
cPatPmtGenerator patPmtGenerator;
|
||||||
|
bool retriesExceeded;
|
||||||
|
cTimeMs timer;
|
||||||
protected:
|
protected:
|
||||||
virtual void Activate(bool On);
|
virtual void Activate(bool On);
|
||||||
virtual void Receive(uchar *Data, int Length);
|
virtual void Receive(uchar *Data, int Length);
|
||||||
|
Loading…
Reference in New Issue
Block a user