Skip to content

Commit

Permalink
Merge branch 'next' into fix-ice-candidates-skip-firefox-empty-candidate
Browse files Browse the repository at this point in the history
  • Loading branch information
k-wasniowski authored Nov 25, 2024
2 parents d930b89 + 30d29dd commit 699f723
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 5 deletions.
19 changes: 19 additions & 0 deletions packages/@webex/plugin-meetings/src/meeting/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4904,6 +4904,8 @@ export default class Meeting extends StatelessWebexPlugin {
);
}

this.cleanUpBeforeReconnection();

return this.reconnectionManager
.reconnect(options, async () => {
await this.waitForRemoteSDPAnswer();
Expand Down Expand Up @@ -7032,6 +7034,23 @@ export default class Meeting extends StatelessWebexPlugin {
}
}

private async cleanUpBeforeReconnection(): Promise<void> {
try {
// when media fails, we want to upload a webrtc dump to see whats going on
// this function is async, but returns once the stats have been gathered
await this.forceSendStatsReport({callFrom: 'cleanUpBeforeReconnection'});

if (this.statsAnalyzer) {
await this.statsAnalyzer.stopAnalyzer();
}
} catch (error) {
LoggerProxy.logger.error(
'Meeting:index#cleanUpBeforeReconnection --> Error during cleanup: ',
error
);
}
}

/**
* Creates an instance of LocusMediaRequest for this meeting - it is needed for doing any calls
* to Locus /media API (these are used for sending Roap messages and updating audio/video mute status).
Expand Down
26 changes: 21 additions & 5 deletions packages/@webex/plugin-meetings/test/unit/spec/meeting/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7695,11 +7695,11 @@ describe('plugin-meetings', () => {
id: 'stream',
getTracks: () => [{id: 'track', addEventListener: sinon.stub()}],
};
const simulateConnectionStateChange = (newState) => {
const simulateConnectionStateChange = async (newState) => {
meeting.mediaProperties.webrtcMediaConnection.getConnectionState = sinon
.stub()
.returns(newState);
eventListeners[MediaConnectionEventNames.PEER_CONNECTION_STATE_CHANGED]();
await eventListeners[MediaConnectionEventNames.PEER_CONNECTION_STATE_CHANGED]();
};

beforeEach(() => {
Expand Down Expand Up @@ -7961,7 +7961,7 @@ describe('plugin-meetings', () => {
meeting.reconnectionManager = new ReconnectionManager(meeting);
meeting.reconnectionManager.iceReconnected = sinon.stub().returns(undefined);
meeting.setNetworkStatus = sinon.stub().returns(undefined);
meeting.statsAnalyzer = {startAnalyzer: sinon.stub()};
meeting.statsAnalyzer = {startAnalyzer: sinon.stub(), stopAnalyzer: sinon.stub()};
meeting.mediaProperties.webrtcMediaConnection = {
// mock the on() method and store all the listeners
on: sinon.stub().callsFake((event, listener) => {
Expand Down Expand Up @@ -8036,10 +8036,10 @@ describe('plugin-meetings', () => {
});

describe('CONNECTION_STATE_CHANGED event when state = "Failed"', () => {
const mockFailedEvent = () => {
const mockFailedEvent = async () => {
meeting.setupMediaConnectionListeners();

simulateConnectionStateChange(ConnectionState.Failed);
await simulateConnectionStateChange(ConnectionState.Failed);
};

const checkBehavioralMetricSent = (hasMediaConnectionConnectedAtLeastOnce = false) => {
Expand Down Expand Up @@ -8069,6 +8069,22 @@ describe('plugin-meetings', () => {
assert.notCalled(webex.internal.newMetrics.submitClientEvent);
checkBehavioralMetricSent(true);
});

it('stop stats analyzer during reconnection ', async () => {
meeting.hasMediaConnectionConnectedAtLeastOnce = true;
meeting.statsAnalyzer.stopAnalyzer = sinon.stub().resolves();
meeting.reconnectionManager = {
reconnect: sinon.stub().resolves(),
resetReconnectionTimer: () => {}
};
meeting.currentMediaStatus = {
video: true
};

await mockFailedEvent();

assert.calledOnce(meeting.statsAnalyzer.stopAnalyzer);
});
});

describe('should send correct metrics for ROAP_FAILURE event', () => {
Expand Down

0 comments on commit 699f723

Please sign in to comment.