Skip to content

Commit 641faf2

Browse files
SimonBrandnertulirdbkranoadragon453richvdh
authored andcommitted
MSC3077: Support for multi-stream VoIP (#3077)
* Draft of multi-stream MSC Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * Remove unnecessary article and don't use CamelCase Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * Fix naming and MSC number Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * Make it prefixy Co-authored-by: Tulir Asokan <tulir@maunium.net> * Be more descriptive about keys Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * Add more info about usermedia and screenshare Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * Simplifie backwards compatibility I would be tempted to skip the capability advertisement for this and just say that the absence of stream metadata means clients just take the first or whatever MSC2746 says. I can't think of anything the capability advertisement caters for specifically? - Dave Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * Reword parts of backwards compatibility section Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * Improve explanation of backwards compatibility Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * Add missing spaces to unstable perifix table Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * Remove support for stream-replacement Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * Apply suggestions from code review Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> * Fix concerns Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * Link to specific spec version Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> * Be more readable Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> * Clarify Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> * Don't ref non-existing thing Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> * Remove confusing words --------- Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> Co-authored-by: Tulir Asokan <tulir@maunium.net> Co-authored-by: David Baker <dbkr@users.noreply.github.com> Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
1 parent 08b3b62 commit 641faf2

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# MSC3077: Support for multi-stream VoIP
2+
3+
This MSC proposes a method for differentiating WebRTC streams from each other.
4+
5+
[MSC2746](https://github.com/matrix-org/matrix-doc/pull/2746) has improved VoIP
6+
immeasurably. Yet, there is still no clear way to handle things such as
7+
screen-sharing.
8+
9+
Simple VoIP calls only ever feature one stream, though often clients will want
10+
to send multiple - usermedia, screensharing and possibly more. In a situation
11+
with more streams, it can be very helpful to provide the other side with
12+
metadata about the content of the streams.
13+
14+
## Proposal
15+
16+
This MSC proposes adding an `sdp_stream_metadata` field to the events containing
17+
a session description i.e.:
18+
19+
+ [`m.call.invite`](https://spec.matrix.org/v1.7/client-server-api/#mcallinvite)
20+
+ [`m.call.answer`](https://spec.matrix.org/v1.7/client-server-api/#mcallanswer)
21+
+ [`m.call.negotiate`](https://spec.matrix.org/v1.7/client-server-api/#mcallnegotiate)
22+
23+
The `sdp_stream_metadata` field is an object in which each key is one stream
24+
`id` in the session description. The values are objects with the
25+
following fields:
26+
27+
+ `purpose` - a string indicating the purpose of the stream. For compatibility
28+
between client the following values are defined:
29+
+ `m.usermedia` - stream that contains the webcam and/or microphone tracks
30+
+ `m.screenshare` - stream with the screen-sharing tracks
31+
32+
### Example
33+
34+
```JSON
35+
{
36+
"type": "m.call.invite",
37+
"room_id": "!roomId",
38+
"content": {
39+
"call_id": "1414213562373095",
40+
"invitee": "@bob:matrix.org",
41+
"party_id": "1732050807568877",
42+
"lifetime": "60000",
43+
"capabilities": {
44+
"m.call.transferee": true,
45+
},
46+
"offer": {
47+
"sdp": "...",
48+
"type": "offer",
49+
},
50+
"sdp_stream_metadata": {
51+
"271828182845": {
52+
"purpose": "m.screenshare",
53+
},
54+
"314159265358": {
55+
"purpose": "m.usermedia",
56+
},
57+
},
58+
"version": "1",
59+
},
60+
}
61+
```
62+
63+
### Edge cases
64+
65+
+ If an incoming stream is not described in `sdp_stream_metadata` and
66+
`sdp_stream_metadata` is present, the stream should be ignored.
67+
+ If a stream has a `purpose` of an unknown type (i.e. not `m.usermedia` or
68+
`m.screenshare`), it should be ignored.
69+
70+
### Backwards compatibility
71+
72+
During the initial invite and answer exchange clients find out if the field
73+
`sdp_stream_metadata` is missing. If it is not present in the event sent by the
74+
opponent, the client should ignore any new incoming streams (i.e. it should use
75+
the first one) and it shouldn't send more than one stream (i.e. clients cannot send a video feed and a screenshare at the same time, as is the case in current clients).
76+
77+
## Alternatives
78+
79+
Setting the stream `id`s to custom values had been considered. Though this is
80+
possible on some platforms, it is not in browsers. That is because the `id`
81+
property of `MediaStream` is _read-only_ as the [MDN Documentation
82+
states](https://developer.mozilla.org/en-US/docs/Web/API/MediaStream/id).
83+
Similar is true for SDP attributes.
84+
85+
This proposal is also more practical for cases where more complex metadata is
86+
needed. For conferencing, a `user_id` field could be added to
87+
the objects in `sdp_stream_metadata`; for differentiating between the front and rear camera of a
88+
phone, a `camera_type` field could be added.
89+
90+
Previously, it has been thought that the `purpose` field has to be unique (or
91+
another unique field has to be added), though this could only ever be important
92+
if we wanted to replace a stream with another one in-place. It was deemed as a
93+
rather uncommon thing for which there doesn't seem to be any use-case, so
94+
uniqueness is not required.
95+
96+
## Unstable prefix
97+
98+
During development, the following fields should be used:
99+
100+
|Release |Development |
101+
|----------------------------|-----------------------------------------------|
102+
|`sdp_stream_metadata` |`org.matrix.msc3077.sdp_stream_metadata` |
103+
|`m.call.sdp_stream_metadata`|`org.matrix.msc3077.call.sdp_stream_metadata` |
104+
105+
## Potential issues
106+
107+
None that I can think of.
108+
109+
## Security considerations
110+
111+
None that I can think of.

0 commit comments

Comments
 (0)