Skip to content

Commit

Permalink
feat:(munge-sdp): updated-sdk-with-latest-media-core (#3815)
Browse files Browse the repository at this point in the history
  • Loading branch information
adhmenon authored Sep 9, 2024
1 parent d5da303 commit 7e6755b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 58 deletions.
2 changes: 1 addition & 1 deletion packages/@webex/media-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"deploy:npm": "yarn npm publish"
},
"dependencies": {
"@webex/internal-media-core": "2.9.3",
"@webex/internal-media-core": "2.10.0",
"@webex/ts-events": "^1.1.0",
"@webex/web-media-effects": "2.18.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/@webex/plugin-meetings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
},
"dependencies": {
"@webex/common": "workspace:*",
"@webex/internal-media-core": "2.9.3",
"@webex/internal-media-core": "2.10.0",
"@webex/internal-plugin-conversation": "workspace:*",
"@webex/internal-plugin-device": "workspace:*",
"@webex/internal-plugin-llm": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/calling/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"dependencies": {
"@types/platform": "1.3.4",
"@webex/internal-media-core": "2.9.3",
"@webex/internal-media-core": "2.10.0",
"@webex/media-helpers": "workspace:*",
"async-mutex": "0.4.0",
"buffer": "6.0.3",
Expand Down
27 changes: 1 addition & 26 deletions packages/calling/src/CallingClient/calling/call.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ describe('Call Tests', () => {
sdpMunging: {
convertPort9to0: true,
addContentSlides: false,
copyClineToSessionLevel: true,
},
};

Expand Down Expand Up @@ -717,32 +718,6 @@ describe('Call Tests', () => {
{file: 'call', method: 'updateMedia'}
);
});

describe('#addSessionConnection', () => {
let call;

beforeEach(() => {
call = callManager.createCall(dest, CallDirection.INBOUND, deviceId, mockLineId);
});

it('should copy the c-line from media level to the session level', () => {
const sdp = `v=0\r\no=- 2890844526 2890842807 IN IP4 192.0.2.3\r\ns=-\r\nt=0 0\r\nm=audio 49170 RTP/AVP 0\r\nc=IN IP4 203.0.113.1\r\na=rtpmap:0 PCMU/8000`;

const expectedSdp = `v=0\r\no=- 2890844526 2890842807 IN IP4 192.0.2.3\r\ns=-\r\nc=IN IP4 203.0.113.1\r\nt=0 0\r\nm=audio 49170 RTP/AVP 0\r\nc=IN IP4 203.0.113.1\r\na=rtpmap:0 PCMU/8000`;

const result = call.addSessionConnection(sdp);
expect(result).toBe(expectedSdp);
});

it('should handle multiple media sections correctly', () => {
const sdp = `v=0\r\no=- 2890844526 2890842807 IN IP4 192.0.2.3\r\ns=-\r\nt=0 0\r\nm=audio 49170 RTP/AVP 0\r\nc=IN IP4 203.0.113.1\r\na=rtpmap:0 PCMU/8000\r\nm=video 51372 RTP/AVP 31\r\nc=IN IP4 203.0.113.2\r\na=rtpmap:31 H261/90000`;

const expectedSdp = `v=0\r\no=- 2890844526 2890842807 IN IP4 192.0.2.3\r\ns=-\r\nc=IN IP4 203.0.113.1\r\nt=0 0\r\nm=audio 49170 RTP/AVP 0\r\nc=IN IP4 203.0.113.1\r\na=rtpmap:0 PCMU/8000\r\nm=video 51372 RTP/AVP 31\r\nc=IN IP4 203.0.113.2\r\na=rtpmap:31 H261/90000`;

const result = call.addSessionConnection(sdp);
expect(result).toBe(expectedSdp);
});
});
});

describe('State Machine handler tests', () => {
Expand Down
23 changes: 1 addition & 22 deletions packages/calling/src/CallingClient/calling/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1904,6 +1904,7 @@ export class Call extends Eventing<CallEventTypes> implements ICall {
sdpMunging: {
convertPort9to0: true,
addContentSlides: false,
copyClineToSessionLevel: true,
},
},
{
Expand Down Expand Up @@ -2375,24 +2376,6 @@ export class Call extends Eventing<CallEventTypes> implements ICall {
});
}

/* istanbul ignore next */
/**
* Copy SDP's c-line to session level from media level.
* SPARK-522437
*/
private addSessionConnection(sdp: string): string {
const lines: string[] = sdp.split(/\r\n|\r|\n/);
const mIndex: number = lines.findIndex((line) => line.startsWith('m='));
const tIndex: number = lines.findIndex((line) => line.startsWith('t='));

if (mIndex !== -1 && mIndex < lines.length - 1 && lines[mIndex + 1].startsWith('c=')) {
const cLine: string = lines[mIndex + 1];
lines.splice(tIndex, 0, cLine);
}

return lines.join('\r\n');
}

/* istanbul ignore next */
/**
* Setup a listener for roap events emitted by the media sdk.
Expand All @@ -2413,10 +2396,6 @@ export class Call extends Eventing<CallEventTypes> implements ICall {
method: this.mediaRoapEventsListener.name,
});

if (event.roapMessage?.sdp) {
event.roapMessage.sdp = this.addSessionConnection(event.roapMessage.sdp);
}

switch (event.roapMessage.messageType) {
case RoapScenario.OK: {
const mediaOk = {
Expand Down
14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7419,7 +7419,7 @@ __metadata:
"@typescript-eslint/eslint-plugin": 5.38.1
"@typescript-eslint/parser": 5.38.1
"@web/dev-server": 0.4.5
"@webex/internal-media-core": 2.9.3
"@webex/internal-media-core": 2.10.0
"@webex/media-helpers": "workspace:*"
async-mutex: 0.4.0
buffer: 6.0.3
Expand Down Expand Up @@ -7710,9 +7710,9 @@ __metadata:
languageName: unknown
linkType: soft

"@webex/internal-media-core@npm:2.9.3":
version: 2.9.3
resolution: "@webex/internal-media-core@npm:2.9.3"
"@webex/internal-media-core@npm:2.10.0":
version: 2.10.0
resolution: "@webex/internal-media-core@npm:2.10.0"
dependencies:
"@babel/runtime": ^7.18.9
"@babel/runtime-corejs2": ^7.25.0
Expand All @@ -7724,7 +7724,7 @@ __metadata:
uuid: ^8.3.2
webrtc-adapter: ^8.1.2
xstate: ^4.30.6
checksum: 568e54be4afa7f5a93a843f927c5af12828b781deebeb651f89e7f4639f149b7b1e1642a9f3c75d8d20a065838d170853f3ea90a0f57aed0601481d584e321b6
checksum: 4191b75de30a22c131dba7cbc4922cf5da52ad799ab059391539355f50dcdf8aa02fb2fd738a5bbf4938a54bc869e00ba7f74fdd58e04f231825665fd7c05ce2
languageName: node
linkType: hard

Expand Down Expand Up @@ -8483,7 +8483,7 @@ __metadata:
"@babel/preset-typescript": 7.22.11
"@webex/babel-config-legacy": "workspace:*"
"@webex/eslint-config-legacy": "workspace:*"
"@webex/internal-media-core": 2.9.3
"@webex/internal-media-core": 2.10.0
"@webex/jest-config-legacy": "workspace:*"
"@webex/legacy-tools": "workspace:*"
"@webex/test-helper-chai": "workspace:*"
Expand Down Expand Up @@ -8719,7 +8719,7 @@ __metadata:
"@webex/babel-config-legacy": "workspace:*"
"@webex/common": "workspace:*"
"@webex/eslint-config-legacy": "workspace:*"
"@webex/internal-media-core": 2.9.3
"@webex/internal-media-core": 2.10.0
"@webex/internal-plugin-conversation": "workspace:*"
"@webex/internal-plugin-device": "workspace:*"
"@webex/internal-plugin-llm": "workspace:*"
Expand Down

0 comments on commit 7e6755b

Please sign in to comment.