mirror of
https://github.com/rofafor/vdr-plugin-satip.git
synced 2023-10-10 13:37:42 +02:00
Fix RTCP over TCP.
This commit is contained in:
parent
5254bb7ca2
commit
8130a4b4e5
28
rtcp.c
28
rtcp.c
@ -34,7 +34,7 @@ int cSatipRtcp::GetFd(void)
|
|||||||
return Fd();
|
return Fd();
|
||||||
}
|
}
|
||||||
|
|
||||||
int cSatipRtcp::GetApplicationOffset(int *lengthP)
|
int cSatipRtcp::GetApplicationOffset(unsigned char *bufferP, int *lengthP)
|
||||||
{
|
{
|
||||||
debug16("%s (%d) [device %d]", __PRETTY_FUNCTION__, lengthP ? *lengthP : -1, tunerM.GetId());
|
debug16("%s (%d) [device %d]", __PRETTY_FUNCTION__, lengthP ? *lengthP : -1, tunerM.GetId());
|
||||||
if (!lengthP)
|
if (!lengthP)
|
||||||
@ -43,29 +43,29 @@ int cSatipRtcp::GetApplicationOffset(int *lengthP)
|
|||||||
int total = *lengthP;
|
int total = *lengthP;
|
||||||
while (total > 0) {
|
while (total > 0) {
|
||||||
// Version
|
// Version
|
||||||
unsigned int v = (bufferM[offset] >> 6) & 0x03;
|
unsigned int v = (bufferP[offset] >> 6) & 0x03;
|
||||||
// Padding
|
// Padding
|
||||||
//unsigned int p = (bufferM[offset] >> 5) & 0x01;
|
//unsigned int p = (bufferP[offset] >> 5) & 0x01;
|
||||||
// Subtype
|
// Subtype
|
||||||
//unsigned int st = bufferM[offset] & 0x1F;
|
//unsigned int st = bufferP[offset] & 0x1F;
|
||||||
// Payload type
|
// Payload type
|
||||||
unsigned int pt = bufferM[offset + 1] & 0xFF;
|
unsigned int pt = bufferP[offset + 1] & 0xFF;
|
||||||
// Length
|
// Length
|
||||||
unsigned int length = ((bufferM[offset + 2] & 0xFF) << 8) | (bufferM[offset + 3] & 0xFF);
|
unsigned int length = ((bufferP[offset + 2] & 0xFF) << 8) | (bufferP[offset + 3] & 0xFF);
|
||||||
// Convert it to bytes
|
// Convert it to bytes
|
||||||
length = (length + 1) * 4;
|
length = (length + 1) * 4;
|
||||||
// V=2, APP = 204
|
// V=2, APP = 204
|
||||||
if ((v == 2) && (pt == 204)) {
|
if ((v == 2) && (pt == 204)) {
|
||||||
// SSCR/CSCR
|
// SSCR/CSCR
|
||||||
//unsigned int ssrc = ((bufferM[offset + 4] & 0xFF) << 24) | ((bufferM[offset + 5] & 0xFF) << 16) |
|
//unsigned int ssrc = ((bufferP[offset + 4] & 0xFF) << 24) | ((bufferP[offset + 5] & 0xFF) << 16) |
|
||||||
// ((bufferM[offset + 6] & 0xFF) << 8) | (bufferM[offset + 7] & 0xFF);
|
// ((bufferP[offset + 6] & 0xFF) << 8) | (bufferP[offset + 7] & 0xFF);
|
||||||
// Name
|
// Name
|
||||||
if ((bufferM[offset + 8] == 'S') && (bufferM[offset + 9] == 'E') &&
|
if ((bufferP[offset + 8] == 'S') && (bufferP[offset + 9] == 'E') &&
|
||||||
(bufferM[offset + 10] == 'S') && (bufferM[offset + 11] == '1')) {
|
(bufferP[offset + 10] == 'S') && (bufferP[offset + 11] == '1')) {
|
||||||
// Identifier
|
// Identifier
|
||||||
//unsigned int id = ((bufferM[offset + 12] & 0xFF) << 8) | (bufferM[offset + 13] & 0xFF);
|
//unsigned int id = ((bufferP[offset + 12] & 0xFF) << 8) | (bufferP[offset + 13] & 0xFF);
|
||||||
// String length
|
// String length
|
||||||
int string_length = ((bufferM[offset + 14] & 0xFF) << 8) | (bufferM[offset + 15] & 0xFF);
|
int string_length = ((bufferP[offset + 14] & 0xFF) << 8) | (bufferP[offset + 15] & 0xFF);
|
||||||
if (string_length > 0) {
|
if (string_length > 0) {
|
||||||
*lengthP = string_length;
|
*lengthP = string_length;
|
||||||
return (offset + 16);
|
return (offset + 16);
|
||||||
@ -85,7 +85,7 @@ void cSatipRtcp::Process(void)
|
|||||||
if (bufferM) {
|
if (bufferM) {
|
||||||
int length;
|
int length;
|
||||||
while ((length = Read(bufferM, bufferLenM)) > 0) {
|
while ((length = Read(bufferM, bufferLenM)) > 0) {
|
||||||
int offset = GetApplicationOffset(&length);
|
int offset = GetApplicationOffset(bufferM, &length);
|
||||||
if (offset >= 0)
|
if (offset >= 0)
|
||||||
tunerM.ProcessApplicationData(bufferM + offset, length);
|
tunerM.ProcessApplicationData(bufferM + offset, length);
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ void cSatipRtcp::Process(unsigned char *dataP, int lengthP)
|
|||||||
{
|
{
|
||||||
debug16("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
debug16("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||||
if (dataP && lengthP > 0) {
|
if (dataP && lengthP > 0) {
|
||||||
int offset = GetApplicationOffset(&lengthP);
|
int offset = GetApplicationOffset(dataP, &lengthP);
|
||||||
if (offset >= 0)
|
if (offset >= 0)
|
||||||
tunerM.ProcessApplicationData(dataP + offset, lengthP);
|
tunerM.ProcessApplicationData(dataP + offset, lengthP);
|
||||||
}
|
}
|
||||||
|
2
rtcp.h
2
rtcp.h
@ -20,7 +20,7 @@ private:
|
|||||||
cSatipTunerIf &tunerM;
|
cSatipTunerIf &tunerM;
|
||||||
unsigned int bufferLenM;
|
unsigned int bufferLenM;
|
||||||
unsigned char *bufferM;
|
unsigned char *bufferM;
|
||||||
int GetApplicationOffset(int *lengthP);
|
int GetApplicationOffset(unsigned char *bufferP, int *lengthP);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit cSatipRtcp(cSatipTunerIf &tunerP);
|
explicit cSatipRtcp(cSatipTunerIf &tunerP);
|
||||||
|
Loading…
Reference in New Issue
Block a user