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

Cleaned up debug messages.

This commit is contained in:
Rolf Ahrenberg 2014-11-21 23:56:03 +02:00
parent 524b21e042
commit ade52d5a22
4 changed files with 28 additions and 25 deletions

7
rtcp.c
View File

@ -13,6 +13,7 @@ cSatipRtcp::cSatipRtcp(cSatipTunerIf &tunerP, unsigned int bufferLenP)
bufferLenM(bufferLenP), bufferLenM(bufferLenP),
bufferM(MALLOC(unsigned char, bufferLenM)) bufferM(MALLOC(unsigned char, bufferLenM))
{ {
debug("cSatipRtcp::%s(%u) [device %d]", __FUNCTION__, bufferLenP, tunerM.GetId());
if (bufferM) if (bufferM)
memset(bufferM, 0, bufferLenM); memset(bufferM, 0, bufferLenM);
else else
@ -21,17 +22,19 @@ cSatipRtcp::cSatipRtcp(cSatipTunerIf &tunerP, unsigned int bufferLenP)
cSatipRtcp::~cSatipRtcp() cSatipRtcp::~cSatipRtcp()
{ {
debug("cSatipRtcp::%s() [device %d]", __FUNCTION__, tunerM.GetId());
DELETE_POINTER(bufferM); DELETE_POINTER(bufferM);
} }
int cSatipRtcp::GetFd(void) int cSatipRtcp::GetFd(void)
{ {
//debug("cSatipRtcp::%s() [device %d]", __FUNCTION__, tunerM.GetId());
return Fd(); return Fd();
} }
int cSatipRtcp::GetApplicationOffset(int *lengthP) int cSatipRtcp::GetApplicationOffset(int *lengthP)
{ {
//debug("cSatipRtcp::%s()", __FUNCTION__); //debug("cSatipRtcp::%s() [device %d]", __FUNCTION__, tunerM.GetId());
if (!lengthP) if (!lengthP)
return -1; return -1;
int offset = 0; int offset = 0;
@ -76,7 +79,7 @@ int cSatipRtcp::GetApplicationOffset(int *lengthP)
void cSatipRtcp::Process(int fdP) void cSatipRtcp::Process(int fdP)
{ {
//debug("cSatipRtcp::%s(%d)", __FUNCTION__, fdP); //debug("cSatipRtcp::%s(%d) [device %d]", __FUNCTION__, fdP, tunerM.GetId());
if (bufferM) { if (bufferM) {
int length = Read(bufferM, bufferLenM); int length = Read(bufferM, bufferLenM);
if (length > 0) { if (length > 0) {

12
rtp.c
View File

@ -16,6 +16,7 @@ cSatipRtp::cSatipRtp(cSatipTunerIf &tunerP, unsigned int bufferLenP)
packetErrorsM(0), packetErrorsM(0),
sequenceNumberM(-1) sequenceNumberM(-1)
{ {
debug("cSatipRtp::%s(%u) [device %d]", __FUNCTION__, bufferLenP, tunerM.GetId());
if (bufferM) if (bufferM)
memset(bufferM, 0, bufferLenM); memset(bufferM, 0, bufferLenM);
else else
@ -24,6 +25,7 @@ cSatipRtp::cSatipRtp(cSatipTunerIf &tunerP, unsigned int bufferLenP)
cSatipRtp::~cSatipRtp() cSatipRtp::~cSatipRtp()
{ {
debug("cSatipRtp::%s() [device %d]", __FUNCTION__, tunerM.GetId());
DELETE_POINTER(bufferM); DELETE_POINTER(bufferM);
} }
@ -34,7 +36,7 @@ int cSatipRtp::GetFd(void)
void cSatipRtp::Close(void) void cSatipRtp::Close(void)
{ {
debug("cSatipRtp::%s(%d)", __FUNCTION__, GetFd()); debug("cSatipRtp::%s() [device %d]", __FUNCTION__, tunerM.GetId());
cSatipSocket::Close(); cSatipSocket::Close();
@ -48,7 +50,7 @@ void cSatipRtp::Close(void)
int cSatipRtp::GetHeaderLenght(int lengthP) int cSatipRtp::GetHeaderLenght(int lengthP)
{ {
//debug("cSatipRtp::%s()", __FUNCTION__); //debug("cSatipRtp::%s() [device %d]", __FUNCTION__, tunerM.GetId());
unsigned int headerlen = 0; unsigned int headerlen = 0;
if (lengthP > 0) { if (lengthP > 0) {
@ -72,7 +74,7 @@ int cSatipRtp::GetHeaderLenght(int lengthP)
else if ((sequenceNumberM >= 0) && (((sequenceNumberM + 1) % 0xFFFF) != seq)) { else if ((sequenceNumberM >= 0) && (((sequenceNumberM + 1) % 0xFFFF) != seq)) {
packetErrorsM++; packetErrorsM++;
if (time(NULL) - lastErrorReportM > eReportIntervalS) { if (time(NULL) - lastErrorReportM > eReportIntervalS) {
info("Detected %d RTP packet errors", packetErrorsM); info("Detected %d RTP packet errors [device %d]", packetErrorsM, tunerM.GetId());
packetErrorsM = 0; packetErrorsM = 0;
lastErrorReportM = time(NULL); lastErrorReportM = time(NULL);
} }
@ -91,7 +93,7 @@ int cSatipRtp::GetHeaderLenght(int lengthP)
} }
// Check that rtp is version 2 and payload contains multiple of TS packet data // Check that rtp is version 2 and payload contains multiple of TS packet data
if ((v != 2) || (((lengthP - headerlen) % TS_SIZE) != 0) || (bufferM[headerlen] != TS_SYNC_BYTE)) { if ((v != 2) || (((lengthP - headerlen) % TS_SIZE) != 0) || (bufferM[headerlen] != TS_SYNC_BYTE)) {
debug("cSatipRtp::%s(%d): Received incorrect RTP packet", __FUNCTION__, lengthP); debug("cSatipRtp::%s(%d): Received incorrect RTP packet [device %d]", __FUNCTION__, lengthP, tunerM.GetId());
headerlen = -1; headerlen = -1;
} }
} }
@ -102,7 +104,7 @@ int cSatipRtp::GetHeaderLenght(int lengthP)
void cSatipRtp::Process(int fdP) void cSatipRtp::Process(int fdP)
{ {
//debug("cSatipRtp::%s(%d)", __FUNCTION__, fdP); //debug("cSatipRtp::%s() [device %d]", __FUNCTION__, tunerM.GetId());
if (bufferM) { if (bufferM) {
int length = Read(bufferM, min(tunerM.GetVideoDataSize(), bufferLenM)); int length = Read(bufferM, min(tunerM.GetVideoDataSize(), bufferLenM));
if (length > 0) { if (length > 0) {

33
rtsp.c
View File

@ -10,7 +10,6 @@
cSatipRtsp::cSatipRtsp(cSatipTunerIf &tunerP) cSatipRtsp::cSatipRtsp(cSatipTunerIf &tunerP)
: tunerM(tunerP), : tunerM(tunerP),
tunerIdM(tunerP.GetId()),
handleM(curl_easy_init()), handleM(curl_easy_init()),
headerListM(NULL) headerListM(NULL)
{ {
@ -33,7 +32,7 @@ cSatipRtsp::cSatipRtsp(cSatipTunerIf &tunerP)
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_CONNECTTIMEOUT_MS, (long)eConnectTimeoutMs); SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_CONNECTTIMEOUT_MS, (long)eConnectTimeoutMs);
// Set user-agent // Set user-agent
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_USERAGENT, *cString::sprintf("vdr-%s/%s (device %d)", PLUGIN_NAME_I18N, VERSION, tunerIdM)); SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_USERAGENT, *cString::sprintf("vdr-%s/%s (device %d)", PLUGIN_NAME_I18N, VERSION, tunerM.GetId()));
} }
} }
@ -101,19 +100,19 @@ int cSatipRtsp::DebugCallback(CURL *handleP, curl_infotype typeP, char *dataP, s
if (obj) { if (obj) {
switch (typeP) { switch (typeP) {
case CURLINFO_TEXT: case CURLINFO_TEXT:
debug("cSatipTuner::%s(%d): RTSP INFO %.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); debug("cSatipRtsp::%s(%d): RTSP INFO %.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP);
break; break;
case CURLINFO_HEADER_IN: case CURLINFO_HEADER_IN:
debug("cSatipTuner::%s(%d): RTSP HEAD <<< %.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); debug("cSatipRtsp::%s(%d): RTSP HEAD <<< %.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP);
break; break;
case CURLINFO_HEADER_OUT: case CURLINFO_HEADER_OUT:
debug("cSatipTuner::%s(%d): RTSP HEAD >>>\n%.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); debug("cSatipRtsp::%s(%d): RTSP HEAD >>>\n%.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP);
break; break;
case CURLINFO_DATA_IN: case CURLINFO_DATA_IN:
debug("cSatipTuner::%s(%d): RTSP DATA <<< %.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); debug("cSatipRtsp::%s(%d): RTSP DATA <<< %.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP);
break; break;
case CURLINFO_DATA_OUT: case CURLINFO_DATA_OUT:
debug("cSatipTuner::%s(%d): RTSP DATA >>>\n%.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP); debug("cSatipRtsp::%s(%d): RTSP DATA >>>\n%.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP);
break; break;
default: default:
break; break;
@ -125,7 +124,7 @@ int cSatipRtsp::DebugCallback(CURL *handleP, curl_infotype typeP, char *dataP, s
cString cSatipRtsp::RtspUnescapeString(const char *strP) cString cSatipRtsp::RtspUnescapeString(const char *strP)
{ {
debug("cSatipRtsp::%s(%d): str=%s", __FUNCTION__, tunerIdM, strP); debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, strP, tunerM.GetId());
if (handleM) { if (handleM) {
char *p = curl_easy_unescape(handleM, strP, 0, NULL); char *p = curl_easy_unescape(handleM, strP, 0, NULL);
cString s = p; cString s = p;
@ -139,7 +138,7 @@ cString cSatipRtsp::RtspUnescapeString(const char *strP)
bool cSatipRtsp::Options(const char *uriP) bool cSatipRtsp::Options(const char *uriP)
{ {
debug("cSatipRtsp::%s(%d): uri=%s", __FUNCTION__, tunerIdM, uriP); debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, uriP, tunerM.GetId());
if (handleM && !isempty(uriP)) { if (handleM && !isempty(uriP)) {
CURLcode res = CURLE_OK; CURLcode res = CURLE_OK;
@ -157,7 +156,7 @@ bool cSatipRtsp::Options(const char *uriP)
bool cSatipRtsp::Setup(const char *uriP, int rtpPortP, int rtcpPortP) bool cSatipRtsp::Setup(const char *uriP, int rtpPortP, int rtcpPortP)
{ {
debug("cSatipRtsp::%s(%d): uri=%s rtp=%d rtcp=%d", __FUNCTION__, tunerIdM, uriP, rtpPortP, rtcpPortP); debug("cSatipRtsp::%s(%s, %d, %d) [device %d]", __FUNCTION__, uriP, rtpPortP, rtcpPortP, tunerM.GetId());
if (handleM && !isempty(uriP)) { if (handleM && !isempty(uriP)) {
CURLcode res = CURLE_OK; CURLcode res = CURLE_OK;
cString transport = cString::sprintf("RTP/AVP;unicast;client_port=%d-%d", rtpPortP, rtcpPortP); cString transport = cString::sprintf("RTP/AVP;unicast;client_port=%d-%d", rtpPortP, rtcpPortP);
@ -182,11 +181,11 @@ bool cSatipRtsp::Setup(const char *uriP, int rtpPortP, int rtcpPortP)
bool cSatipRtsp::SetSession(const char *sessionP) bool cSatipRtsp::SetSession(const char *sessionP)
{ {
debug("cSatipRtsp::%s(%d): session=%s", __FUNCTION__, tunerIdM, sessionP); debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, sessionP, tunerM.GetId());
if (handleM) { if (handleM) {
CURLcode res = CURLE_OK; CURLcode res = CURLE_OK;
debug("cSatipRtsp::%s(%d): session id quirk enabled", __FUNCTION__, tunerIdM); debug("cSatipRtsp::%s(): session id quirk enabled [device %d]", __FUNCTION__, tunerM.GetId());
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_SESSION_ID, sessionP); SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_SESSION_ID, sessionP);
} }
@ -195,7 +194,7 @@ bool cSatipRtsp::SetSession(const char *sessionP)
bool cSatipRtsp::Describe(const char *uriP) bool cSatipRtsp::Describe(const char *uriP)
{ {
debug("cSatipRtsp::%s(%d): uri=%s", __FUNCTION__, tunerIdM, uriP); debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, uriP, tunerM.GetId());
if (handleM && !isempty(uriP)) { if (handleM && !isempty(uriP)) {
CURLcode res = CURLE_OK; CURLcode res = CURLE_OK;
@ -215,7 +214,7 @@ bool cSatipRtsp::Describe(const char *uriP)
bool cSatipRtsp::Play(const char *uriP) bool cSatipRtsp::Play(const char *uriP)
{ {
debug("cSatipRtsp::%s(%d): uri=%s", __FUNCTION__, tunerIdM, uriP); debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, uriP, tunerM.GetId());
if (handleM && !isempty(uriP)) { if (handleM && !isempty(uriP)) {
CURLcode res = CURLE_OK; CURLcode res = CURLE_OK;
@ -231,7 +230,7 @@ bool cSatipRtsp::Play(const char *uriP)
bool cSatipRtsp::Teardown(const char *uriP) bool cSatipRtsp::Teardown(const char *uriP)
{ {
debug("cSatipRtsp::%s(%d): uri=%s", __FUNCTION__, tunerIdM, uriP); debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, uriP, tunerM.GetId());
if (handleM && !isempty(uriP)) { if (handleM && !isempty(uriP)) {
CURLcode res = CURLE_OK; CURLcode res = CURLE_OK;
@ -260,10 +259,10 @@ bool cSatipRtsp::ValidateLatestResponse(void)
else if (rc != 0) { else if (rc != 0) {
char *url = NULL; char *url = NULL;
SATIP_CURL_EASY_GETINFO(handleM, CURLINFO_EFFECTIVE_URL, &url); SATIP_CURL_EASY_GETINFO(handleM, CURLINFO_EFFECTIVE_URL, &url);
error("Detected invalid status code %ld: %s [device %d]", rc, url, tunerIdM); error("Detected invalid status code %ld: %s [device %d]", rc, url, tunerM.GetId());
} }
} }
debug("cSatipRtsp::%s(%d): %s", __FUNCTION__, tunerIdM, result ? "ok" : "failed"); debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, result ? "ok" : "failed", tunerM.GetId());
return result; return result;
} }

1
rtsp.h
View File

@ -28,7 +28,6 @@ private:
}; };
cSatipTunerIf &tunerM; cSatipTunerIf &tunerM;
int tunerIdM;
CURL *handleM; CURL *handleM;
struct curl_slist *headerListM; struct curl_slist *headerListM;