Skip to content

Instantly share code, notes, and snippets.

@Climax777
Created May 11, 2018 12:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Climax777/4a6c695f4a6f0aca75ef012e4ff87782 to your computer and use it in GitHub Desktop.
Save Climax777/4a6c695f4a6f0aca75ef012e4ff87782 to your computer and use it in GitHub Desktop.
Spoofing SDP is needed for Chrome/firefox
// Insert this right after getting the offer (create-offer)
// TODO don't override ultimately this will be bad..
gchar* fmtp_value = g_strdup_printf ("96 profile-level-id=%s;packetization-mode=1","42e01f");
GstSDPMedia *sdp_media =
(GstSDPMedia *) & g_array_index (offer->sdp->medias, GstSDPMedia, 0);
for( int i = 0; i < gst_sdp_media_attributes_len(sdp_media); ++i) {
const GstSDPAttribute* attr = gst_sdp_media_get_attribute(sdp_media, i);
if(attr->key)
cout << attr->key << ":";
if(attr->value)
cout << attr->value;
cout << endl;
if(g_strcmp0(attr->key, "fmtp") == 0) {
gst_sdp_media_remove_attribute(sdp_media, i);
break;
}
}
gst_sdp_media_add_attribute (sdp_media, "fmtp", fmtp_value);
g_free (fmtp_value);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment