-
-
Notifications
You must be signed in to change notification settings - Fork 237
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
Reuse closed m= sections in Firefox #149
base: v3
Are you sure you want to change the base?
Changes from 5 commits
8e9f1b1
f82c00d
a5c2003
23bb68c
83153fa
8ddd007
3fbd45b
91241e3
adf2237
1d1977d
bbf4cea
4d98c34
87f82b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,6 +160,7 @@ export class RemoteSdp | |
{ | ||
offerMediaObject, | ||
reuseMid, | ||
localSdpMedia, | ||
offerRtpParameters, | ||
answerRtpParameters, | ||
codecOptions, | ||
|
@@ -168,6 +169,7 @@ export class RemoteSdp | |
{ | ||
offerMediaObject: any; | ||
reuseMid?: string; | ||
localSdpMedia?: any; | ||
offerRtpParameters: RtpParameters; | ||
answerRtpParameters: RtpParameters; | ||
codecOptions?: ProducerCodecOptions; | ||
|
@@ -197,7 +199,10 @@ export class RemoteSdp | |
// Unified-Plan or Plan-B with different media kind. | ||
else if (!this._midToIndex.has(mediaSection.mid)) | ||
{ | ||
this._addMediaSection(mediaSection); | ||
if (localSdpMedia) | ||
this._syncMediaWithLocalSdp(localSdpMedia, mediaSection); | ||
else | ||
this._addMediaSection(mediaSection); | ||
} | ||
// Plan-B with same media kind. | ||
else | ||
|
@@ -442,6 +447,45 @@ export class RemoteSdp | |
} | ||
} | ||
|
||
_syncMediaWithLocalSdp(localSdpMedia: any, newMediaSection: MediaSection): void | ||
{ | ||
if (!this._firstMid) | ||
this._firstMid = newMediaSection.mid; | ||
|
||
// Append new section to the existing vector and the SDP object | ||
let idx = this._mediaSections.length; | ||
this._mediaSections.push(newMediaSection); | ||
this._sdpObject.media.push(newMediaSection.getObject()); | ||
|
||
// Add it to the map | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same for all the added comments. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Periods added to the comments. |
||
this._midToIndex.set(newMediaSection.mid, idx); | ||
|
||
// Copy data to the temporary collections | ||
const mediaSections = this._mediaSections.slice(), media = this._sdpObject.media.slice(); | ||
// Clean up existing collections | ||
this._mediaSections.length = this._sdpObject.media.length = 0; | ||
|
||
// Refill media sections vector and SDP object media | ||
// using the order of sections in the local SDP offer | ||
for (const mediaSection of localSdpMedia) | ||
{ | ||
const i = this._midToIndex.get(String(mediaSection.mid)); | ||
if (i !== undefined) | ||
{ | ||
this._mediaSections.push(mediaSections[i]); | ||
this._sdpObject.media.push(media[i]); | ||
} | ||
} | ||
|
||
// Recreate map | ||
this._midToIndex.clear(); | ||
for (idx = 0; idx < this._mediaSections.length; ++idx) | ||
this._midToIndex.set(this._mediaSections[idx].mid, idx); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. braces missing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Braces added. |
||
|
||
// Regenerate BUNDLE mids. | ||
this._regenerateBundleMids(); | ||
} | ||
|
||
_regenerateBundleMids(): void | ||
{ | ||
if (!this._dtlsParameters) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dot after en of comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.