Skip to content
Snippets Groups Projects
Commit b8795c9a authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #7246: Print SDP properly

parent f71da8ae
No related branches found
No related tags found
No related merge requests found
...@@ -221,6 +221,16 @@ void Sdp::setLocalMediaCapabilities(const CodecOrder &selectedCodecs) ...@@ -221,6 +221,16 @@ void Sdp::setLocalMediaCapabilities(const CodecOrder &selectedCodecs)
} }
} }
namespace {
void printSession(const pjmedia_sdp_session *session)
{
char buffer[2048];
size_t size = pjmedia_sdp_print(session, buffer, sizeof(buffer));
std::string sessionStr(buffer, size);
DEBUG("%s", sessionStr.c_str());
}
}
int Sdp::createLocalSession(const CodecOrder &selectedCodecs) int Sdp::createLocalSession(const CodecOrder &selectedCodecs)
{ {
setLocalMediaCapabilities(selectedCodecs); setLocalMediaCapabilities(selectedCodecs);
...@@ -259,9 +269,8 @@ int Sdp::createLocalSession(const CodecOrder &selectedCodecs) ...@@ -259,9 +269,8 @@ int Sdp::createLocalSession(const CodecOrder &selectedCodecs)
if (!srtpCrypto_.empty()) if (!srtpCrypto_.empty())
addSdesAttribute(srtpCrypto_); addSdesAttribute(srtpCrypto_);
char buffer[1000]; DEBUG("SDP: Local SDP Session:");
pjmedia_sdp_print(localSession_, buffer, sizeof(buffer)); printSession(localSession_);
DEBUG("SDP: Local SDP Session:\n%s", buffer);
return pjmedia_sdp_validate(localSession_); return pjmedia_sdp_validate(localSession_);
} }
...@@ -279,8 +288,8 @@ void Sdp::receiveOffer(const pjmedia_sdp_session* remote, ...@@ -279,8 +288,8 @@ void Sdp::receiveOffer(const pjmedia_sdp_session* remote,
{ {
assert(remote); assert(remote);
char buffer[1000]; DEBUG("SDP: Remote SDP Session:");
pjmedia_sdp_print(remote, buffer, sizeof(buffer)); printSession(remote);
if (localSession_ == NULL && createLocalSession(selectedCodecs) != PJ_SUCCESS) { if (localSession_ == NULL && createLocalSession(selectedCodecs) != PJ_SUCCESS) {
ERROR("SDP: Failed to create initial offer"); ERROR("SDP: Failed to create initial offer");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment