Skip to content

Commit eb7ac35

Browse files
authored
Add support for muting in VoIP calls (#1755)
As per MSC3291. Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
1 parent c25ff9e commit eb7ac35

File tree

5 files changed

+68
-12
lines changed

5 files changed

+68
-12
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add support for muting in VoIP calls, as per [MSC3291](https://github.com/matrix-org/matrix-spec-proposals/pull/3291).

content/client-server-api/modules/voip_events.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,19 @@ In response to an incoming invite, a client may do one of several things:
174174
Clients may send more than one stream in a VoIP call. The streams should be
175175
differentiated by including metadata in the [`m.call.invite`](/client-server-api/#mcallinvite),
176176
[`m.call.answer`](/client-server-api/#mcallanswer) and [`m.call.negotiate`](/client-server-api/#mcallnegotiate)
177-
events, using the `sdp_stream_metadata` property.
178-
179-
`sdp_stream_metadata` maps from the `id` of a stream in the session description,
180-
to metadata about that stream. Currently only one property is defined for the
181-
metadata. This is `purpose`, which should be a string indicating the purpose of
182-
the stream. The following `purpose`s are defined:
183-
184-
* `m.usermedia` - stream that contains the webcam and/or microphone tracks
185-
* `m.screenshare` - stream with the screen-sharing tracks
177+
events, using the `sdp_stream_metadata` property. An [`m.call.sdp_stream_metadata_changed`](/client-server-api/#mcallsdp_stream_metadata_changed)
178+
event can be sent when the metadata changes but no negotiation is required.
179+
180+
Clients are recommended to not mute the audio of WebRTC tracks locally when an
181+
incoming stream has the `audio_muted` field set to `true`. This is because when
182+
the other user unmutes themselves, there may be a slight delay between their
183+
client sending audio and the [`m.call.sdp_stream_metadata_changed`](/client-server-api/#mcallsdp_stream_metadata_changed)
184+
event arriving and any audio sent in between will not be heard. The other user
185+
will still stop transmitting audio once they mute on their side, so no audio is
186+
sent without the user's knowledge.
187+
188+
The same suggestion does not apply to `video_muted`. Clients _should_ mute video
189+
locally, so that the receiving side doesn't see a black video.
186190

187191
If `sdp_stream_metadata` is present and an incoming stream is not listed in it,
188192
the stream should be ignored. If a stream has a `purpose` of an unknown type, it
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$ref": "core/room_event.json",
3+
"type": "m.call.sdp_stream_metadata_changed",
4+
"content": {
5+
"version": "1",
6+
"call_id": "1414213562373095",
7+
"party_id": "1732050807568877",
8+
"sdp_stream_metadata": {
9+
"2311546231": {
10+
"purpose": "m.usermedia",
11+
"audio_muted:": true,
12+
"video_muted": true
13+
}
14+
}
15+
}
16+
}

data/event-schemas/schema/components/sdp_stream_metadata.yaml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ additionalProperties:
1313
purpose:
1414
type: string
1515
enum:
16-
- m.usermedia
17-
- m.screenshare
16+
- m.usermedia
17+
- m.screenshare
1818
description: |-
1919
The purpose of the stream.
2020
@@ -23,5 +23,19 @@ additionalProperties:
2323
* `m.usermedia`: Stream that contains the webcam and/or microphone
2424
tracks.
2525
* `m.screenshare`: Stream with the screen-sharing tracks.
26+
audio_muted:
27+
type: boolean
28+
description: |-
29+
Whether the audio track in the stream is muted.
30+
31+
Defaults to `false` if not present.
32+
x-addedInMatrixVersion: "1.11"
33+
video_muted:
34+
type: boolean
35+
description: |-
36+
Whether the video track in the stream is muted.
37+
38+
Defaults to `false` if not present.
39+
x-addedInMatrixVersion: "1.11"
2640
required:
27-
- purpose
41+
- purpose
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
type: object
2+
x-addedInMatrixVersion: "1.11"
3+
description: |-
4+
This event is sent by callers when they wish to update a stream's metadata
5+
but no negotiation is required.
6+
allOf:
7+
- $ref: core-event-schema/room_event.yaml
8+
properties:
9+
content:
10+
type: object
11+
allOf:
12+
- $ref: core-event-schema/call_event.yaml
13+
properties:
14+
sdp_stream_metadata:
15+
$ref: components/sdp_stream_metadata.yaml
16+
required:
17+
- sdp_stream_metadata
18+
type:
19+
type: string
20+
enum:
21+
- m.call.sdp_stream_metadata_changed

0 commit comments

Comments
 (0)