mirror of
https://github.com/rofafor/vdr-plugin-iptv.git
synced 2023-10-10 13:37:03 +02:00
Changed a pointer to a reference in order to stabilize the CURL protocol and always remember to close the sid scanner.
This commit is contained in:
parent
d84fd79d14
commit
72a9f21006
2
device.c
2
device.c
@ -392,7 +392,7 @@ bool cIptvDevice::OpenDvr(void)
|
|||||||
void cIptvDevice::CloseDvr(void)
|
void cIptvDevice::CloseDvr(void)
|
||||||
{
|
{
|
||||||
debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
|
debug("cIptvDevice::%s(%d)", __FUNCTION__, deviceIndexM);
|
||||||
if (sidScanEnabledM && pSidScannerM && IptvConfig.GetSectionFiltering())
|
if (sidScanEnabledM && pSidScannerM )
|
||||||
pSidScannerM->Close();
|
pSidScannerM->Close();
|
||||||
if (pIptvStreamerM)
|
if (pIptvStreamerM)
|
||||||
pIptvStreamerM->Close();
|
pIptvStreamerM->Close();
|
||||||
|
@ -26,8 +26,8 @@ cIptvProtocolCurl::cIptvProtocolCurl()
|
|||||||
handleM(NULL),
|
handleM(NULL),
|
||||||
multiM(NULL),
|
multiM(NULL),
|
||||||
headerListM(NULL),
|
headerListM(NULL),
|
||||||
ringBufferM(new cRingBufferLinear(MEGABYTE(IptvConfig.GetTsBufferSize()), 7 * TS_SIZE,
|
ringBufferM(new cRingBufferLinear(MEGABYTE(IptvConfig.GetTsBufferSize()),
|
||||||
false, *cString::sprintf("IPTV CURL"))),
|
7 * TS_SIZE, false, "IPTV CURL")),
|
||||||
rtspControlM(),
|
rtspControlM(),
|
||||||
modeM(eModeUnknown),
|
modeM(eModeUnknown),
|
||||||
connectedM(false),
|
connectedM(false),
|
||||||
@ -190,12 +190,12 @@ void cIptvProtocolCurl::ClearData()
|
|||||||
ringBufferM->Clear();
|
ringBufferM->Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char *cIptvProtocolCurl::GetData(unsigned int *lenP)
|
unsigned char *cIptvProtocolCurl::GetData(int &lenP)
|
||||||
{
|
{
|
||||||
cMutexLock MutexLock(&mutexM);
|
cMutexLock MutexLock(&mutexM);
|
||||||
//debug("cIptvProtocolCurl::%s()", __FUNCTION__);
|
//debug("cIptvProtocolCurl::%s()", __FUNCTION__);
|
||||||
unsigned char *p = NULL;
|
unsigned char *p = NULL;
|
||||||
*lenP = 0;
|
lenP = 0;
|
||||||
if (ringBufferM) {
|
if (ringBufferM) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
p = ringBufferM->Get(count);
|
p = ringBufferM->Get(count);
|
||||||
@ -210,13 +210,13 @@ unsigned char *cIptvProtocolCurl::GetData(unsigned int *lenP)
|
|||||||
}
|
}
|
||||||
error("IPTV skipped %d bytes to sync on TS packet\n", count);
|
error("IPTV skipped %d bytes to sync on TS packet\n", count);
|
||||||
ringBufferM->Del(count);
|
ringBufferM->Del(count);
|
||||||
*lenP = 0;
|
lenP = 0;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
count -= (count % TS_SIZE);
|
count -= (count % TS_SIZE);
|
||||||
*lenP = count;
|
lenP = count;
|
||||||
}
|
}
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
@ -473,11 +473,11 @@ int cIptvProtocolCurl::Read(unsigned char* bufferAddrP, unsigned int bufferLenP)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ... and try to empty it
|
// ... and try to empty it
|
||||||
unsigned char *p = GetData(&bufferLenP);
|
unsigned char *p = GetData(len);
|
||||||
if (p && (bufferLenP > 0)) {
|
if (p && (len > 0)) {
|
||||||
memcpy(bufferAddrP, p, bufferLenP);
|
len = min(len, (int)bufferLenP);
|
||||||
DelData(bufferLenP);
|
memcpy(bufferAddrP, p, len);
|
||||||
len = bufferLenP;
|
DelData(len);
|
||||||
//debug("cIptvProtocolCurl::%s(): get %d bytes", __FUNCTION__, len);
|
//debug("cIptvProtocolCurl::%s(): get %d bytes", __FUNCTION__, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ private:
|
|||||||
bool PutData(unsigned char *dataP, int lenP);
|
bool PutData(unsigned char *dataP, int lenP);
|
||||||
void DelData(int lenP);
|
void DelData(int lenP);
|
||||||
void ClearData(void);
|
void ClearData(void);
|
||||||
unsigned char *GetData(unsigned int *lenP);
|
unsigned char *GetData(int &lenP);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cIptvProtocolCurl();
|
cIptvProtocolCurl();
|
||||||
|
@ -26,8 +26,8 @@ public:
|
|||||||
cSidScanner(void);
|
cSidScanner(void);
|
||||||
~cSidScanner();
|
~cSidScanner();
|
||||||
void SetChannel(const tChannelID &channelIdP);
|
void SetChannel(const tChannelID &channelIdP);
|
||||||
void Open() { isActiveM = true; }
|
void Open() { debug("cSidScanner::%s()", __FUNCTION__); isActiveM = true; }
|
||||||
void Close() { isActiveM = false; }
|
void Close() { debug("cSidScanner::%s()", __FUNCTION__); isActiveM = false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __SIDSCANNER_H
|
#endif // __SIDSCANNER_H
|
||||||
|
@ -46,8 +46,9 @@ void cIptvStreamer::Action(void)
|
|||||||
// Do the thread loop
|
// Do the thread loop
|
||||||
while (packetBufferM && Running()) {
|
while (packetBufferM && Running()) {
|
||||||
int length = -1;
|
int length = -1;
|
||||||
if (protocolM)
|
unsigned int size = min((unsigned int)ringBufferM->Free(), packetBufferLenM);
|
||||||
length = protocolM->Read(packetBufferM, min((unsigned int)ringBufferM->Free(), packetBufferLenM));
|
if (protocolM && (size > 0))
|
||||||
|
length = protocolM->Read(packetBufferM, size);
|
||||||
if (length > 0) {
|
if (length > 0) {
|
||||||
AddStreamerStatistic(length);
|
AddStreamerStatistic(length);
|
||||||
if (ringBufferM) {
|
if (ringBufferM) {
|
||||||
|
Loading…
Reference in New Issue
Block a user