1
0
mirror of https://github.com/rofafor/vdr-plugin-iptv.git synced 2023-10-10 13:37:03 +02:00

Prevent busylooping in GetTSPacket() and modified RTP to accect any TS stream.

This commit is contained in:
Rolf Ahrenberg 2007-10-26 22:07:10 +00:00
parent 13fa932a5a
commit f07e3bf485
3 changed files with 12 additions and 7 deletions

View File

@ -15,3 +15,5 @@ VDR Plugin 'iptv' Revision History
2007-xx-xx: Version 0.0.3
- Fixed shutdown crash.
- Added some minor tweaks.
- RTP payload now restricted to TS only.

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: device.c,v 1.74 2007/10/22 19:32:19 ajhseppa Exp $
* $Id: device.c,v 1.75 2007/10/26 22:07:10 rahrenbe Exp $
*/
#include "config.h"
@ -384,7 +384,11 @@ bool cIptvDevice::GetTSPacket(uchar *&Data)
}
return true;
}
else
cCondWait::SleepMs(100); // to reduce cpu load
}
else
cCondWait::SleepMs(100); // and avoid busy loop
Data = NULL;
return true;
}

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: socket.c,v 1.5 2007/10/21 19:46:03 rahrenbe Exp $
* $Id: socket.c,v 1.6 2007/10/26 22:07:10 rahrenbe Exp $
*/
#include <sys/types.h>
@ -142,8 +142,8 @@ int cIptvUdpSocket::Read(unsigned char* *BufferAddr)
unsigned int x = (readBuffer[0] >> 4) & 0x01;
// cscr count
unsigned int cc = readBuffer[0] & 0x0F;
// payload type
unsigned int pt = readBuffer[1] & 0x7F;
// payload type: MPEG2 TS = 33
//unsigned int pt = readBuffer[1] & 0x7F;
// header lenght
unsigned int headerlen = (3 + cc) * sizeof(uint32_t);
// check if extension
@ -153,9 +153,8 @@ int cIptvUdpSocket::Read(unsigned char* *BufferAddr)
// update header length
headerlen += (ehl + 1) * sizeof(uint32_t);
}
// Check that rtp is version 2, payload type is MPEG2 TS
// and payload contains multiple of TS packet data
if ((v == 2) && (pt == 33) && (((len - headerlen) % TS_SIZE) == 0)) {
// Check that rtp is version 2 and payload contains multiple of TS packet data
if ((v == 2) && (((len - headerlen) % TS_SIZE) == 0) && (readBuffer[headerlen] == 0x47)) {
// Set argument point to payload in read buffer
*BufferAddr = &readBuffer[headerlen];
return (len - headerlen);