Set debug enabler in SDP media.
Lowered debug level for media debug messages.
This commit is contained in:
parent
a590b6083f
commit
c45f3a0345
|
@ -40,7 +40,8 @@ SDPMedia::SDPMedia(const char* media, const char* transport, const char* formats
|
||||||
m_audio(true), m_video(false), m_modified(false), m_securable(true), m_haveRfc3833(false),
|
m_audio(true), m_video(false), m_modified(false), m_securable(true), m_haveRfc3833(false),
|
||||||
m_localChanged(false),
|
m_localChanged(false),
|
||||||
m_transport(transport), m_formats(formats),
|
m_transport(transport), m_formats(formats),
|
||||||
m_lDir(0), m_rDir(0)
|
m_lDir(0), m_rDir(0),
|
||||||
|
m_enabler(0), m_ptr(0)
|
||||||
{
|
{
|
||||||
DDebug(DebugAll,"SDPMedia::SDPMedia('%s','%s','%s',%d,%d) [%p]",
|
DDebug(DebugAll,"SDPMedia::SDPMedia('%s','%s','%s',%d,%d) [%p]",
|
||||||
media,transport,formats,rport,lport,this);
|
media,transport,formats,rport,lport,this);
|
||||||
|
@ -133,8 +134,8 @@ bool SDPMedia::update(const char* formats, int rport, int lport, bool force)
|
||||||
if (tmp.find(',') < 0) {
|
if (tmp.find(',') < 0) {
|
||||||
// single format received, check if acceptable
|
// single format received, check if acceptable
|
||||||
if (m_formats && !force && m_formats.find(tmp) < 0) {
|
if (m_formats && !force && m_formats.find(tmp) < 0) {
|
||||||
Debug(DebugNote,"Not changing to '%s' from '%s' [%p]",
|
TraceDebug(m_traceId,m_enabler,DebugInfo,"Not changing to '%s' from '%s' [%p]",
|
||||||
formats,m_formats.c_str(),this);
|
formats,m_formats.c_str(),m_ptr);
|
||||||
tmp.clear();
|
tmp.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,15 +156,16 @@ bool SDPMedia::update(const char* formats, int rport, int lport, bool force)
|
||||||
TelEngine::destruct(l1);
|
TelEngine::destruct(l1);
|
||||||
TelEngine::destruct(l2);
|
TelEngine::destruct(l2);
|
||||||
if (tmp.null())
|
if (tmp.null())
|
||||||
Debug(DebugNote,"Not changing formats '%s' [%p]",m_formats.c_str(),this);
|
TraceDebug(m_traceId,m_enabler,DebugInfo,"Not changing formats '%s' [%p]",
|
||||||
|
m_formats.c_str(),m_ptr);
|
||||||
}
|
}
|
||||||
if (tmp && (m_formats != tmp)) {
|
if (tmp && (m_formats != tmp)) {
|
||||||
chg = true;
|
chg = true;
|
||||||
m_formats = tmp;
|
m_formats = tmp;
|
||||||
int q = m_formats.find(',');
|
int q = m_formats.find(',');
|
||||||
m_format = m_formats.substr(0,q);
|
m_format = m_formats.substr(0,q);
|
||||||
Debug(DebugInfo,"Choosing offered '%s' format '%s' [%p]",
|
TraceDebug(m_traceId,m_enabler,DebugAll,"Choosing offered '%s' format '%s' [%p]",
|
||||||
c_str(),m_format.c_str(),this);
|
c_str(),m_format.c_str(),m_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rport >= 0) {
|
if (rport >= 0) {
|
||||||
|
@ -196,8 +198,8 @@ void SDPMedia::update(const NamedList& msg, bool pickFormat)
|
||||||
if (format) {
|
if (format) {
|
||||||
m_format = format;
|
m_format = format;
|
||||||
if ((m_formats != m_format) && (msg.getIntValue("remoteport") > 0)) {
|
if ((m_formats != m_format) && (msg.getIntValue("remoteport") > 0)) {
|
||||||
Debug(DebugNote,"Choosing started '%s' format '%s' [%p]",
|
TraceDebug(m_traceId,m_enabler,DebugAll,"Choosing started '%s' format '%s' [%p]",
|
||||||
c_str(),format,this);
|
c_str(),format,m_ptr);
|
||||||
m_formats = m_format;
|
m_formats = m_format;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -329,6 +331,15 @@ int SDPMedia::payloadMapping(const String& mappings, const String& fmt)
|
||||||
return payload;
|
return payload;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set data used in debug
|
||||||
|
void SDPMedia::setSdpDebug(DebugEnabler* enabler, void* ptr, const String* traceId)
|
||||||
|
{
|
||||||
|
m_enabler = enabler;
|
||||||
|
m_ptr = (m_enabler && ptr) ? ptr : (void*)this;
|
||||||
|
if (traceId)
|
||||||
|
m_traceId = *traceId;
|
||||||
|
}
|
||||||
|
|
||||||
}; // namespace TelEngine
|
}; // namespace TelEngine
|
||||||
|
|
||||||
/* vi: set ts=8 sw=4 sts=4 noet: */
|
/* vi: set ts=8 sw=4 sts=4 noet: */
|
||||||
|
|
|
@ -68,6 +68,8 @@ bool SDPSession::setMedia(ObjList* media, bool preserveExisting)
|
||||||
DDebug(m_enabler,DebugAll,"SDPSession::setMedia(%p) [%p]",media,m_ptr);
|
DDebug(m_enabler,DebugAll,"SDPSession::setMedia(%p) [%p]",media,m_ptr);
|
||||||
ObjList* tmp = m_rtpMedia;
|
ObjList* tmp = m_rtpMedia;
|
||||||
m_rtpMedia = media;
|
m_rtpMedia = media;
|
||||||
|
for (ObjList* o = m_rtpMedia ? m_rtpMedia->skipNull() : 0; o; o = o->skipNext())
|
||||||
|
static_cast<SDPMedia*>(o->get())->setSdpDebug(m_enabler,m_ptr,&m_traceId);
|
||||||
bool chg = m_rtpMedia != 0;
|
bool chg = m_rtpMedia != 0;
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
chg = false;
|
chg = false;
|
||||||
|
@ -756,6 +758,7 @@ void SDPSession::updateFormats(const NamedList& msg, bool changeMedia)
|
||||||
p->c_str(),tmp.c_str(),m_ptr);
|
p->c_str(),tmp.c_str(),m_ptr);
|
||||||
if (trans) {
|
if (trans) {
|
||||||
rtp = new SDPMedia(tmp,trans,p->c_str());
|
rtp = new SDPMedia(tmp,trans,p->c_str());
|
||||||
|
rtp->setSdpDebug(m_enabler,m_ptr,&m_traceId);
|
||||||
m_rtpMedia->append(rtp);
|
m_rtpMedia->append(rtp);
|
||||||
mediaChanged(*rtp);
|
mediaChanged(*rtp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -468,6 +468,14 @@ public:
|
||||||
*/
|
*/
|
||||||
void keepRtp(const SDPMedia& other);
|
void keepRtp(const SDPMedia& other);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set data used in debug
|
||||||
|
* @param enabler The DebugEnabler to use (0 to to use the parser)
|
||||||
|
* @param ptr Pointer to print, 0 to use the media pointer
|
||||||
|
* @param traceId Trace ID to use for debugging
|
||||||
|
*/
|
||||||
|
void setSdpDebug(DebugEnabler* enabler = 0, void* ptr = 0, const String* traceId = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve direction if known
|
* Retrieve direction if known
|
||||||
* @param dir Destination variable to set the direction in
|
* @param dir Destination variable to set the direction in
|
||||||
|
@ -525,6 +533,9 @@ private:
|
||||||
// Local / remote media direction
|
// Local / remote media direction
|
||||||
int m_lDir;
|
int m_lDir;
|
||||||
int m_rDir;
|
int m_rDir;
|
||||||
|
DebugEnabler* m_enabler; // Debug enabler used for output
|
||||||
|
void* m_ptr; // Pointer to show in debug messages
|
||||||
|
String m_traceId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue