fix: refactor signaler; fix logic for local watcher

This commit is contained in:
Charles Hathaway
2023-09-21 21:50:13 -07:00
parent 9bbe917e59
commit 7fbd4fff69
8 changed files with 920 additions and 1076 deletions
+22 -31
View File
@@ -11,23 +11,17 @@ service SignalerService {
// Optionally, wait_for_update can be set to prevent returning until the Camera has seen the
// session request, populated candidates, and returned a session offer.
rpc CreateSession(CreateSessionRequest) returns (Session);
// UpdateSession updates the session
rpc UpdateSession(UpdateSessionRequest) returns (Session);
// ListSessions lists all sessions the client should consider.
// PopSession deletes a session from the list of sessions, and returns it.
//
// TODO: it would be better if we could alert a camera to poll for sessions
// i.e., with websockets (or streaming RPCs).
rpc ListSessions(ListSessionsRequest) returns (ListSessionsResponse);
// If there are no sessions, this blocks until one becomes available.
rpc PopSession(PopSessionRequest) returns (Session);
// CreateIceCandidate adds the provided candidate to the list of candidates.
rpc CreateIceCandidate(CreateIceCandidateRequest) returns (IceCandidate);
// PopIceCandidate delete a candidate from the list of candidates and returns it.
// CreateIceMessage adds the provided message to the list of candidates.
rpc CreateIceMessage(CreateIceMessageRequest) returns (IceMessage);
// PopIceCandidate delete a message from the list of messages and returns it.
//
// If there are no candidates, this blocks until one becomes available.
rpc PopIceCandidate(PopIceCandidateRequest) returns (IceCandidate);
rpc CreateIceSessionDescription(CreateIceSessionDescriptionRequest) returns (IceSessionDescription);
rpc PopIceSessionDescription(PopIceSessionDescriptionRequest) returns (IceSessionDescription);
// If there are no messages, this blocks until one becomes available.
rpc PopIceMessage(PopIceMessageRequest) returns (IceMessage);
}
@@ -63,6 +57,10 @@ message CreateSessionRequest {
bool wait_for_update = 2;
}
message PopSessionRequest {
Session session = 1;
}
message UpdateSessionRequest {
Session session = 1;
@@ -78,21 +76,12 @@ message ListSessionsResponse {
repeated Session sessions = 1;
}
message CreateIceCandidateRequest {
message CreateIceMessageRequest {
Session.Identifier session_identifier = 1;
IceCandidate candidate = 2;
IceMessage ice_message = 2;
}
message PopIceCandidateRequest {
Session.Identifier session_identifier = 1;
}
message CreateIceSessionDescriptionRequest {
Session.Identifier session_identifier = 1;
IceSessionDescription description = 2;
}
message PopIceSessionDescriptionRequest {
message PopIceMessageRequest {
Session.Identifier session_identifier = 1;
}
@@ -103,6 +92,13 @@ message Camera {
Identifier identifier = 1;
}
message IceMessage {
oneof type {
IceCandidate candidate = 1;
IceSessionDescription session = 2;
}
}
message IceCandidate {
// Copied from https://pkg.go.dev/github.com/pion/webrtc/v4#ICECandidateInit
string candidate = 1;
@@ -123,11 +119,6 @@ message Session {
}
Identifier id = 1;
Camera.Identifier camera = 2;
repeated IceCandidate client_ice_candidates = 3;
repeated IceCandidate camera_ice_candidates = 4;
IceSessionDescription camera_offer = 5;
IceSessionDescription client_answer = 6;
}
message AuthToken {