Skip to content

Commit c8c9df0

Browse files
committed
Add support for muting in VoIP calls
As per MSC3291. Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
1 parent 575c84d commit c8c9df0

File tree

4 files changed

+74
-7
lines changed

4 files changed

+74
-7
lines changed

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

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,16 +174,34 @@ 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.
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.
178179

179180
`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:
181+
to metadata about that stream. Currently three properties are defined for the
182+
metadata: `purpose`, `audio_muted` and `video_muted`.
183+
184+
`purpose` should be a string indicating the purpose of the stream. The following
185+
`purpose`s are defined:
183186

184187
* `m.usermedia` - stream that contains the webcam and/or microphone tracks
185188
* `m.screenshare` - stream with the screen-sharing tracks
186189

190+
`audio_muted` and `video_muted` are booleans that indicate whether the audio and
191+
video tracks in the stream are muted, respectively. All tracks should be assumed
192+
unmuted unless specified otherwise.
193+
194+
Clients are recommended to not mute the audio of WebRTC tracks locally when an
195+
incoming stream has the `audio_muted` field set to `true`. This is because when
196+
the other user unmutes themselves, there may be a slight delay between their
197+
client sending audio and the [`m.call.sdp_stream_metadata_changed`](/client-server-api/#mcallsdp_stream_metadata_changed)
198+
event arriving and any audio sent in between will not be heard. The other user
199+
will still stop transmitting audio once they mute on their side, so no audio is
200+
sent without the user's knowledge.
201+
202+
The same suggestion does not apply to `video_muted`. Clients _should_ mute video
203+
locally, so that the receiving side doesn't see a black video.
204+
187205
If `sdp_stream_metadata` is present and an incoming stream is not listed in it,
188206
the stream should be ignored. If a stream has a `purpose` of an unknown type, it
189207
should also be ignored.
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: 15 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,17 @@ 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+
video_muted:
33+
type: boolean
34+
description: |-
35+
Whether the video track in the stream is muted.
36+
37+
Defaults to `false` if not present.
2638
required:
27-
- purpose
39+
- 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.10"
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)