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:
parent
13fa932a5a
commit
f07e3bf485
2
HISTORY
2
HISTORY
@ -15,3 +15,5 @@ VDR Plugin 'iptv' Revision History
|
|||||||
2007-xx-xx: Version 0.0.3
|
2007-xx-xx: Version 0.0.3
|
||||||
|
|
||||||
- Fixed shutdown crash.
|
- Fixed shutdown crash.
|
||||||
|
- Added some minor tweaks.
|
||||||
|
- RTP payload now restricted to TS only.
|
||||||
|
6
device.c
6
device.c
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* 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"
|
#include "config.h"
|
||||||
@ -384,7 +384,11 @@ bool cIptvDevice::GetTSPacket(uchar *&Data)
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
cCondWait::SleepMs(100); // to reduce cpu load
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
cCondWait::SleepMs(100); // and avoid busy loop
|
||||||
Data = NULL;
|
Data = NULL;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
11
socket.c
11
socket.c
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* 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>
|
#include <sys/types.h>
|
||||||
@ -142,8 +142,8 @@ int cIptvUdpSocket::Read(unsigned char* *BufferAddr)
|
|||||||
unsigned int x = (readBuffer[0] >> 4) & 0x01;
|
unsigned int x = (readBuffer[0] >> 4) & 0x01;
|
||||||
// cscr count
|
// cscr count
|
||||||
unsigned int cc = readBuffer[0] & 0x0F;
|
unsigned int cc = readBuffer[0] & 0x0F;
|
||||||
// payload type
|
// payload type: MPEG2 TS = 33
|
||||||
unsigned int pt = readBuffer[1] & 0x7F;
|
//unsigned int pt = readBuffer[1] & 0x7F;
|
||||||
// header lenght
|
// header lenght
|
||||||
unsigned int headerlen = (3 + cc) * sizeof(uint32_t);
|
unsigned int headerlen = (3 + cc) * sizeof(uint32_t);
|
||||||
// check if extension
|
// check if extension
|
||||||
@ -153,9 +153,8 @@ int cIptvUdpSocket::Read(unsigned char* *BufferAddr)
|
|||||||
// update header length
|
// update header length
|
||||||
headerlen += (ehl + 1) * sizeof(uint32_t);
|
headerlen += (ehl + 1) * sizeof(uint32_t);
|
||||||
}
|
}
|
||||||
// Check that rtp is version 2, payload type is MPEG2 TS
|
// Check that rtp is version 2 and payload contains multiple of TS packet data
|
||||||
// and payload contains multiple of TS packet data
|
if ((v == 2) && (((len - headerlen) % TS_SIZE) == 0) && (readBuffer[headerlen] == 0x47)) {
|
||||||
if ((v == 2) && (pt == 33) && (((len - headerlen) % TS_SIZE) == 0)) {
|
|
||||||
// Set argument point to payload in read buffer
|
// Set argument point to payload in read buffer
|
||||||
*BufferAddr = &readBuffer[headerlen];
|
*BufferAddr = &readBuffer[headerlen];
|
||||||
return (len - headerlen);
|
return (len - headerlen);
|
||||||
|
Loading…
Reference in New Issue
Block a user