-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Send SDP as JSON instead of String between clients and Erizo #1075
Merged
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d83732d
Send SDP as JSON instead of String between clients and Erizo
jcague 8bfe075
fix lint
jcague 53c2b3a
Fix spine tests
jcague dab28d9
Added lint to semanticSdp
jcague f377252
Fix sdp-transform version
jcague dd885ef
Remove LD_LIBRARY_PATH from runSpineTest.sh
jcague 962975e
More fixes to spine tests
jcague e776480
Remove unnecessary parameter in x-google-flag.
jcague 90aa2a7
Merge branch 'master' into modify/sdp_from_string_to_json
jcague File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
class CandidateInfo { | ||
constructor(foundation, componentId, transport, priority, address, port, | ||
type, generation, relAddr, relPort) { | ||
this.foundation = foundation; | ||
this.componentId = componentId; | ||
this.transport = transport; | ||
this.priority = priority; | ||
this.address = address; | ||
this.port = port; | ||
this.type = type; | ||
this.generation = generation; | ||
this.relAddr = relAddr; | ||
this.relPort = relPort; | ||
} | ||
|
||
clone() { | ||
return new CandidateInfo(this.foundation, this.componentId, this.transport, this.priority, | ||
this.address, this.port, this.type, this.generation, this.relAddr, this.relPort); | ||
} | ||
|
||
plain() { | ||
const plain = { | ||
foundation: this.foundation, | ||
componentId: this.componentId, | ||
transport: this.transport, | ||
priority: this.priority, | ||
address: this.address, | ||
port: this.port, | ||
type: this.type, | ||
generation: this.generation, | ||
}; | ||
if (this.relAddr) plain.relAddr = this.relAddr; | ||
if (this.relPort) plain.relPort = this.relPort; | ||
return plain; | ||
} | ||
|
||
getFoundation() { | ||
return this.foundation; | ||
} | ||
|
||
getComponentId() { | ||
return this.componentId; | ||
} | ||
|
||
getTransport() { | ||
return this.transport; | ||
} | ||
|
||
getPriority() { | ||
return this.priority; | ||
} | ||
|
||
getAddress() { | ||
return this.address; | ||
} | ||
|
||
getPort() { | ||
return this.port; | ||
} | ||
|
||
getType() { | ||
return this.type; | ||
} | ||
|
||
getGeneration() { | ||
return this.generation; | ||
} | ||
|
||
getRelAddr() { | ||
return this.relAddr; | ||
} | ||
|
||
getRelPort() { | ||
return this.relPort; | ||
} | ||
|
||
} | ||
|
||
module.exports = CandidateInfo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
class CodecInfo { | ||
|
||
constructor(codec, type, rate, encoding, params, feedback) { | ||
this.codec = codec; | ||
this.type = type; | ||
this.rate = rate; | ||
this.encoding = encoding; | ||
this.params = params || {}; | ||
this.feedback = feedback || []; | ||
} | ||
|
||
clone() { | ||
const cloned = new CodecInfo(this.codec, this.type, this.rate, this.encoding, | ||
this.params, this.feedback); | ||
if (this.rtx) { | ||
cloned.setRTX(this.rtx); | ||
} | ||
return cloned; | ||
} | ||
|
||
|
||
plain() { | ||
return { | ||
codec: this.codec, | ||
type: this.type, | ||
rate: this.rate, | ||
encoding: this.encoding, | ||
params: this.params, | ||
feedback: this.feedback, | ||
}; | ||
} | ||
|
||
setRTX(rtx) { | ||
this.rtx = rtx; | ||
} | ||
|
||
getType() { | ||
return this.type; | ||
} | ||
|
||
setType(type) { | ||
this.type = type; | ||
} | ||
|
||
getCodec() { | ||
return this.codec; | ||
} | ||
|
||
getParams() { | ||
return this.params; | ||
} | ||
|
||
hasRTX() { | ||
return this.rtx; | ||
} | ||
|
||
getRTX() { | ||
return this.rtx; | ||
} | ||
|
||
getRate() { | ||
return this.rate; | ||
} | ||
|
||
getEncoding() { | ||
return this.encoding; | ||
} | ||
|
||
getFeedback() { | ||
return this.feedback; | ||
} | ||
} | ||
|
||
CodecInfo.mapFromNames = (names, rtx) => { | ||
const codecs = new Map(); | ||
|
||
let dyn = 96; | ||
names.forEach((nameWithUpperCases) => { | ||
let pt; | ||
const name = nameWithUpperCases.toLowerCase(); | ||
if (name === 'pcmu') pt = 0; | ||
else if (name === 'pcma') pt = 8; | ||
else { | ||
dyn += 1; | ||
pt = dyn; | ||
} | ||
const codec = new CodecInfo(name, pt); | ||
if (rtx && name !== 'ulpfec' && name !== 'flexfec-03' && name !== 'red') { | ||
dyn += 1; | ||
codec.setRTX(dyn); | ||
} | ||
codecs.set(codec.getCodec().toLowerCase(), codec); | ||
}); | ||
return codecs; | ||
}; | ||
|
||
module.exports = CodecInfo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const Setup = require('./Setup'); | ||
|
||
class DTLSInfo { | ||
constructor(setup, hash, fingerprint) { | ||
this.setup = setup; | ||
this.hash = hash; | ||
this.fingerprint = fingerprint; | ||
} | ||
|
||
clone() { | ||
return new DTLSInfo(this.setup, this.hash, this.fingerprint); | ||
} | ||
|
||
plain() { | ||
return { | ||
setup: Setup.toString(this.setup), | ||
hash: this.hash, | ||
fingerprint: this.fingerprint, | ||
}; | ||
} | ||
|
||
getFingerprint() { | ||
return this.fingerprint; | ||
} | ||
|
||
getHash() { | ||
return this.hash; | ||
} | ||
|
||
getSetup() { | ||
return this.setup; | ||
} | ||
|
||
setSetup(setup) { | ||
this.setup = setup; | ||
} | ||
} | ||
|
||
module.exports = DTLSInfo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const Enum = require('./Enum'); | ||
|
||
const Direction = Enum('SENDRECV', 'SENDONLY', 'RECVONLY', 'INACTIVE'); | ||
|
||
Direction.byValue = direction => Direction[direction.toUpperCase()]; | ||
|
||
/** | ||
* Get Direction name | ||
* @memberOf Direction | ||
* @param {Direction} direction | ||
* @returns {String} | ||
*/ | ||
Direction.toString = (direction) => { | ||
switch (direction) { | ||
case Direction.SENDRECV: | ||
return 'sendrecv'; | ||
case Direction.SENDONLY: | ||
return 'sendonly'; | ||
case Direction.RECVONLY: | ||
return 'recvonly'; | ||
case Direction.INACTIVE: | ||
return 'inactive'; | ||
default: | ||
return 'unknown'; | ||
} | ||
}; | ||
|
||
Direction.reverse = (direction) => { | ||
switch (direction) { | ||
case Direction.SENDRECV: | ||
return Direction.SENDRECV; | ||
case Direction.SENDONLY: | ||
return Direction.RECVONLY; | ||
case Direction.RECVONLY: | ||
return Direction.SENDONLY; | ||
case Direction.INACTIVE: | ||
return Direction.INACTIVE; | ||
default: | ||
return Direction.SENDRECV; | ||
} | ||
}; | ||
|
||
module.exports = Direction; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const Enum = require('./Enum'); | ||
|
||
const DirectionWay = Enum('SEND', 'RECV'); | ||
|
||
DirectionWay.byValue = direction => DirectionWay[direction.toUpperCase()]; | ||
|
||
DirectionWay.toString = (direction) => { | ||
switch (direction) { | ||
case DirectionWay.SEND: | ||
return 'send'; | ||
case DirectionWay.RECV: | ||
return 'recv'; | ||
default: | ||
return 'unknown'; | ||
} | ||
}; | ||
|
||
DirectionWay.reverse = (direction) => { | ||
switch (direction) { | ||
case DirectionWay.SEND: | ||
return DirectionWay.RECV; | ||
case DirectionWay.RECV: | ||
return DirectionWay.SEND; | ||
default: | ||
return DirectionWay.SEND; | ||
} | ||
}; | ||
|
||
module.exports = DirectionWay; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
function Enum(...args) { | ||
if (!(this instanceof Enum)) { | ||
return new (Function.prototype.bind.apply(Enum, | ||
[null].concat(Array.prototype.slice.call(args))))(); | ||
} | ||
Array.from(args).forEach((arg) => { | ||
this[arg] = Symbol.for(`LICODE_SEMANTIC_SDP_${arg}`); | ||
}); | ||
} | ||
|
||
module.exports = Enum; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
👍 Good catch!