Skip to content

Instantly share code, notes, and snippets.

@murillo128
Last active March 10, 2017 03:29
Show Gist options
  • Save murillo128/dea6fb5abff0b88cd8b34d15192cd4d6 to your computer and use it in GitHub Desktop.
Save murillo128/dea6fb5abff0b88cd8b34d15192cd4d6 to your computer and use it in GitHub Desktop.
I have a plan..

Ok, the idea is to create an utilitiy to allow doing plan B SDP O/A on unified plan peerconnections.

The idea is similar to https://github.com/jitsi/sdp-interop and we will borrow several ideas from them.

We assume that bundling and rtcp-mux is used always.

#CASE A: unified calls plan B

Unified Offer

In this case browser creates an SDP with one m-line per track. We are going to take that SDP, and create one unified local offer to be used in the PC setLocalDescription and one plan-B offer to send to the remote peer.

To create the unified local offer, we will rename each m-line mid so they are unique and make them sendonly.

To create the plan-B offer we will merge all the audio m-lines and all the video m-lines into one of each, and add the ssrc and msids accordingly.

Plan B answer

When we recive the plan B answer, we will have to create a unified plan SDP in order to pass it to the PC setRemoteDescription.

For each m-line in the unified original offer, we will create an m-line recvonly with same msid as the original one, filtering out the codecs/extensions not offered. We will pass this answer to the PC setRemoteDescription as "answer"

Then, for each stream on the plan B answer, we will create an m-line with send only (renaming the misd) and we will call setRemoteDescription as "offer". We will create a local description, and put it as is.

#CASE B: plan B calls unified

Plan B offer

We will get the plan B offer, and create an unified plan SDP to be set on the PC.

For each stream track present on the offer, we will create a send-only m-line copy copying all the m-line data and renaming the m-line. We will get all the local media streams, and for each track create a recvonly m-line.

Once done we will set that SDP to the PC in setRemoteDescription

Unified B answer

After calling the createAnswer we will get the unified plan SDP, we will merge all the audio m-lines and all the video m-lines into one of each, and add the ssrc and msids accordingly.

The unified plan SDP will be passed to the PC setLocalDescription as is.

#CASE C: Renegotiation

Unified Re-Offer

TBD

PlanB Re-Offer

TBD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment