-
Notifications
You must be signed in to change notification settings - Fork 1.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
feat(statistics): add pre call test interface #2578
Changes from 2 commits
6d02e1a
3f17fa4
e82b4ed
41ef8e6
596f885
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import PreCallTest from '@jitsi/precall-test'; | ||
|
||
|
||
export interface PreCallResult { | ||
throughput: number; // Maximum bandwidth reached in kbps (kilo bits per second). | ||
fractionalLoss: number; // Packet loss percentage over all the test traffic. | ||
rtt: number; // Round trip time in milliseconds. | ||
jitter: number; | ||
mediaConnectivity: boolean; // Whether the data channel was able to send data or not. | ||
} | ||
|
||
// Same interface as a PeerConnection configuration object. | ||
export interface IceServer { | ||
urls: Array<string> | string; | ||
username?: string; | ||
credential?: string; | ||
} | ||
|
||
let preCallTest: any = null | ||
|
||
/** | ||
* Run a pre-call test to check the network conditions. It uses a TURN server to establish | ||
* a connection between two PeerConnections using the server as a relay. Afterwards it sends | ||
* some test traffic through a data channel to measure the network conditions, these are | ||
* recorded and returned through a Promise. | ||
* | ||
* @param {Array<IceServer>} - The ICE servers to use for the test, these are passes to the PeerConnection constructor. | ||
* @returns {Promise<PreCallResult | string>} - A Promise that resolves with the test results or rejects with an error message. | ||
*/ | ||
export default async function runPreCallTest(iceServers: Array<IceServer>): Promise<PreCallResult | string> { | ||
// On initialization, the PreCallTest object simply does some checks and some browsers verifications, | ||
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. Can we have some static 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. As I see the API, it is expected that you could run this multiple times. For instance in the middle of the meeting you could run a test to check how your connection is performing, sort of an on demand test for participants that are concerned about their connection status. 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. I meant the initial check we can reuse, not the whole test. This "init" thing would do just that. 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. not sure I follow completely, you mean something like? 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. No, I mean something like:
|
||
// these seem to be reusable, so we'll keep the object around. | ||
preCallTest || (preCallTest = new PreCallTest()) | ||
|
||
return new Promise((resolve, reject) => { | ||
// It's not explicitly stated in the code, but if message is not null, something went wrong, | ||
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. Let's change the library please, this is not a good API. 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. I agree, just didn't want to mess with the library to much, cause I don't know the extent of the changes required. Should I start a refactoring effort on precall_test? 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. By the looks we don't need a full refactor, but a better way to report errors, to start with. 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. alright 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. Added a new version with a promise based interface |
||
// so we'll treat it as an error. | ||
preCallTest.start(iceServers, (result, message) => { | ||
if (message) { | ||
reject(message); | ||
|
||
return; | ||
} | ||
|
||
resolve(result); | ||
}); | ||
}); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,8 +80,8 @@ module.exports = (minimize, analyzeBundle) => { | |
}, | ||
performance: { | ||
hints: minimize ? 'error' : false, | ||
maxAssetSize: 1.08 * 1024 * 1024, | ||
maxEntrypointSize: 1.08 * 1024 * 1024 | ||
maxAssetSize: 1.09 * 1024 * 1024, | ||
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. Let's bump it to 1.25 to avoid having to do it one by one. |
||
maxEntrypointSize: 1.09 * 1024 * 1024 | ||
}, | ||
plugins: [ | ||
new IgnorePlugin({ resourceRegExp: /^(@xmldom\/xmldom|ws)$/ }), | ||
|
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.
Document this too pl.