Commit 1cdbbdda authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #18261: sdp: add RTCP info (for audio) to SDP

parent 331fe61c
......@@ -272,12 +272,35 @@ Sdp::setMediaDescriptorLines(bool audio)
if (!zrtpHelloHash_.empty())
addZrtpAttribute(med, zrtpHelloHash_);
if (audio)
if (audio) {
setTelephoneEventRtpmap(med);
addRTCPAttribute(med); // video has its own RTCP
}
return med;
}
void Sdp::addRTCPAttribute(pjmedia_sdp_media *med)
{
// FIXME: get this from CCRTP directly, don't just assume that the RTCP port is
// RTP + 1
std::ostringstream os;
os << localIpAddr_ << ":" << (localAudioPort_ + 1);
const std::string str(os.str());
const pj_str_t input_str = {(char*) str.c_str(), str.size()};
pj_sockaddr outputAddr;
pj_status_t status = pj_sockaddr_parse(PJ_AF_UNSPEC, 0, &input_str, &outputAddr);
if (status != PJ_SUCCESS) {
ERROR("Could not parse address %s", str.c_str());
return;
}
pjmedia_sdp_attr *attr = pjmedia_sdp_attr_create_rtcp(memPool_, &outputAddr);
if (attr)
pjmedia_sdp_attr_add(&med->attr_count, med->attr, attr);
}
void Sdp::setTelephoneEventRtpmap(pjmedia_sdp_media *med)
{
pjmedia_sdp_attr *attr_rtpmap = static_cast<pjmedia_sdp_attr *>(pj_pool_zalloc(memPool_, sizeof(pjmedia_sdp_attr)));
......
......@@ -357,6 +357,8 @@ class Sdp {
* @throw SdpException
*/
void addZrtpAttribute(pjmedia_sdp_media* media, std::string hash);
void addRTCPAttribute(pjmedia_sdp_media *med);
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment