Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
elm
element-web
matrix-js-sdk
Commits
755f4a16
Commit
755f4a16
authored
2 years ago
by
Enrico Schwendig
Browse files
Options
Download
Email Patches
Plain Diff
voip: moved stats event to the group call class
parent
fddb909f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
7 deletions
+26
-7
src/webrtc/call.ts
src/webrtc/call.ts
+1
-0
src/webrtc/groupCall.ts
src/webrtc/groupCall.ts
+23
-5
src/webrtc/stats/statsReport.ts
src/webrtc/stats/statsReport.ts
+2
-2
No files found.
src/webrtc/call.ts
View file @
755f4a16
...
...
@@ -3118,6 +3118,7 @@ export class MatrixCall extends TypedEventEmitter<CallEvent, CallEventHandlerMap
public
initStats
(
stats
:
GroupCallStats
,
peerId
=
"
unknown
"
):
void
{
this
.
stats
=
stats
;
this
.
stats
.
start
();
}
}
...
...
This diff is collapsed.
Click to expand it.
src/webrtc/groupCall.ts
View file @
755f4a16
...
...
@@ -53,6 +53,7 @@ export enum GroupCallEvent {
LocalMuteStateChanged
=
"
local_mute_state_changed
"
,
ParticipantsChanged
=
"
participants_changed
"
,
Error
=
"
error
"
,
ConnectionStats
=
"
connection_stats
"
,
}
export
type
GroupCallEventHandlerMap
=
{
...
...
@@ -84,6 +85,18 @@ export type GroupCallEventHandlerMap = {
* ```
*/
[
GroupCallEvent
.
Error
]:
(
error
:
GroupCallError
)
=>
void
;
[
GroupCallEvent
.
ConnectionStats
]:
(
report
:
any
)
=>
void
;
};
export
enum
GroupCallStatsReportEvent
{
ConnectionStats
=
"
GroupCall.connection_stats
"
,
ByteSentStats
=
"
GroupCall.byte_sent_stats
"
,
}
export
type
GroupCallStatsReportEventHandlerMap
=
{
[
GroupCallStatsReportEvent
.
ConnectionStats
]:
(
report
:
any
)
=>
void
;
[
GroupCallStatsReportEvent
.
ByteSentStats
]:
(
report
:
any
)
=>
void
;
};
export
enum
GroupCallErrorCode
{
...
...
@@ -185,8 +198,8 @@ function getCallUserId(call: MatrixCall): string | null {
}
export
class
GroupCall
extends
TypedEventEmitter
<
GroupCallEvent
|
CallEvent
,
GroupCallEventHandlerMap
&
CallEventHandlerMap
GroupCallEvent
|
CallEvent
|
GroupCallStatsReportEvent
,
GroupCallEventHandlerMap
&
CallEventHandlerMap
&
GroupCallStatsReportEventHandlerMap
>
{
// Config
public
activeSpeakerInterval
=
1000
;
...
...
@@ -216,7 +229,7 @@ export class GroupCall extends TypedEventEmitter<
private
initWithVideoMuted
=
false
;
private
initCallFeedPromise
?:
Promise
<
void
>
;
p
rivate
readonly
stats
:
GroupCallStats
;
p
ublic
readonly
stats
:
GroupCallStats
;
public
constructor
(
private
client
:
MatrixClient
,
...
...
@@ -239,18 +252,23 @@ export class GroupCall extends TypedEventEmitter<
this
.
on
(
GroupCallEvent
.
ParticipantsChanged
,
this
.
onParticipantsChanged
);
this
.
on
(
GroupCallEvent
.
GroupCallStateChanged
,
this
.
onStateChanged
);
this
.
on
(
GroupCallEvent
.
LocalScreenshareStateChanged
,
this
.
onLocalFeedsChanged
);
const
userID
=
this
.
client
.
getUserId
()
||
"
unknown
"
;
this
.
stats
=
new
GroupCallStats
(
this
.
groupCallId
,
userID
);
this
.
stats
.
reports
.
on
(
StatsReport
.
CONNECTION_STATS
,
this
.
onConnectionStats
);
this
.
stats
.
reports
.
on
(
StatsReport
.
BYTE_SENT_STATS
,
this
.
onByteSendStats
);
}
private
onConnectionStats
(
_
:
ConnectionStatsReport
):
void
{
private
onConnectionStats
(
report
:
ConnectionStatsReport
):
void
{
// @TODO: Implement data argumentation and event broadcasting please
window
.
console
.
log
(
"
###### ---
"
,
report
);
this
.
emit
(
GroupCallStatsReportEvent
.
ConnectionStats
,
report
);
}
private
onByteSendStats
(
_
:
ByteSendStatsReport
):
void
{
private
onByteSendStats
(
report
:
ByteSendStatsReport
):
void
{
// @TODO: Implement data argumentation and event broadcasting please
window
.
console
.
log
(
"
###### ----
"
,
report
);
this
.
emit
(
GroupCallStatsReportEvent
.
ByteSentStats
,
report
);
}
public
async
create
():
Promise
<
GroupCall
>
{
...
...
This diff is collapsed.
Click to expand it.
src/webrtc/stats/statsReport.ts
View file @
755f4a16
...
...
@@ -19,8 +19,8 @@ import { TransportStats } from "./transportStats";
import
{
Resolution
}
from
"
./media/mediaTrackStats
"
;
export
enum
StatsReport
{
CONNECTION_STATS
=
"
connection_stats
"
,
BYTE_SENT_STATS
=
"
byte_sent_stats
"
,
CONNECTION_STATS
=
"
StatsReport.
connection_stats
"
,
BYTE_SENT_STATS
=
"
StatsReport.
byte_sent_stats
"
,
}
export
type
TrackID
=
string
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment