mirror of
https://github.com/rofafor/vdr-plugin-iptv.git
synced 2023-10-10 13:37:03 +02:00
RTP protocol fixes.
This commit is contained in:
parent
e55c90b4c8
commit
24833fcf15
10
config.c
10
config.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: config.c,v 1.5 2007/09/26 19:49:35 rahrenbe Exp $
|
* $Id: config.c,v 1.6 2007/09/27 22:30:50 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
@ -12,11 +12,11 @@
|
|||||||
cIptvConfig IptvConfig;
|
cIptvConfig IptvConfig;
|
||||||
|
|
||||||
cIptvConfig::cIptvConfig(void)
|
cIptvConfig::cIptvConfig(void)
|
||||||
: tsBufferSize(8),
|
: tsBufferSize(2),
|
||||||
tsBufferPrefillRatio(0),
|
tsBufferPrefillRatio(0),
|
||||||
udpBufferSize(7),
|
udpBufferSize(20),
|
||||||
rtpBufferSize(7),
|
rtpBufferSize(20),
|
||||||
httpBufferSize(7),
|
httpBufferSize(20),
|
||||||
fileBufferSize(20),
|
fileBufferSize(20),
|
||||||
maxBufferSize(40) // must be bigger than protocol buffer sizes!
|
maxBufferSize(40) // must be bigger than protocol buffer sizes!
|
||||||
{
|
{
|
||||||
|
@ -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: protocolrtp.c,v 1.2 2007/09/26 22:07:45 rahrenbe Exp $
|
* $Id: protocolrtp.c,v 1.3 2007/09/27 22:30:50 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -176,11 +176,17 @@ int cIptvProtocolRtp::Read(unsigned char* *BufferAddr)
|
|||||||
// Read data from socket
|
// Read data from socket
|
||||||
int len = recvfrom(socketDesc, readBuffer, (TS_SIZE * IptvConfig.GetRtpBufferSize()),
|
int len = recvfrom(socketDesc, readBuffer, (TS_SIZE * IptvConfig.GetRtpBufferSize()),
|
||||||
MSG_DONTWAIT, (struct sockaddr *)&sockAddr, &addrlen);
|
MSG_DONTWAIT, (struct sockaddr *)&sockAddr, &addrlen);
|
||||||
if (len > 0) {
|
if (len > 3) {
|
||||||
// http://www.networksorcery.com/enp/rfc/rfc2250.txt
|
// http://www.networksorcery.com/enp/rfc/rfc2250.txt
|
||||||
const int headerlen = 4 * sizeof(uint32_t);
|
unsigned int v = (readBuffer[0] >> 6) & 0x03;
|
||||||
|
unsigned int x = (readBuffer[0] >> 4) & 0x01;
|
||||||
|
unsigned int cc = readBuffer[0] & 0x0F;
|
||||||
|
unsigned int pt = readBuffer[1] & 0x7F;
|
||||||
|
unsigned int headerlen = (3 + cc) * sizeof(uint32_t);
|
||||||
|
if (x)
|
||||||
|
headerlen += ((((readBuffer[headerlen + 2] & 0xFF) << 8) | (readBuffer[headerlen + 3] & 0xFF)) + 1) * sizeof(uint32_t);
|
||||||
// Check if payload type is MPEG2 TS and payload contains multiple of TS packet data
|
// Check if payload type is MPEG2 TS and payload contains multiple of TS packet data
|
||||||
if (((readBuffer[1] & 0x7F) == 33) && (((len - headerlen) % TS_SIZE) == 0)) {
|
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);
|
||||||
|
4
setup.c
4
setup.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: setup.c,v 1.9 2007/09/26 19:49:35 rahrenbe Exp $
|
* $Id: setup.c,v 1.10 2007/09/27 22:30:50 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -483,7 +483,7 @@ void cIptvPluginSetup::Store(void)
|
|||||||
IptvConfig.SetTsBufferSize(tsBufferSize);
|
IptvConfig.SetTsBufferSize(tsBufferSize);
|
||||||
IptvConfig.SetTsBufferPrefillRatio(tsBufferPrefill);
|
IptvConfig.SetTsBufferPrefillRatio(tsBufferPrefill);
|
||||||
IptvConfig.SetUdpBufferSize(udpBufferSize);
|
IptvConfig.SetUdpBufferSize(udpBufferSize);
|
||||||
IptvConfig.SetUdpBufferSize(rtpBufferSize);
|
IptvConfig.SetRtpBufferSize(rtpBufferSize);
|
||||||
IptvConfig.SetHttpBufferSize(httpBufferSize);
|
IptvConfig.SetHttpBufferSize(httpBufferSize);
|
||||||
IptvConfig.SetFileBufferSize(fileBufferSize);
|
IptvConfig.SetFileBufferSize(fileBufferSize);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user