Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the Opus codec #179

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Add t_sdp::set_fmtp_int_params(), to add several fmtp params at once
  • Loading branch information
fbriere committed Jun 9, 2022
commit 4289d9174a0a77f9156748eaab64107d7440e093
20 changes: 20 additions & 0 deletions src/sdp/sdp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,26 @@ void t_sdp::set_fmtp_int_param(t_sdp_media_type media_type, unsigned short codec
set_fmtp(media_type, codec, fmtp);
}

void t_sdp::set_fmtp_int_params(t_sdp_media_type media_type, unsigned short codec,
const std::map<std::string, int> &params)
{
if (params.empty()) return;

std::string fmtp;
bool first_param = true;

for (const std::pair<std::string, int> &param : params) {
fmtp += (first_param ? "" : "; ");
first_param = false;

fmtp += param.first;
fmtp += '=';
fmtp += int2str(param.second);
}

set_fmtp(media_type, codec, fmtp);
}

void t_sdp::set_zrtp_support(t_sdp_media_type media_type) {
t_sdp_media *m = const_cast<t_sdp_media *>(get_first_media(media_type));
assert(m != NULL);
Expand Down
2 changes: 2 additions & 0 deletions src/sdp/sdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ class t_sdp : public t_sip_body {
void set_fmtp(t_sdp_media_type media_type, unsigned short codec, const string &fmtp);
void set_fmtp_int_param(t_sdp_media_type media_type, unsigned short codec,
const string &param, int value);
void set_fmtp_int_params(t_sdp_media_type media_type, unsigned short codec,
const std::map<std::string, int> &params);
void set_zrtp_support(t_sdp_media_type media_type);

// Returns a pointer to the first media stream in the list of media
Expand Down