Skip to content
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

Initial implementation of WebRTC Provider cluster (Phase I) #37767

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d2b2d73
Initial implementation of WebRTC Provider cluster
yufengwangca Feb 18, 2025
9ef70eb
Fix link error
yufengwangca Feb 25, 2025
8d76698
Address review comments
yufengwangca Feb 25, 2025
da00c2e
Report Attribute Change
yufengwangca Feb 26, 2025
f025e29
Address review comments
yufengwangca Feb 27, 2025
e2b5b32
Update src/app/clusters/webrtc-transport-provider-server/webrtc-trans…
yufengwangca Feb 27, 2025
091da55
Simplify status result check
yufengwangca Feb 27, 2025
1806945
Update src/app/clusters/webrtc-transport-provider-server/webrtc-trans…
yufengwangca Feb 28, 2025
806bc6a
Update scripts/tools/check_includes_config.py
yufengwangca Feb 28, 2025
5714919
Align with spec update
yufengwangca Feb 28, 2025
4140569
Addree review comments
yufengwangca Mar 2, 2025
3ad6de3
Responds with CONSTRAINT_ERROR status if StreamUsage is not supported
yufengwangca Mar 4, 2025
45a8392
Return ResourceExhausted if validate the stream usage
yufengwangca Mar 4, 2025
eeeacc6
Update src/app/clusters/webrtc-transport-provider-server/webrtc-trans…
yufengwangca Mar 7, 2025
5c9616f
Merge branch 'master' into pr/camera/rtc_provider
yufengwangca Mar 7, 2025
ee2c929
Update src/app/clusters/webrtc-transport-provider-server/webrtc-trans…
yufengwangca Mar 7, 2025
c5af748
restyle
yufengwangca Mar 7, 2025
79a8969
Address review comments
yufengwangca Mar 10, 2025
efded59
Update src/app/clusters/webrtc-transport-provider-server/webrtc-trans…
yufengwangca Mar 11, 2025
aa7532e
Update src/app/clusters/webrtc-transport-provider-server/webrtc-trans…
yufengwangca Mar 11, 2025
a88ca75
Update src/app/clusters/webrtc-transport-provider-server/webrtc-trans…
yufengwangca Mar 11, 2025
f990ac6
Update src/app/clusters/webrtc-transport-provider-server/webrtc-trans…
yufengwangca Mar 11, 2025
b4d262d
Update src/app/clusters/webrtc-transport-provider-server/webrtc-trans…
yufengwangca Mar 11, 2025
5239c8d
Address review comments
yufengwangca Mar 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 132 additions & 0 deletions examples/camera-app/camera-common/camera-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2119,6 +2119,121 @@ cluster UserLabel = 65 {
readonly attribute int16u clusterRevision = 65533;
}

/** The WebRTC transport provider cluster provides a way for stream providers (e.g. Cameras) to stream or receive their data through WebRTC. */
provisional cluster WebRTCTransportProvider = 1363 {
revision 1;

enum StreamUsageEnum : enum8 {
kInternal = 0;
kRecording = 1;
kAnalysis = 2;
kLiveView = 3;
}

enum WebRTCEndReasonEnum : enum8 {
kIceFailed = 0;
kIceTimeout = 1;
kUserHangup = 2;
kUserBusy = 3;
kReplaced = 4;
kNoUserMedia = 5;
kInviteTimeout = 6;
kAnsweredElsewhere = 7;
kOutOfResources = 8;
kMediaTimeout = 9;
kLowPower = 10;
kUnknownReason = 11;
}

bitmap WebRTCMetadataOptionsBitmap : bitmap8 {
kDataTLV = 0x1;
}

struct ICEServerStruct {
char_string urls[] = 1;
optional char_string username = 2;
optional char_string credential = 3;
optional int16u caid = 4;
}

fabric_scoped struct WebRTCSessionStruct {
int16u id = 1;
node_id peerNodeID = 2;
StreamUsageEnum streamUsage = 3;
nullable int16u videoStreamID = 4;
nullable int16u audioStreamID = 5;
WebRTCMetadataOptionsBitmap metadataOptions = 6;
fabric_idx fabricIndex = 254;
}

readonly attribute access(read: manage) WebRTCSessionStruct currentSessions[] = 0;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
readonly attribute attrib_id attributeList[] = 65531;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;

request struct SolicitOfferRequest {
StreamUsageEnum streamUsage = 0;
optional nullable int16u videoStreamID = 1;
optional nullable int16u audioStreamID = 2;
optional ICEServerStruct ICEServers[] = 3;
optional char_string ICETransportPolicy = 4;
optional WebRTCMetadataOptionsBitmap metadataOptions = 5;
}

response struct SolicitOfferResponse = 2 {
int16u webRTCSessionID = 0;
boolean deferredOffer = 1;
optional nullable int16u videoStreamID = 2;
optional nullable int16u audioStreamID = 3;
}

request struct ProvideOfferRequest {
nullable int16u webRTCSessionID = 0;
char_string sdp = 1;
StreamUsageEnum streamUsage = 2;
optional nullable int16u videoStreamID = 3;
optional nullable int16u audioStreamID = 4;
optional ICEServerStruct ICEServers[] = 5;
optional char_string ICETransportPolicy = 6;
optional WebRTCMetadataOptionsBitmap metadataOptions = 7;
}

response struct ProvideOfferResponse = 4 {
int16u webRTCSessionID = 0;
optional nullable int16u videoStreamID = 1;
optional nullable int16u audioStreamID = 2;
}

request struct ProvideAnswerRequest {
int16u webRTCSessionID = 0;
char_string sdp = 1;
}

request struct ProvideICECandidatesRequest {
int16u webRTCSessionID = 0;
char_string ICECandidates[] = 1;
}

request struct EndSessionRequest {
int16u webRTCSessionID = 0;
WebRTCEndReasonEnum reason = 1;
}

/** Requests that the Provider initiates a new session with the Offer / Answer flow in a way that allows for options to be passed and work with devices needing the standby flow. */
fabric command SolicitOffer(SolicitOfferRequest): SolicitOfferResponse = 1;
/** This command allows an SDP Offer to be set and start a new session. */
fabric command ProvideOffer(ProvideOfferRequest): ProvideOfferResponse = 3;
/** This command SHALL be initiated from a Node in response to an Offer that was previously received from a remote peer. */
fabric command ProvideAnswer(ProvideAnswerRequest): DefaultSuccess = 5;
/** This command allows for string based https://rfc-editor.org/rfc/rfc8839#section-5.1 generated after the initial Offer / Answer exchange, via a JSEP https://datatracker.ietf.org/doc/html/rfc9429#section-4.1.20 event, a DOM https://www.w3.org/TR/webrtc/#dom-rtcpeerconnectioniceevent event, or other WebRTC compliant implementations, to be added to a session during the gathering phase. */
fabric command ProvideICECandidates(ProvideICECandidatesRequest): DefaultSuccess = 6;
/** This command instructs the stream provider to end the WebRTC session. */
fabric command EndSession(EndSessionRequest): DefaultSuccess = 7;
}

/** This cluster provides facilities to configure and play Chime sounds, such as those used in a doorbell. */
provisional cluster Chime = 1366 {
revision 1;
Expand Down Expand Up @@ -2581,6 +2696,23 @@ endpoint 1 {
handle command SetDefaultNTP;
}

server cluster WebRTCTransportProvider {
callback attribute currentSessions;
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute attributeList;
ram attribute featureMap default = 0;
ram attribute clusterRevision default = 1;

handle command SolicitOffer;
handle command SolicitOfferResponse;
handle command ProvideOffer;
handle command ProvideOfferResponse;
handle command ProvideAnswer;
handle command ProvideICECandidates;
handle command EndSession;
}

server cluster Chime {
callback attribute installedChimeSounds;
callback attribute activeChimeID;
Expand Down
179 changes: 172 additions & 7 deletions examples/camera-app/camera-common/camera-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -4619,7 +4619,7 @@
"deviceIdentifiers": [
322
],
"deviceTypeName": "MA-rootdevice",
"deviceTypeName": "MA-camera",
"deviceTypeCode": 322,
"deviceTypeProfileId": 259,
"clusters": [
Expand Down Expand Up @@ -5293,6 +5293,171 @@
}
]
},
{
"name": "WebRTC Transport Provider",
"code": 1363,
"mfgCode": null,
"define": "WEB_RTC_TRANSPORT_PROVIDER_CLUSTER",
"side": "server",
"enabled": 1,
"apiMaturity": "provisional",
"commands": [
{
"name": "SolicitOffer",
"code": 1,
"mfgCode": null,
"source": "client",
"isIncoming": 1,
"isEnabled": 1
},
{
"name": "SolicitOfferResponse",
"code": 2,
"mfgCode": null,
"source": "server",
"isIncoming": 0,
"isEnabled": 1
},
{
"name": "ProvideOffer",
"code": 3,
"mfgCode": null,
"source": "client",
"isIncoming": 1,
"isEnabled": 1
},
{
"name": "ProvideOfferResponse",
"code": 4,
"mfgCode": null,
"source": "server",
"isIncoming": 0,
"isEnabled": 1
},
{
"name": "ProvideAnswer",
"code": 5,
"mfgCode": null,
"source": "client",
"isIncoming": 1,
"isEnabled": 1
},
{
"name": "ProvideICECandidates",
"code": 6,
"mfgCode": null,
"source": "client",
"isIncoming": 1,
"isEnabled": 1
},
{
"name": "EndSession",
"code": 7,
"mfgCode": null,
"source": "client",
"isIncoming": 1,
"isEnabled": 1
}
],
"attributes": [
{
"name": "CurrentSessions",
"code": 0,
"mfgCode": null,
"side": "server",
"type": "array",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "GeneratedCommandList",
"code": 65528,
"mfgCode": null,
"side": "server",
"type": "array",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "AcceptedCommandList",
"code": 65529,
"mfgCode": null,
"side": "server",
"type": "array",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "AttributeList",
"code": 65531,
"mfgCode": null,
"side": "server",
"type": "array",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "FeatureMap",
"code": 65532,
"mfgCode": null,
"side": "server",
"type": "bitmap32",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "ClusterRevision",
"code": 65533,
"mfgCode": null,
"side": "server",
"type": "int16u",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "1",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
}
]
},
{
"name": "Chime",
"code": 1366,
Expand Down Expand Up @@ -5322,7 +5487,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"defaultValue": null,
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand All @@ -5338,7 +5503,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"defaultValue": null,
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand All @@ -5354,7 +5519,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"defaultValue": null,
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand All @@ -5370,7 +5535,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"defaultValue": null,
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand All @@ -5386,7 +5551,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"defaultValue": null,
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand All @@ -5402,7 +5567,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"defaultValue": null,
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down
2 changes: 2 additions & 0 deletions scripts/tools/check_includes_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@
'src/app/clusters/media-input-server/media-input-delegate.h': {'list'},
'src/app/clusters/media-playback-server/media-playback-delegate.h': {'list'},
'src/app/clusters/target-navigator-server/target-navigator-delegate.h': {'list'},
# WebRTCTransportProvider is for Camera and is intended to run on devices that are capable of handling these types.
'src/app/clusters/webrtc-transport-provider-server/webrtc-transport-provider-server.h': {'string', 'vector'},

'src/credentials/attestation_verifier/FileAttestationTrustStore.h': {'vector'},
'src/credentials/attestation_verifier/FileAttestationTrustStore.cpp': {'string'},
Expand Down
Loading
Loading