Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeny-nadymov committed Apr 3, 2021
1 parent c7f2ab9 commit ea0cd0c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"homepage": "https://evgeny-nadymov.github.io/telegram-react",
"name": "telegram_react",
"version": "0.0.978",
"version": "0.0.979",
"private": true,
"dependencies": {
"tdweb": "^1.7.2",
Expand Down
35 changes: 20 additions & 15 deletions src/Calls/P2P/P2PSdpBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ export function p2pParseCandidate(candidate) {
component,
protocol,
priority,
ip,
port
address: { ip, port }
};

for (let i = 0; i < other.length; i += 2) {
Expand All @@ -36,11 +35,19 @@ export function p2pParseCandidate(candidate) {
break;
}
case 'raddr': {
c.relAddr = other[i + 1];
if (!c.relAddress) {
c.relAddress = { };
}

c.relAddress.ip = other[i + 1];
break;
}
case 'rport': {
c.relPort = other[i + 1];
if (!c.relAddress) {
c.relAddress = { };
}

c.relAddress.port = other[i + 1];
break;
}
case 'generation': {
Expand Down Expand Up @@ -186,7 +193,7 @@ export function p2pParseSdp(sdp) {
for (let i = 0; i < types.length; i++) {
const { id } = types[i];
if (rtcpFb.has(id)) {
types[i].feedback = rtcpFb.get(id);
types[i].feedbackTypes = rtcpFb.get(id);
}
if (fmtp.has(id)) {
types[i].parameters = fmtp.get(id);
Expand Down Expand Up @@ -252,11 +259,11 @@ export function addPayloadTypes(types) {

for (let i = 0; i < types.length; i++) {
const type = types[i];
const { id, name, clockrate, channels, feedback, parameters } = type;
const { id, name, clockrate, channels, feedbackTypes, parameters } = type;
sdp += `
a=rtpmap:${id} ${name}/${clockrate}${channels ? '/' + channels : ''}`;
if (feedback) {
feedback.forEach(x => {
if (feedbackTypes) {
feedbackTypes.forEach(x => {
const { type, subtype } = x;
sdp += `
a=rtcp-fb:${id} ${[type, subtype].join(' ')}`;
Expand Down Expand Up @@ -320,17 +327,15 @@ export class P2PSdpBuilder {
static generateCandidate(info) {
if (!info) return null;

const { sdpMLineIndex, sdpMid, foundation, component, protocol, priority, ip, port, type, relAddr, relPort, generation, tcpType, networkId, networkCost, username } = info;
let candidate = `candidate:${foundation} ${component} ${protocol} ${priority} ${ip} ${port}`;
const { sdpMLineIndex, sdpMid, foundation, component, protocol, priority, address, type, relAddress, generation, tcpType, networkId, networkCost, username } = info;
let candidate = `candidate:${foundation} ${component} ${protocol} ${priority} ${address.ip} ${address.port}`;
const attrs = []
if (type) {
attrs.push(`typ ${type}`);
}
if (relAddr) {
attrs.push(`raddr ${relAddr}`);
}
if (relPort) {
attrs.push(`rport ${relPort}`);
if (relAddress) {
attrs.push(`raddr ${relAddress.ip}`);
attrs.push(`rport ${relAddress.port}`);
}
if (generation) {
attrs.push(`generation ${generation}`);
Expand Down
6 changes: 3 additions & 3 deletions src/Stores/CallStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -1500,9 +1500,9 @@ class CallStore extends EventEmitter {
'@type': 'callProtocol',
udp_p2p: true,
udp_reflector: true,
min_layer: 126,
max_layer: 126,
library_versions: ['3.0.0']
min_layer: 92,
max_layer: 92,
library_versions: ['4.0.0']
};
}

Expand Down

0 comments on commit ea0cd0c

Please sign in to comment.