Removed unnecessary TS buffer settings.

This commit is contained in:
Rolf Ahrenberg 2014-04-05 19:01:36 +03:00
parent 688c7db1fc
commit dc9f9f2b86
17 changed files with 14 additions and 197 deletions

View File

@ -251,3 +251,4 @@ VDR Plugin 'iptv' Revision History
2014-04-12: Version 2.1.3
- Updated the section filtering options.
- Removed unnecessary TS buffer settings.

View File

@ -24,6 +24,8 @@
#define ELEMENTS(x) (sizeof(x) / sizeof(x[0]))
#define IPTV_BUFFER_SIZE MEGABYTE(1)
#define IPTV_DVR_FILENAME "/tmp/vdr-iptv%d.dvr"
#define IPTV_SOURCE_CHARACTER 'I'

View File

@ -10,9 +10,7 @@
cIptvConfig IptvConfig;
cIptvConfig::cIptvConfig(void)
: tsBufferSizeM(2),
tsBufferPrefillRatioM(0),
protocolBasePortM(4321),
: protocolBasePortM(4321),
useBytesM(1),
sectionFilteringM(1)
{

View File

@ -14,8 +14,6 @@
class cIptvConfig
{
private:
unsigned int tsBufferSizeM;
unsigned int tsBufferPrefillRatioM;
unsigned int protocolBasePortM;
unsigned int useBytesM;
unsigned int sectionFilteringM;
@ -25,8 +23,6 @@ private:
public:
cIptvConfig();
unsigned int GetTsBufferSize(void) const { return tsBufferSizeM; }
unsigned int GetTsBufferPrefillRatio(void) const { return tsBufferPrefillRatioM; }
unsigned int GetProtocolBasePort(void) const { return protocolBasePortM; }
unsigned int GetUseBytes(void) const { return useBytesM; }
unsigned int GetSectionFiltering(void) const { return sectionFilteringM; }
@ -34,8 +30,6 @@ public:
const char *GetResourceDirectory(void) const { return resourceDirectoryM; }
unsigned int GetDisabledFiltersCount(void) const;
int GetDisabledFilters(unsigned int indexP) const;
void SetTsBufferSize(unsigned int sizeP) { tsBufferSizeM = sizeP; }
void SetTsBufferPrefillRatio(unsigned int ratioP) { tsBufferPrefillRatioM = ratioP; }
void SetProtocolBasePort(unsigned int portNumberP) { protocolBasePortM = portNumberP; }
void SetUseBytes(unsigned int onOffP) { useBytesM = onOffP; }
void SetSectionFiltering(unsigned int onOffP) { sectionFilteringM = onOffP; }

View File

@ -22,7 +22,7 @@ cIptvDevice::cIptvDevice(unsigned int indexP)
pidScanEnabledM(false),
channelM()
{
unsigned int bufsize = (unsigned int)MEGABYTE(IptvConfig.GetTsBufferSize());
unsigned int bufsize = (unsigned int)IPTV_BUFFER_SIZE;
bufsize -= (bufsize % TS_SIZE);
isyslog("creating IPTV device %d (CardIndex=%d)", deviceIndexM, CardIndex());
tsBufferM = new cRingBufferLinear(bufsize + 1, TS_SIZE, false,
@ -32,7 +32,6 @@ cIptvDevice::cIptvDevice(unsigned int indexP)
tsBufferM->SetIoThrottle();
pIptvStreamerM = new cIptvStreamer(*this, tsBufferM->Free());
}
ResetBuffering();
pUdpProtocolM = new cIptvProtocolUdp();
pCurlProtocolM = new cIptvProtocolCurl();
pHttpProtocolM = new cIptvProtocolHttp();
@ -305,7 +304,7 @@ bool cIptvDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP)
bool cIptvDevice::SetPid(cPidHandle *handleP, int typeP, bool onP)
{
debug("cIptvDevice::%s(%d): pid=%d type=%d on=%d", __FUNCTION__, deviceIndexM, handleP->pid, typeP, onP);
debug("cIptvDevice::%s(%d): pid=%d type=%d on=%d", __FUNCTION__, deviceIndexM, handleP ? handleP->pid : -1, typeP, onP);
if (pIptvStreamerM && handleP)
return pIptvStreamerM->SetPid(handleP->pid, typeP, onP);
return true;
@ -337,7 +336,6 @@ bool cIptvDevice::OpenDvr(void)
debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
isPacketDeliveredM = false;
tsBufferM->Clear();
ResetBuffering();
if (pIptvStreamerM)
pIptvStreamerM->Open();
if (sidScanEnabledM && pSidScannerM && IptvConfig.GetSectionFiltering())
@ -363,7 +361,7 @@ void cIptvDevice::CloseDvr(void)
bool cIptvDevice::HasLock(int timeoutMsP) const
{
//debug("cIptvDevice::%s(%d): timeoutMs=%d", __FUNCTION__, deviceIndexM, timeoutMsP);
return (!IsBuffering());
return (pIptvStreamerM && pIptvStreamerM->Active());
}
bool cIptvDevice::HasInternalCam(void)
@ -372,25 +370,6 @@ bool cIptvDevice::HasInternalCam(void)
return false;
}
void cIptvDevice::ResetBuffering(void)
{
debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
// Pad prefill to multiple of TS_SIZE
tsBufferPrefillM = (unsigned int)MEGABYTE(IptvConfig.GetTsBufferSize()) *
IptvConfig.GetTsBufferPrefillRatio() / 100;
tsBufferPrefillM -= (tsBufferPrefillM % TS_SIZE);
}
bool cIptvDevice::IsBuffering(void) const
{
//debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
if (tsBufferPrefillM && tsBufferM && tsBufferM->Available() < tsBufferPrefillM)
return true;
else
tsBufferPrefillM = 0;
return false;
}
void cIptvDevice::WriteData(uchar *bufferP, int lengthP)
{
//debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
@ -420,7 +399,7 @@ unsigned int cIptvDevice::CheckData(void)
uchar *cIptvDevice::GetData(int *availableP)
{
//debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
if (isOpenDvrM && tsBufferM && !IsBuffering()) {
if (isOpenDvrM && tsBufferM) {
int count = 0;
if (isPacketDeliveredM)
SkipData(TS_SIZE);
@ -434,7 +413,7 @@ uchar *cIptvDevice::GetData(int *availableP)
}
}
tsBufferM->Del(count);
error("Skipped %d bytes to sync on TS packet", count);
info("Skipped %d bytes to sync on TS packet", count);
return NULL;
}
isPacketDeliveredM = true;

View File

@ -40,7 +40,6 @@ private:
bool sidScanEnabledM;
bool pidScanEnabledM;
cRingBufferLinear *tsBufferM;
mutable int tsBufferPrefillM;
cChannel channelM;
cIptvProtocolUdp *pUdpProtocolM;
cIptvProtocolCurl *pCurlProtocolM;
@ -69,11 +68,6 @@ private:
cString GetPidsInformation(void);
cString GetFiltersInformation(void);
// for channel parsing & buffering
private:
void ResetBuffering(void);
bool IsBuffering(void) const;
// for channel info
public:
virtual cString DeviceType(void) const;

6
iptv.c
View File

@ -192,11 +192,7 @@ bool cPluginIptv::SetupParse(const char *nameP, const char *valueP)
{
debug("cPluginIptv::%s()", __FUNCTION__);
// Parse your own setup parameters and store their values.
if (!strcasecmp(nameP, "TsBufferSize"))
IptvConfig.SetTsBufferSize(atoi(valueP));
else if (!strcasecmp(nameP, "TsBufferPrefill"))
IptvConfig.SetTsBufferPrefillRatio(atoi(valueP));
else if (!strcasecmp(nameP, "ExtProtocolBasePort"))
if (!strcasecmp(nameP, "ExtProtocolBasePort"))
IptvConfig.SetProtocolBasePort(atoi(valueP));
else if (!strcasecmp(nameP, "SectionFiltering"))
IptvConfig.SetSectionFiltering(atoi(valueP));

View File

@ -53,24 +53,6 @@ msgstr "Bits/Bytes"
msgid "IPTV information not available!"
msgstr "IPTV Informationen nicht verfügbar!"
msgid "TS buffer size [MB]"
msgstr "TS Puffergröße [MB]"
msgid ""
"Define a ringbuffer size for transport streams in megabytes.\n"
"\n"
"Smaller sizes help memory consumption, but are more prone to buffer overflows."
msgstr ""
msgid "TS buffer prefill ratio [%]"
msgstr "TS Puffer-Preload [%]"
msgid ""
"Define a prefill ratio of the ringbuffer for transport streams before data is transferred to VDR.\n"
"\n"
"This is useful if streaming media over a slow or unreliable connection."
msgstr ""
msgid "Protocol base port"
msgstr "Protokoll Basisport"

View File

@ -52,30 +52,6 @@ msgstr "Bitit/tavut"
msgid "IPTV information not available!"
msgstr "IPTV-tietoja ei saatavilla!"
msgid "TS buffer size [MB]"
msgstr "TS-puskurin koko [MB]"
msgid ""
"Define a ringbuffer size for transport streams in megabytes.\n"
"\n"
"Smaller sizes help memory consumption, but are more prone to buffer overflows."
msgstr ""
"Määritä rengaspuskurin koko TS-lähetteelle megatavuina.\n"
"\n"
"Pienempi rengaspuskuri vähentää muistinkulutusta, mutta on virhealttiimpi puskurin ylivuodolle."
msgid "TS buffer prefill ratio [%]"
msgstr "TS-puskurin esitäyttöaste [%]"
msgid ""
"Define a prefill ratio of the ringbuffer for transport streams before data is transferred to VDR.\n"
"\n"
"This is useful if streaming media over a slow or unreliable connection."
msgstr ""
"Määrittele TS-rengaspuskurin esitäyttöaste, jonka jälkeen lähetettä aletaan siirtämään eteenpäin VDR:lle.\n"
"\n"
"Puskurin esitäyttö parantaa suoratoistoa hitailla ja epäluotettavilla yhteyksillä."
msgid "Protocol base port"
msgstr "Protokollan perusportti"

View File

@ -54,30 +54,6 @@ msgstr "Bits/Bytes"
msgid "IPTV information not available!"
msgstr "Information sur IPTV non disponible !"
msgid "TS buffer size [MB]"
msgstr "Taille du buffer TS [MB]"
msgid ""
"Define a ringbuffer size for transport streams in megabytes.\n"
"\n"
"Smaller sizes help memory consumption, but are more prone to buffer overflows."
msgstr ""
"Définit la taille du ringbuffer pour le transport du flux en megabytes.\n"
"\n"
"Une taille plus petite taille aide la consommation de mémoire, mais c'est sujet à plus de débordement de tampon."
msgid "TS buffer prefill ratio [%]"
msgstr "Taux du buffer de pré-remplissage TS [%]"
msgid ""
"Define a prefill ratio of the ringbuffer for transport streams before data is transferred to VDR.\n"
"\n"
"This is useful if streaming media over a slow or unreliable connection."
msgstr ""
"Définit le ratio de pré-remplissage du ringbuffer pour le transport du flux avant transfert dans VDR.\n"
"\n"
"Cette option est utile si le streaming est sur une connexion lente ou peu fiables."
msgid "Protocol base port"
msgstr "Port de base du protocole"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-iptv 2.1.3\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-04-12 04:12+0300\n"
"POT-Creation-Date: 2014-04-12 04:12+0200\n"
"PO-Revision-Date: 2014-04-12 04:12+0200\n"
"Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n"
"Language-Team: Italian <vdr@linuxtv.org>\n"
@ -53,30 +53,6 @@ msgstr "Bits/bytes"
msgid "IPTV information not available!"
msgstr "Informazione IPTV non disponibile!"
msgid "TS buffer size [MB]"
msgstr "Dimensione buffer TS [MB]"
msgid ""
"Define a ringbuffer size for transport streams in megabytes.\n"
"\n"
"Smaller sizes help memory consumption, but are more prone to buffer overflows."
msgstr ""
"Definisci una dimensione del buffer in MB per i flussi di trasporto.\n"
"\n"
"Dimensioni più piccole aiutano il consumo di memoria, ma sono più inclini a generare buffer overflows."
msgid "TS buffer prefill ratio [%]"
msgstr "Riempimento buffer TS [%]"
msgid ""
"Define a prefill ratio of the ringbuffer for transport streams before data is transferred to VDR.\n"
"\n"
"This is useful if streaming media over a slow or unreliable connection."
msgstr ""
"Definisci un rapporto di riempimento del buffer per i flussi di trasporto prima che i dati siano trasferiti a VDR.\n"
"\n"
"Questo è utile se si trasmette dati su una connessione lenta oppure inaffidabile."
msgid "Protocol base port"
msgstr "Porta base protocollo"

View File

@ -53,30 +53,6 @@ msgstr "Bits/Bytes"
msgid "IPTV information not available!"
msgstr "IPTV informatie niet beschikbaar!"
msgid "TS buffer size [MB]"
msgstr "TS buffergrootte [MB]"
msgid ""
"Define a ringbuffer size for transport streams in megabytes.\n"
"\n"
"Smaller sizes help memory consumption, but are more prone to buffer overflows."
msgstr ""
"Stel de grootte van de ringbuffer vast voor transportstreams in megabytes.\n"
"\n"
"Bij lage waarden zapt VDR sneller maar kunnen leiden tot bufferoverschreidingen en dus dropouts."
msgid "TS buffer prefill ratio [%]"
msgstr "TS buffer-preload [%]"
msgid ""
"Define a prefill ratio of the ringbuffer for transport streams before data is transferred to VDR.\n"
"\n"
"This is useful if streaming media over a slow or unreliable connection."
msgstr ""
"Stel een 'prefil ratio' in voor de ringbuffer voor transportstreams voor de data naar VDR wordt verstuurd.\n"
"\n"
"Dit is aan te bevelen bij onbetrouwbare of langzame verbindingen."
msgid "Protocol base port"
msgstr "Protocol basispoort"

View File

@ -54,24 +54,6 @@ msgstr "Биты / байт"
msgid "IPTV information not available!"
msgstr "IPTV информация отсутствует!"
msgid "TS buffer size [MB]"
msgstr "Размер TS буфера [MB]"
msgid ""
"Define a ringbuffer size for transport streams in megabytes.\n"
"\n"
"Smaller sizes help memory consumption, but are more prone to buffer overflows."
msgstr ""
msgid "TS buffer prefill ratio [%]"
msgstr "Предварительный буфер TS [%]"
msgid ""
"Define a prefill ratio of the ringbuffer for transport streams before data is transferred to VDR.\n"
"\n"
"This is useful if streaming media over a slow or unreliable connection."
msgstr ""
msgid "Protocol base port"
msgstr "Базисный порт протокола"

View File

@ -31,8 +31,7 @@ cIptvProtocolCurl::cIptvProtocolCurl()
handleM(NULL),
multiM(NULL),
headerListM(NULL),
ringBufferM(new cRingBufferLinear(MEGABYTE(IptvConfig.GetTsBufferSize()),
7 * TS_SIZE, false, "IPTV CURL")),
ringBufferM(new cRingBufferLinear(IPTV_BUFFER_SIZE, 7 * TS_SIZE, false, "IPTV CURL")),
rtspControlM(""),
modeM(eModeUnknown),
timeoutM(),
@ -522,7 +521,7 @@ int cIptvProtocolCurl::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
// Use 20% threshold before continuing to filling up the buffer.
mutexM.Lock();
if (pausedM && (ringBufferM->Available() < (MEGABYTE(IptvConfig.GetTsBufferSize()) / 5))) {
if (pausedM && (ringBufferM->Available() < (IPTV_BUFFER_SIZE / 5))) {
debug("cIptvProtocolCurl::%s(continue): free=%d available=%d", __FUNCTION__,
ringBufferM->Free(), ringBufferM->Available());
pausedM = false;

12
setup.c
View File

@ -113,8 +113,6 @@ eOSState cIptvMenuInfo::ProcessKey(eKeys keyP)
cIptvPluginSetup::cIptvPluginSetup()
{
debug("cIptvPluginSetup::%s()", __FUNCTION__);
tsBufferSizeM = IptvConfig.GetTsBufferSize();
tsBufferPrefillM = IptvConfig.GetTsBufferPrefillRatio();
protocolBasePortM = IptvConfig.GetProtocolBasePort();
sectionFilteringM = IptvConfig.GetSectionFiltering();
numDisabledFiltersM = IptvConfig.GetDisabledFiltersCount();
@ -136,12 +134,6 @@ void cIptvPluginSetup::Setup(void)
Clear();
helpM.Clear();
Add(new cMenuEditIntItem(tr("TS buffer size [MB]"), &tsBufferSizeM, 1, 4));
helpM.Append(tr("Define a ringbuffer size for transport streams in megabytes.\n\nSmaller sizes help memory consumption, but are more prone to buffer overflows."));
Add(new cMenuEditIntItem(tr("TS buffer prefill ratio [%]"), &tsBufferPrefillM, 0, 40));
helpM.Append(tr("Define a prefill ratio of the ringbuffer for transport streams before data is transferred to VDR.\n\nThis is useful if streaming media over a slow or unreliable connection."));
Add(new cMenuEditIntItem(tr("Protocol base port"), &protocolBasePortM, 0, 0xFFFF - MAXDEVICES * 2));
helpM.Append(tr("Define a base port used by CURL/EXT protocol.\n\nThe port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the CURL/EXT protocol."));
@ -217,14 +209,10 @@ void cIptvPluginSetup::StoreFilters(const char *nameP, int *valuesP)
void cIptvPluginSetup::Store(void)
{
// Store values into setup.conf
SetupStore("TsBufferSize", tsBufferSizeM);
SetupStore("TsBufferPrefill", tsBufferPrefillM);
SetupStore("ExtProtocolBasePort", protocolBasePortM);
SetupStore("SectionFiltering", sectionFilteringM);
StoreFilters("DisabledFilters", disabledFilterIndexesM);
// Update global config
IptvConfig.SetTsBufferSize(tsBufferSizeM);
IptvConfig.SetTsBufferPrefillRatio(tsBufferPrefillM);
IptvConfig.SetProtocolBasePort(protocolBasePortM);
IptvConfig.SetSectionFiltering(sectionFilteringM);
for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i)

View File

@ -15,8 +15,6 @@
class cIptvPluginSetup : public cMenuSetupPage
{
private:
int tsBufferSizeM;
int tsBufferPrefillM;
int protocolBasePortM;
int sectionFilteringM;
int numDisabledFiltersM;

View File

@ -192,7 +192,7 @@ cString cIptvBufferStatistics::GetBufferStatistic()
uint64_t elapsed = timerM.Elapsed(); /* in milliseconds */
timerM.Set();
long bitrate = elapsed ? (long)(1000.0L * dataBytesM / KILOBYTE(1) / elapsed) : 0L;
long totalSpace = MEGABYTE(IptvConfig.GetTsBufferSize());
long totalSpace = IPTV_BUFFER_SIZE;
float percentage = (float)((float)usedSpaceM / (float)totalSpace * 100.0);
long totalKilos = totalSpace / KILOBYTE(1);
long usedKilos = usedSpaceM / KILOBYTE(1);