From 0a5e4da6afbee0b96cd0a35d1b3124a6e2245ae3 Mon Sep 17 00:00:00 2001 From: Anunay Maheshwari Date: Thu, 11 Sep 2025 04:23:38 +0530 Subject: [PATCH] feat: add server rpc apis (#1191) * feat: add server rpc apis * generated protobuf * fix: update rpc fakes --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- livekit/livekit_room.pb.go | 220 ++++++-- livekit/livekit_room.twirp.go | 468 ++++++++++++++---- protobufs/livekit_room.proto | 15 + protobufs/rpc/participant.proto | 10 + rpc/participant.pb.go | 37 +- rpc/participant.psrpc.go | 68 ++- rpc/rpcfakes/fake_typed_participant_client.go | 85 ++++ .../fake_typed_whipparticipant_client.go | 325 ++++++++++++ 8 files changed, 1056 insertions(+), 172 deletions(-) create mode 100644 rpc/rpcfakes/fake_typed_whipparticipant_client.go diff --git a/livekit/livekit_room.pb.go b/livekit/livekit_room.pb.go index ff28602..5f6ca02 100644 --- a/livekit/livekit_room.pb.go +++ b/livekit/livekit_room.pb.go @@ -1470,6 +1470,126 @@ func (*MoveParticipantResponse) Descriptor() ([]byte, []int) { return file_livekit_room_proto_rawDescGZIP(), []int{23} } +type PerformRpcRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Room string `protobuf:"bytes,1,opt,name=room,proto3" json:"room,omitempty"` + DestinationIdentity string `protobuf:"bytes,2,opt,name=destination_identity,json=destinationIdentity,proto3" json:"destination_identity,omitempty"` + Method string `protobuf:"bytes,3,opt,name=method,proto3" json:"method,omitempty"` + Payload string `protobuf:"bytes,4,opt,name=payload,proto3" json:"payload,omitempty"` + ResponseTimeoutMs uint32 `protobuf:"varint,5,opt,name=response_timeout_ms,json=responseTimeoutMs,proto3" json:"response_timeout_ms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PerformRpcRequest) Reset() { + *x = PerformRpcRequest{} + mi := &file_livekit_room_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PerformRpcRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PerformRpcRequest) ProtoMessage() {} + +func (x *PerformRpcRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_room_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PerformRpcRequest.ProtoReflect.Descriptor instead. +func (*PerformRpcRequest) Descriptor() ([]byte, []int) { + return file_livekit_room_proto_rawDescGZIP(), []int{24} +} + +func (x *PerformRpcRequest) GetRoom() string { + if x != nil { + return x.Room + } + return "" +} + +func (x *PerformRpcRequest) GetDestinationIdentity() string { + if x != nil { + return x.DestinationIdentity + } + return "" +} + +func (x *PerformRpcRequest) GetMethod() string { + if x != nil { + return x.Method + } + return "" +} + +func (x *PerformRpcRequest) GetPayload() string { + if x != nil { + return x.Payload + } + return "" +} + +func (x *PerformRpcRequest) GetResponseTimeoutMs() uint32 { + if x != nil { + return x.ResponseTimeoutMs + } + return 0 +} + +type PerformRpcResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Payload string `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PerformRpcResponse) Reset() { + *x = PerformRpcResponse{} + mi := &file_livekit_room_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PerformRpcResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PerformRpcResponse) ProtoMessage() {} + +func (x *PerformRpcResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_room_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PerformRpcResponse.ProtoReflect.Descriptor instead. +func (*PerformRpcResponse) Descriptor() ([]byte, []int) { + return file_livekit_room_proto_rawDescGZIP(), []int{25} +} + +func (x *PerformRpcResponse) GetPayload() string { + if x != nil { + return x.Payload + } + return "" +} + var File_livekit_room_proto protoreflect.FileDescriptor const file_livekit_room_proto_rawDesc = "" + @@ -1578,7 +1698,15 @@ const file_livekit_room_proto_rawDesc = "" + "\x04room\x18\x01 \x01(\tR\x04room\x12\x1a\n" + "\bidentity\x18\x02 \x01(\tR\bidentity\x12)\n" + "\x10destination_room\x18\x03 \x01(\tR\x0fdestinationRoom\"\x19\n" + - "\x17MoveParticipantResponse2\x9b\b\n" + + "\x17MoveParticipantResponse\"\xbc\x01\n" + + "\x11PerformRpcRequest\x12\x12\n" + + "\x04room\x18\x01 \x01(\tR\x04room\x121\n" + + "\x14destination_identity\x18\x02 \x01(\tR\x13destinationIdentity\x12\x16\n" + + "\x06method\x18\x03 \x01(\tR\x06method\x12\x18\n" + + "\apayload\x18\x04 \x01(\tR\apayload\x12.\n" + + "\x13response_timeout_ms\x18\x05 \x01(\rR\x11responseTimeoutMs\".\n" + + "\x12PerformRpcResponse\x12\x18\n" + + "\apayload\x18\x01 \x01(\tR\apayload2\xe2\b\n" + "\vRoomService\x127\n" + "\n" + "CreateRoom\x12\x1a.livekit.CreateRoomRequest\x1a\r.livekit.Room\x12B\n" + @@ -1594,7 +1722,9 @@ const file_livekit_room_proto_rawDesc = "" + "\bSendData\x12\x18.livekit.SendDataRequest\x1a\x19.livekit.SendDataResponse\x12G\n" + "\x12UpdateRoomMetadata\x12\".livekit.UpdateRoomMetadataRequest\x1a\r.livekit.Room\x12]\n" + "\x12ForwardParticipant\x12\".livekit.ForwardParticipantRequest\x1a#.livekit.ForwardParticipantResponse\x12T\n" + - "\x0fMoveParticipant\x12\x1f.livekit.MoveParticipantRequest\x1a .livekit.MoveParticipantResponseBFZ#github.com/livekit/protocol/livekit\xaa\x02\rLiveKit.Proto\xea\x02\x0eLiveKit::Protob\x06proto3" + "\x0fMoveParticipant\x12\x1f.livekit.MoveParticipantRequest\x1a .livekit.MoveParticipantResponse\x12E\n" + + "\n" + + "PerformRpc\x12\x1a.livekit.PerformRpcRequest\x1a\x1b.livekit.PerformRpcResponseBFZ#github.com/livekit/protocol/livekit\xaa\x02\rLiveKit.Proto\xea\x02\x0eLiveKit::Protob\x06proto3" var ( file_livekit_room_proto_rawDescOnce sync.Once @@ -1608,7 +1738,7 @@ func file_livekit_room_proto_rawDescGZIP() []byte { return file_livekit_room_proto_rawDescData } -var file_livekit_room_proto_msgTypes = make([]protoimpl.MessageInfo, 25) +var file_livekit_room_proto_msgTypes = make([]protoimpl.MessageInfo, 27) var file_livekit_room_proto_goTypes = []any{ (*CreateRoomRequest)(nil), // 0: livekit.CreateRoomRequest (*RoomEgress)(nil), // 1: livekit.RoomEgress @@ -1634,34 +1764,36 @@ var file_livekit_room_proto_goTypes = []any{ (*ForwardParticipantResponse)(nil), // 21: livekit.ForwardParticipantResponse (*MoveParticipantRequest)(nil), // 22: livekit.MoveParticipantRequest (*MoveParticipantResponse)(nil), // 23: livekit.MoveParticipantResponse - nil, // 24: livekit.UpdateParticipantRequest.AttributesEntry - (*RoomAgentDispatch)(nil), // 25: livekit.RoomAgentDispatch - (*RoomCompositeEgressRequest)(nil), // 26: livekit.RoomCompositeEgressRequest - (*AutoParticipantEgress)(nil), // 27: livekit.AutoParticipantEgress - (*AutoTrackEgress)(nil), // 28: livekit.AutoTrackEgress - (*Room)(nil), // 29: livekit.Room - (*ParticipantInfo)(nil), // 30: livekit.ParticipantInfo - (*TrackInfo)(nil), // 31: livekit.TrackInfo - (*ParticipantPermission)(nil), // 32: livekit.ParticipantPermission - (*ParticipantTracks)(nil), // 33: livekit.ParticipantTracks - (DataPacket_Kind)(0), // 34: livekit.DataPacket.Kind + (*PerformRpcRequest)(nil), // 24: livekit.PerformRpcRequest + (*PerformRpcResponse)(nil), // 25: livekit.PerformRpcResponse + nil, // 26: livekit.UpdateParticipantRequest.AttributesEntry + (*RoomAgentDispatch)(nil), // 27: livekit.RoomAgentDispatch + (*RoomCompositeEgressRequest)(nil), // 28: livekit.RoomCompositeEgressRequest + (*AutoParticipantEgress)(nil), // 29: livekit.AutoParticipantEgress + (*AutoTrackEgress)(nil), // 30: livekit.AutoTrackEgress + (*Room)(nil), // 31: livekit.Room + (*ParticipantInfo)(nil), // 32: livekit.ParticipantInfo + (*TrackInfo)(nil), // 33: livekit.TrackInfo + (*ParticipantPermission)(nil), // 34: livekit.ParticipantPermission + (*ParticipantTracks)(nil), // 35: livekit.ParticipantTracks + (DataPacket_Kind)(0), // 36: livekit.DataPacket.Kind } var file_livekit_room_proto_depIdxs = []int32{ 1, // 0: livekit.CreateRoomRequest.egress:type_name -> livekit.RoomEgress - 25, // 1: livekit.CreateRoomRequest.agents:type_name -> livekit.RoomAgentDispatch - 26, // 2: livekit.RoomEgress.room:type_name -> livekit.RoomCompositeEgressRequest - 27, // 3: livekit.RoomEgress.participant:type_name -> livekit.AutoParticipantEgress - 28, // 4: livekit.RoomEgress.tracks:type_name -> livekit.AutoTrackEgress - 25, // 5: livekit.RoomAgent.dispatches:type_name -> livekit.RoomAgentDispatch - 29, // 6: livekit.ListRoomsResponse.rooms:type_name -> livekit.Room - 30, // 7: livekit.ListParticipantsResponse.participants:type_name -> livekit.ParticipantInfo - 31, // 8: livekit.MuteRoomTrackResponse.track:type_name -> livekit.TrackInfo - 32, // 9: livekit.UpdateParticipantRequest.permission:type_name -> livekit.ParticipantPermission - 24, // 10: livekit.UpdateParticipantRequest.attributes:type_name -> livekit.UpdateParticipantRequest.AttributesEntry - 33, // 11: livekit.UpdateSubscriptionsRequest.participant_tracks:type_name -> livekit.ParticipantTracks - 34, // 12: livekit.SendDataRequest.kind:type_name -> livekit.DataPacket.Kind + 27, // 1: livekit.CreateRoomRequest.agents:type_name -> livekit.RoomAgentDispatch + 28, // 2: livekit.RoomEgress.room:type_name -> livekit.RoomCompositeEgressRequest + 29, // 3: livekit.RoomEgress.participant:type_name -> livekit.AutoParticipantEgress + 30, // 4: livekit.RoomEgress.tracks:type_name -> livekit.AutoTrackEgress + 27, // 5: livekit.RoomAgent.dispatches:type_name -> livekit.RoomAgentDispatch + 31, // 6: livekit.ListRoomsResponse.rooms:type_name -> livekit.Room + 32, // 7: livekit.ListParticipantsResponse.participants:type_name -> livekit.ParticipantInfo + 33, // 8: livekit.MuteRoomTrackResponse.track:type_name -> livekit.TrackInfo + 34, // 9: livekit.UpdateParticipantRequest.permission:type_name -> livekit.ParticipantPermission + 26, // 10: livekit.UpdateParticipantRequest.attributes:type_name -> livekit.UpdateParticipantRequest.AttributesEntry + 35, // 11: livekit.UpdateSubscriptionsRequest.participant_tracks:type_name -> livekit.ParticipantTracks + 36, // 12: livekit.SendDataRequest.kind:type_name -> livekit.DataPacket.Kind 1, // 13: livekit.RoomConfiguration.egress:type_name -> livekit.RoomEgress - 25, // 14: livekit.RoomConfiguration.agents:type_name -> livekit.RoomAgentDispatch + 27, // 14: livekit.RoomConfiguration.agents:type_name -> livekit.RoomAgentDispatch 0, // 15: livekit.RoomService.CreateRoom:input_type -> livekit.CreateRoomRequest 3, // 16: livekit.RoomService.ListRooms:input_type -> livekit.ListRoomsRequest 5, // 17: livekit.RoomService.DeleteRoom:input_type -> livekit.DeleteRoomRequest @@ -1675,21 +1807,23 @@ var file_livekit_room_proto_depIdxs = []int32{ 18, // 25: livekit.RoomService.UpdateRoomMetadata:input_type -> livekit.UpdateRoomMetadataRequest 20, // 26: livekit.RoomService.ForwardParticipant:input_type -> livekit.ForwardParticipantRequest 22, // 27: livekit.RoomService.MoveParticipant:input_type -> livekit.MoveParticipantRequest - 29, // 28: livekit.RoomService.CreateRoom:output_type -> livekit.Room - 4, // 29: livekit.RoomService.ListRooms:output_type -> livekit.ListRoomsResponse - 6, // 30: livekit.RoomService.DeleteRoom:output_type -> livekit.DeleteRoomResponse - 8, // 31: livekit.RoomService.ListParticipants:output_type -> livekit.ListParticipantsResponse - 30, // 32: livekit.RoomService.GetParticipant:output_type -> livekit.ParticipantInfo - 10, // 33: livekit.RoomService.RemoveParticipant:output_type -> livekit.RemoveParticipantResponse - 12, // 34: livekit.RoomService.MutePublishedTrack:output_type -> livekit.MuteRoomTrackResponse - 30, // 35: livekit.RoomService.UpdateParticipant:output_type -> livekit.ParticipantInfo - 15, // 36: livekit.RoomService.UpdateSubscriptions:output_type -> livekit.UpdateSubscriptionsResponse - 17, // 37: livekit.RoomService.SendData:output_type -> livekit.SendDataResponse - 29, // 38: livekit.RoomService.UpdateRoomMetadata:output_type -> livekit.Room - 21, // 39: livekit.RoomService.ForwardParticipant:output_type -> livekit.ForwardParticipantResponse - 23, // 40: livekit.RoomService.MoveParticipant:output_type -> livekit.MoveParticipantResponse - 28, // [28:41] is the sub-list for method output_type - 15, // [15:28] is the sub-list for method input_type + 24, // 28: livekit.RoomService.PerformRpc:input_type -> livekit.PerformRpcRequest + 31, // 29: livekit.RoomService.CreateRoom:output_type -> livekit.Room + 4, // 30: livekit.RoomService.ListRooms:output_type -> livekit.ListRoomsResponse + 6, // 31: livekit.RoomService.DeleteRoom:output_type -> livekit.DeleteRoomResponse + 8, // 32: livekit.RoomService.ListParticipants:output_type -> livekit.ListParticipantsResponse + 32, // 33: livekit.RoomService.GetParticipant:output_type -> livekit.ParticipantInfo + 10, // 34: livekit.RoomService.RemoveParticipant:output_type -> livekit.RemoveParticipantResponse + 12, // 35: livekit.RoomService.MutePublishedTrack:output_type -> livekit.MuteRoomTrackResponse + 32, // 36: livekit.RoomService.UpdateParticipant:output_type -> livekit.ParticipantInfo + 15, // 37: livekit.RoomService.UpdateSubscriptions:output_type -> livekit.UpdateSubscriptionsResponse + 17, // 38: livekit.RoomService.SendData:output_type -> livekit.SendDataResponse + 31, // 39: livekit.RoomService.UpdateRoomMetadata:output_type -> livekit.Room + 21, // 40: livekit.RoomService.ForwardParticipant:output_type -> livekit.ForwardParticipantResponse + 23, // 41: livekit.RoomService.MoveParticipant:output_type -> livekit.MoveParticipantResponse + 25, // 42: livekit.RoomService.PerformRpc:output_type -> livekit.PerformRpcResponse + 29, // [29:43] is the sub-list for method output_type + 15, // [15:29] is the sub-list for method input_type 15, // [15:15] is the sub-list for extension type_name 15, // [15:15] is the sub-list for extension extendee 0, // [0:15] is the sub-list for field type_name @@ -1710,7 +1844,7 @@ func file_livekit_room_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_livekit_room_proto_rawDesc), len(file_livekit_room_proto_rawDesc)), NumEnums: 0, - NumMessages: 25, + NumMessages: 27, NumExtensions: 0, NumServices: 1, }, diff --git a/livekit/livekit_room.twirp.go b/livekit/livekit_room.twirp.go index b777033..7c2035e 100644 --- a/livekit/livekit_room.twirp.go +++ b/livekit/livekit_room.twirp.go @@ -75,6 +75,8 @@ type RoomService interface { // The participant will be removed from the current room and added to the destination room. // From the other observers' perspective, the participant would've disconnected from the previous room and joined the new one. MoveParticipant(context.Context, *MoveParticipantRequest) (*MoveParticipantResponse, error) + + PerformRpc(context.Context, *PerformRpcRequest) (*PerformRpcResponse, error) } // =========================== @@ -83,7 +85,7 @@ type RoomService interface { type roomServiceProtobufClient struct { client HTTPClient - urls [13]string + urls [14]string interceptor twirp.Interceptor opts twirp.ClientOptions } @@ -111,7 +113,7 @@ func NewRoomServiceProtobufClient(baseURL string, client HTTPClient, opts ...twi // Build method URLs: []/./ serviceURL := sanitizeBaseURL(baseURL) serviceURL += baseServicePath(pathPrefix, "livekit", "RoomService") - urls := [13]string{ + urls := [14]string{ serviceURL + "CreateRoom", serviceURL + "ListRooms", serviceURL + "DeleteRoom", @@ -125,6 +127,7 @@ func NewRoomServiceProtobufClient(baseURL string, client HTTPClient, opts ...twi serviceURL + "UpdateRoomMetadata", serviceURL + "ForwardParticipant", serviceURL + "MoveParticipant", + serviceURL + "PerformRpc", } return &roomServiceProtobufClient{ @@ -733,13 +736,59 @@ func (c *roomServiceProtobufClient) callMoveParticipant(ctx context.Context, in return out, nil } +func (c *roomServiceProtobufClient) PerformRpc(ctx context.Context, in *PerformRpcRequest) (*PerformRpcResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "RoomService") + ctx = ctxsetters.WithMethodName(ctx, "PerformRpc") + caller := c.callPerformRpc + if c.interceptor != nil { + caller = func(ctx context.Context, req *PerformRpcRequest) (*PerformRpcResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*PerformRpcRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*PerformRpcRequest) when calling interceptor") + } + return c.callPerformRpc(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*PerformRpcResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*PerformRpcResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *roomServiceProtobufClient) callPerformRpc(ctx context.Context, in *PerformRpcRequest) (*PerformRpcResponse, error) { + out := new(PerformRpcResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[13], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + // ======================= // RoomService JSON Client // ======================= type roomServiceJSONClient struct { client HTTPClient - urls [13]string + urls [14]string interceptor twirp.Interceptor opts twirp.ClientOptions } @@ -767,7 +816,7 @@ func NewRoomServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.C // Build method URLs: []/./ serviceURL := sanitizeBaseURL(baseURL) serviceURL += baseServicePath(pathPrefix, "livekit", "RoomService") - urls := [13]string{ + urls := [14]string{ serviceURL + "CreateRoom", serviceURL + "ListRooms", serviceURL + "DeleteRoom", @@ -781,6 +830,7 @@ func NewRoomServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.C serviceURL + "UpdateRoomMetadata", serviceURL + "ForwardParticipant", serviceURL + "MoveParticipant", + serviceURL + "PerformRpc", } return &roomServiceJSONClient{ @@ -1389,6 +1439,52 @@ func (c *roomServiceJSONClient) callMoveParticipant(ctx context.Context, in *Mov return out, nil } +func (c *roomServiceJSONClient) PerformRpc(ctx context.Context, in *PerformRpcRequest) (*PerformRpcResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "RoomService") + ctx = ctxsetters.WithMethodName(ctx, "PerformRpc") + caller := c.callPerformRpc + if c.interceptor != nil { + caller = func(ctx context.Context, req *PerformRpcRequest) (*PerformRpcResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*PerformRpcRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*PerformRpcRequest) when calling interceptor") + } + return c.callPerformRpc(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*PerformRpcResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*PerformRpcResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *roomServiceJSONClient) callPerformRpc(ctx context.Context, in *PerformRpcRequest) (*PerformRpcResponse, error) { + out := new(PerformRpcResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[13], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + // ========================== // RoomService Server Handler // ========================== @@ -1525,6 +1621,9 @@ func (s *roomServiceServer) ServeHTTP(resp http.ResponseWriter, req *http.Reques case "MoveParticipant": s.serveMoveParticipant(ctx, resp, req) return + case "PerformRpc": + s.servePerformRpc(ctx, resp, req) + return default: msg := fmt.Sprintf("no handler for path %q", req.URL.Path) s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) @@ -3872,6 +3971,186 @@ func (s *roomServiceServer) serveMoveParticipantProtobuf(ctx context.Context, re callResponseSent(ctx, s.hooks) } +func (s *roomServiceServer) servePerformRpc(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.servePerformRpcJSON(ctx, resp, req) + case "application/protobuf": + s.servePerformRpcProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *roomServiceServer) servePerformRpcJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "PerformRpc") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(PerformRpcRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.RoomService.PerformRpc + if s.interceptor != nil { + handler = func(ctx context.Context, req *PerformRpcRequest) (*PerformRpcResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*PerformRpcRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*PerformRpcRequest) when calling interceptor") + } + return s.RoomService.PerformRpc(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*PerformRpcResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*PerformRpcResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *PerformRpcResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *PerformRpcResponse and nil error while calling PerformRpc. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *roomServiceServer) servePerformRpcProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "PerformRpc") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(PerformRpcRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.RoomService.PerformRpc + if s.interceptor != nil { + handler = func(ctx context.Context, req *PerformRpcRequest) (*PerformRpcResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*PerformRpcRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*PerformRpcRequest) when calling interceptor") + } + return s.RoomService.PerformRpc(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*PerformRpcResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*PerformRpcResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *PerformRpcResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *PerformRpcResponse and nil error while calling PerformRpc. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + func (s *roomServiceServer) ServiceDescriptor() ([]byte, int) { return twirpFileDescriptor3, 0 } @@ -3888,91 +4167,98 @@ func (s *roomServiceServer) PathPrefix() string { } var twirpFileDescriptor3 = []byte{ - // 1376 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0x79, 0x6e, 0xdb, 0xc6,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x1c, 0x46, 0x7c, 0x1c, 0x26, 0xcc, 0x28, 0x77, 0x4b, 0xbd, - 0x55, 0x7b, 0x45, 0x10, 0x9f, 0x49, 0x1a, 0xba, 0x03, 0x6d, 0x0f, 0x47, 0x6e, 0xcc, 0x92, 0x18, - 0xa7, 0x40, 0x10, 0xc0, 0x8d, 0x94, 0x31, 0x05, 0xdf, 0x86, 0x0d, 0xdf, 0x7d, 0xe9, 0x70, 0x2a, - 0x19, 0x91, 0xc8, 0x0d, 0x18, 0x35, 0x2a, 0x02, 0xbb, 0xee, 0xbb, 0x2f, 0x07, 0x1a, 0x19, 0x6d, - 0xc1, 0xa5, 0x20, 0xf4, 0xb0, 0x43, 0x3c, 0xa3, 0x2a, 0x2c, 0xab, 0xf3, 0xcf, 0x63, 0x0f, 0x99, - 0xd0, 0xf0, 0x31, 0x73, 0x3d, 0x97, 0xb9, 0x46, 0x4d, 0x70, 0xd2, 0x6f, 0x74, 0x07, 0xea, 0x32, - 0x54, 0x46, 0xbd, 0x5b, 0xea, 0xb5, 0xfa, 0x97, 0x77, 0x55, 0xac, 0x76, 0x79, 0x30, 0x8e, 0x04, - 0xcb, 0x56, 0x10, 0xf4, 0x3f, 0x68, 0xfb, 0x24, 0x70, 0xa2, 0xb1, 0x3b, 0x09, 0x13, 0xe6, 0x78, - 0x78, 0xec, 0x4e, 0x8c, 0x4b, 0xca, 0x1a, 0x12, 0x0c, 0x24, 0xfd, 0x90, 0x93, 0x05, 0x96, 0x1b, - 0x9e, 0xc3, 0x36, 0x32, 0xcb, 0x75, 0xec, 0x2d, 0x58, 0xa1, 0x93, 0x60, 0xe4, 0x50, 0x16, 0x63, - 0xd7, 0xa7, 0x46, 0xb3, 0x5b, 0xea, 0x35, 0xec, 0x16, 0xa7, 0x9d, 0x4a, 0x12, 0xfa, 0x0f, 0xac, - 0xc5, 0x98, 0x0b, 0x73, 0x70, 0xe0, 0x0e, 0xc7, 0xd8, 0x33, 0x56, 0x05, 0x68, 0x55, 0x52, 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ce, 0x73, 0x07, 0xbf, 0x99, 0xbf, 0x59, 0xd0, - 0x01, 0x34, 0xd3, 0x33, 0x07, 0x75, 0x52, 0xde, 0xec, 0x91, 0x64, 0x9a, 0x45, 0x2c, 0xb5, 0x2c, - 0x8f, 0x00, 0xb2, 0x3b, 0x46, 0x53, 0x3e, 0x77, 0x05, 0x99, 0xdb, 0x85, 0x3c, 0x25, 0xe6, 0x0b, - 0x79, 0x9b, 0xe5, 0xba, 0xa0, 0x9b, 0x53, 0x5b, 0x70, 0x13, 0x99, 0xb7, 0x96, 0x20, 0x94, 0xe0, - 0xa7, 0xb0, 0xf6, 0x18, 0xeb, 0x2c, 0x4d, 0xec, 0x82, 0x0b, 0xc7, 0x5c, 0x78, 0x24, 0xa1, 0xaf, - 0xa0, 0x3d, 0x77, 0xcb, 0xbc, 0x81, 0x40, 0x2b, 0x43, 0x2c, 0xba, 0x84, 0xd0, 0x29, 0x20, 0x7e, - 0x8e, 0x0c, 0x92, 0xe1, 0x98, 0xd0, 0x17, 0xd8, 0x13, 0xcb, 0x03, 0x5d, 0x4f, 0x5f, 0x16, 0x9d, - 0x49, 0xe6, 0x8d, 0x45, 0x6c, 0x25, 0x74, 0x00, 0xed, 0xb9, 0x45, 0x8e, 0x6e, 0xbd, 0x76, 0xc9, - 0x2f, 0x89, 0xc0, 0xb7, 0x70, 0xb9, 0x60, 0x99, 0xa1, 0x9d, 0x19, 0x99, 0x45, 0x0b, 0xdc, 0xfc, - 0xf7, 0x72, 0x90, 0xb2, 0xf9, 0x63, 0x68, 0x4c, 0x97, 0x00, 0xca, 0xec, 0x98, 0xd9, 0x90, 0x66, - 0xa7, 0x80, 0xa3, 0x04, 0x3c, 0x06, 0x34, 0xbf, 0x31, 0x90, 0x35, 0xa3, 0xbc, 0x60, 0x9d, 0xcc, - 0xf6, 0xc7, 0x37, 0x80, 0xe6, 0xc7, 0x82, 0x26, 0x68, 0xe1, 0xac, 0x32, 0x77, 0x96, 0x62, 0x94, - 0x9d, 0xcf, 0x60, 0x7d, 0xa6, 0xc5, 0xd1, 0xcd, 0x2c, 0x9f, 0x85, 0x13, 0xc7, 0xec, 0x2e, 0x06, - 0x48, 0xa9, 0x07, 0x8f, 0xbe, 0xde, 0x39, 0x23, 0xec, 0x45, 0x32, 0xdc, 0x1d, 0x85, 0xfe, 0x3d, - 0x85, 0xbe, 0x27, 0xfe, 0x06, 0x18, 0x85, 0xe3, 0x29, 0xe1, 0xa7, 0xf2, 0xea, 0x53, 0x72, 0x81, - 0x9f, 0xf0, 0x0c, 0x73, 0xd6, 0x6f, 0xe5, 0x35, 0xf5, 0xbd, 0xb7, 0x27, 0x08, 0xc3, 0xba, 0x78, - 0xf2, 0xde, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd2, 0x1d, 0x9e, 0x09, 0xa2, 0x10, 0x00, 0x00, + // 1478 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xeb, 0x6e, 0xdb, 0xc6, + 0x12, 0x3e, 0x94, 0x2d, 0x59, 0x1a, 0xf9, 0xa6, 0xb5, 0x13, 0xd3, 0x74, 0x2e, 0x0e, 0x7d, 0x0e, + 0x8e, 0x73, 0x72, 0xa2, 0x34, 0x2a, 0x8a, 0x04, 0x46, 0x6f, 0x76, 0xec, 0xa4, 0x46, 0x62, 0x40, + 0xa5, 0x53, 0xf4, 0x02, 0x14, 0x2c, 0x25, 0x6e, 0xec, 0x85, 0xc5, 0x4b, 0xb9, 0x2b, 0x37, 0x7a, + 0x83, 0x3c, 0x44, 0x9f, 0xa0, 0x6f, 0x50, 0xa0, 0x8f, 0xd0, 0x9f, 0x7d, 0x82, 0xfe, 0xec, 0x3b, + 0x14, 0x28, 0xf6, 0x42, 0x72, 0x29, 0x51, 0x4a, 0x1a, 0xb4, 0x40, 0xff, 0x71, 0x67, 0xbe, 0x9d, + 0x9d, 0x99, 0x9d, 0x99, 0xfd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46, 0x0f, 0x00, 0xf2, 0x9f, 0x32, + 0x28, 0x2f, 0xab, 0x89, 0xdf, 0x37, 0x56, 0x91, 0xa2, 0xa1, 0x03, 0x68, 0x64, 0xac, 0x0e, 0x6d, + 0x66, 0xba, 0x71, 0x4e, 0x68, 0x59, 0x65, 0x2a, 0xe5, 0xe6, 0x11, 0x40, 0x4e, 0xdb, 0xb4, 0xc3, + 0x27, 0x48, 0x9f, 0xb5, 0x55, 0xaa, 0x53, 0x66, 0x3e, 0x97, 0x54, 0xb4, 0xd0, 0xf4, 0xdb, 0x85, + 0x63, 0x4b, 0x28, 0xa0, 0x75, 0x6b, 0x06, 0x42, 0x19, 0x7e, 0x06, 0xcb, 0x4f, 0xb0, 0xae, 0xd2, + 0xcc, 0x4e, 0x21, 0x74, 0xd6, 0x54, 0x4e, 0x88, 0xbe, 0x84, 0xd6, 0x04, 0x75, 0x7b, 0x03, 0x83, + 0x76, 0x8e, 0x98, 0x46, 0xfc, 0xd0, 0x29, 0x20, 0xce, 0xbe, 0xba, 0xc3, 0xde, 0x80, 0xd0, 0x73, + 0xec, 0x8b, 0xb7, 0x12, 0x5d, 0xcf, 0x76, 0x96, 0xb1, 0x42, 0xeb, 0xc6, 0x34, 0xb5, 0x32, 0xda, + 0x85, 0xd6, 0x04, 0x6f, 0x41, 0xb7, 0x5e, 0xcb, 0x69, 0x66, 0x64, 0xe0, 0x1b, 0x58, 0x2b, 0x79, + 0xbb, 0xd1, 0xce, 0x98, 0xcd, 0x32, 0xbe, 0x62, 0xfd, 0x7b, 0x36, 0x48, 0xf9, 0xfc, 0x11, 0xd4, + 0xd3, 0x37, 0x0f, 0xe5, 0x7e, 0x8c, 0x11, 0x02, 0x6b, 0xb3, 0x44, 0xa3, 0x0c, 0x3c, 0x01, 0x34, + 0xf9, 0x40, 0x22, 0x7b, 0xec, 0xf0, 0x92, 0xd7, 0x73, 0xbc, 0x3f, 0xbe, 0x06, 0x34, 0x39, 0x05, + 0x35, 0x43, 0x53, 0x47, 0xb3, 0xb5, 0x33, 0x13, 0xa3, 0xfc, 0x7c, 0x0e, 0x2b, 0x63, 0x13, 0x0d, + 0xdd, 0xcc, 0xef, 0xb3, 0x74, 0xc0, 0x5a, 0xdb, 0xd3, 0x01, 0x79, 0x43, 0xe6, 0xd3, 0x44, 0x6b, + 0xc8, 0x89, 0x01, 0xa9, 0x35, 0xe4, 0xe4, 0xf8, 0x39, 0x78, 0xfc, 0xd5, 0xce, 0x19, 0x61, 0xe7, + 0xc3, 0x5e, 0xbb, 0x1f, 0x05, 0xf7, 0x14, 0xf0, 0x9e, 0xf8, 0xf3, 0xa4, 0x1f, 0x0d, 0x52, 0xc1, + 0x0f, 0x95, 0xa5, 0x67, 0xe4, 0x12, 0x3f, 0xe5, 0x36, 0xb8, 0xea, 0xb7, 0xca, 0xb2, 0x5a, 0xef, + 0xed, 0x09, 0x41, 0xaf, 0x26, 0xb6, 0xbc, 0xfb, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3e, 0x42, + 0x47, 0xc4, 0xd8, 0x11, 0x00, 0x00, } diff --git a/protobufs/livekit_room.proto b/protobufs/livekit_room.proto index 0a5e51b..eddb17d 100644 --- a/protobufs/livekit_room.proto +++ b/protobufs/livekit_room.proto @@ -72,6 +72,8 @@ service RoomService { // The participant will be removed from the current room and added to the destination room. // From the other observers' perspective, the participant would've disconnected from the previous room and joined the new one. rpc MoveParticipant(MoveParticipantRequest) returns (MoveParticipantResponse); + + rpc PerformRpc(PerformRpcRequest) returns (PerformRpcResponse); } message CreateRoomRequest { @@ -268,3 +270,16 @@ message MoveParticipantRequest { message MoveParticipantResponse { } + +message PerformRpcRequest { + string room = 1; + string destination_identity = 2; + string method = 3; + string payload = 4; + uint32 response_timeout_ms = 5; +} + +message PerformRpcResponse { + string payload = 1; +} + diff --git a/protobufs/rpc/participant.proto b/protobufs/rpc/participant.proto index 53abfe4..a4b4720 100644 --- a/protobufs/rpc/participant.proto +++ b/protobufs/rpc/participant.proto @@ -83,4 +83,14 @@ service Participant { }; }; }; + rpc PerformRpc(livekit.PerformRpcRequest) returns (livekit.PerformRpcResponse) { + option (psrpc.options) = { + topics: true + topic_params : { + group: "participant" + names: ["participant"] + typed: true + }; + }; + }; } diff --git a/rpc/participant.pb.go b/rpc/participant.pb.go index 34cc5d2..e919d1a 100644 --- a/rpc/participant.pb.go +++ b/rpc/participant.pb.go @@ -40,7 +40,7 @@ var File_rpc_participant_proto protoreflect.FileDescriptor const file_rpc_participant_proto_rawDesc = "" + "\n" + - "\x15rpc/participant.proto\x12\x03rpc\x1a\roptions.proto\x1a\x14livekit_models.proto\x1a\x12livekit_room.proto2\x8c\x06\n" + + "\x15rpc/participant.proto\x12\x03rpc\x1a\roptions.proto\x1a\x14livekit_models.proto\x1a\x12livekit_room.proto2\xf9\x06\n" + "\vParticipant\x12\x7f\n" + "\x11RemoveParticipant\x12 .livekit.RoomParticipantIdentity\x1a\".livekit.RemoveParticipantResponse\"$\xb2\x89\x01 \x10\x01\x1a\x1c\n" + "\vparticipant\x12\vparticipant\x18\x01\x12y\n" + @@ -53,6 +53,9 @@ const file_rpc_participant_proto_rawDesc = "" + "\x12ForwardParticipant\x12\".livekit.ForwardParticipantRequest\x1a#.livekit.ForwardParticipantResponse\"$\xb2\x89\x01 \x10\x01\x1a\x1c\n" + "\vparticipant\x12\vparticipant\x18\x01\x12z\n" + "\x0fMoveParticipant\x12\x1f.livekit.MoveParticipantRequest\x1a .livekit.MoveParticipantResponse\"$\xb2\x89\x01 \x10\x01\x1a\x1c\n" + + "\vparticipant\x12\vparticipant\x18\x01\x12k\n" + + "\n" + + "PerformRpc\x12\x1a.livekit.PerformRpcRequest\x1a\x1b.livekit.PerformRpcResponse\"$\xb2\x89\x01 \x10\x01\x1a\x1c\n" + "\vparticipant\x12\vparticipant\x18\x01B!Z\x1fgithub.com/livekit/protocol/rpcb\x06proto3" var file_rpc_participant_proto_goTypes = []any{ @@ -62,12 +65,14 @@ var file_rpc_participant_proto_goTypes = []any{ (*livekit.UpdateSubscriptionsRequest)(nil), // 3: livekit.UpdateSubscriptionsRequest (*livekit.ForwardParticipantRequest)(nil), // 4: livekit.ForwardParticipantRequest (*livekit.MoveParticipantRequest)(nil), // 5: livekit.MoveParticipantRequest - (*livekit.RemoveParticipantResponse)(nil), // 6: livekit.RemoveParticipantResponse - (*livekit.MuteRoomTrackResponse)(nil), // 7: livekit.MuteRoomTrackResponse - (*livekit.ParticipantInfo)(nil), // 8: livekit.ParticipantInfo - (*livekit.UpdateSubscriptionsResponse)(nil), // 9: livekit.UpdateSubscriptionsResponse - (*livekit.ForwardParticipantResponse)(nil), // 10: livekit.ForwardParticipantResponse - (*livekit.MoveParticipantResponse)(nil), // 11: livekit.MoveParticipantResponse + (*livekit.PerformRpcRequest)(nil), // 6: livekit.PerformRpcRequest + (*livekit.RemoveParticipantResponse)(nil), // 7: livekit.RemoveParticipantResponse + (*livekit.MuteRoomTrackResponse)(nil), // 8: livekit.MuteRoomTrackResponse + (*livekit.ParticipantInfo)(nil), // 9: livekit.ParticipantInfo + (*livekit.UpdateSubscriptionsResponse)(nil), // 10: livekit.UpdateSubscriptionsResponse + (*livekit.ForwardParticipantResponse)(nil), // 11: livekit.ForwardParticipantResponse + (*livekit.MoveParticipantResponse)(nil), // 12: livekit.MoveParticipantResponse + (*livekit.PerformRpcResponse)(nil), // 13: livekit.PerformRpcResponse } var file_rpc_participant_proto_depIdxs = []int32{ 0, // 0: rpc.Participant.RemoveParticipant:input_type -> livekit.RoomParticipantIdentity @@ -76,14 +81,16 @@ var file_rpc_participant_proto_depIdxs = []int32{ 3, // 3: rpc.Participant.UpdateSubscriptions:input_type -> livekit.UpdateSubscriptionsRequest 4, // 4: rpc.Participant.ForwardParticipant:input_type -> livekit.ForwardParticipantRequest 5, // 5: rpc.Participant.MoveParticipant:input_type -> livekit.MoveParticipantRequest - 6, // 6: rpc.Participant.RemoveParticipant:output_type -> livekit.RemoveParticipantResponse - 7, // 7: rpc.Participant.MutePublishedTrack:output_type -> livekit.MuteRoomTrackResponse - 8, // 8: rpc.Participant.UpdateParticipant:output_type -> livekit.ParticipantInfo - 9, // 9: rpc.Participant.UpdateSubscriptions:output_type -> livekit.UpdateSubscriptionsResponse - 10, // 10: rpc.Participant.ForwardParticipant:output_type -> livekit.ForwardParticipantResponse - 11, // 11: rpc.Participant.MoveParticipant:output_type -> livekit.MoveParticipantResponse - 6, // [6:12] is the sub-list for method output_type - 0, // [0:6] is the sub-list for method input_type + 6, // 6: rpc.Participant.PerformRpc:input_type -> livekit.PerformRpcRequest + 7, // 7: rpc.Participant.RemoveParticipant:output_type -> livekit.RemoveParticipantResponse + 8, // 8: rpc.Participant.MutePublishedTrack:output_type -> livekit.MuteRoomTrackResponse + 9, // 9: rpc.Participant.UpdateParticipant:output_type -> livekit.ParticipantInfo + 10, // 10: rpc.Participant.UpdateSubscriptions:output_type -> livekit.UpdateSubscriptionsResponse + 11, // 11: rpc.Participant.ForwardParticipant:output_type -> livekit.ForwardParticipantResponse + 12, // 12: rpc.Participant.MoveParticipant:output_type -> livekit.MoveParticipantResponse + 13, // 13: rpc.Participant.PerformRpc:output_type -> livekit.PerformRpcResponse + 7, // [7:14] is the sub-list for method output_type + 0, // [0:7] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name diff --git a/rpc/participant.psrpc.go b/rpc/participant.psrpc.go index 989637c..b163527 100644 --- a/rpc/participant.psrpc.go +++ b/rpc/participant.psrpc.go @@ -35,6 +35,8 @@ type ParticipantClient[ParticipantTopicType ~string] interface { MoveParticipant(ctx context.Context, participant ParticipantTopicType, req *livekit6.MoveParticipantRequest, opts ...psrpc.RequestOption) (*livekit6.MoveParticipantResponse, error) + PerformRpc(ctx context.Context, participant ParticipantTopicType, req *livekit6.PerformRpcRequest, opts ...psrpc.RequestOption) (*livekit6.PerformRpcResponse, error) + // Close immediately, without waiting for pending RPCs Close() } @@ -55,6 +57,8 @@ type ParticipantServerImpl interface { ForwardParticipant(context.Context, *livekit6.ForwardParticipantRequest) (*livekit6.ForwardParticipantResponse, error) MoveParticipant(context.Context, *livekit6.MoveParticipantRequest) (*livekit6.MoveParticipantResponse, error) + + PerformRpc(context.Context, *livekit6.PerformRpcRequest) (*livekit6.PerformRpcResponse, error) } // ============================ @@ -74,6 +78,8 @@ type ParticipantServer[ParticipantTopicType ~string] interface { DeregisterForwardParticipantTopic(participant ParticipantTopicType) RegisterMoveParticipantTopic(participant ParticipantTopicType) error DeregisterMoveParticipantTopic(participant ParticipantTopicType) + RegisterPerformRpcTopic(participant ParticipantTopicType) error + DeregisterPerformRpcTopic(participant ParticipantTopicType) RegisterAllParticipantTopics(participant ParticipantTopicType) error DeregisterAllParticipantTopics(participant ParticipantTopicType) @@ -105,6 +111,7 @@ func NewParticipantClient[ParticipantTopicType ~string](bus psrpc.MessageBus, op sd.RegisterMethod("UpdateSubscriptions", false, false, true, true) sd.RegisterMethod("ForwardParticipant", false, false, true, true) sd.RegisterMethod("MoveParticipant", false, false, true, true) + sd.RegisterMethod("PerformRpc", false, false, true, true) rpcClient, err := client.NewRPCClient(sd, bus, opts...) if err != nil { @@ -140,6 +147,10 @@ func (c *participantClient[ParticipantTopicType]) MoveParticipant(ctx context.Co return client.RequestSingle[*livekit6.MoveParticipantResponse](ctx, c.client, "MoveParticipant", []string{string(participant)}, req, opts...) } +func (c *participantClient[ParticipantTopicType]) PerformRpc(ctx context.Context, participant ParticipantTopicType, req *livekit6.PerformRpcRequest, opts ...psrpc.RequestOption) (*livekit6.PerformRpcResponse, error) { + return client.RequestSingle[*livekit6.PerformRpcResponse](ctx, c.client, "PerformRpc", []string{string(participant)}, req, opts...) +} + func (s *participantClient[ParticipantTopicType]) Close() { s.client.Close() } @@ -169,6 +180,7 @@ func NewParticipantServer[ParticipantTopicType ~string](svc ParticipantServerImp sd.RegisterMethod("UpdateSubscriptions", false, false, true, true) sd.RegisterMethod("ForwardParticipant", false, false, true, true) sd.RegisterMethod("MoveParticipant", false, false, true, true) + sd.RegisterMethod("PerformRpc", false, false, true, true) return &participantServer[ParticipantTopicType]{ svc: svc, rpc: s, @@ -223,6 +235,14 @@ func (s *participantServer[ParticipantTopicType]) DeregisterMoveParticipantTopic s.rpc.DeregisterHandler("MoveParticipant", []string{string(participant)}) } +func (s *participantServer[ParticipantTopicType]) RegisterPerformRpcTopic(participant ParticipantTopicType) error { + return server.RegisterHandler(s.rpc, "PerformRpc", []string{string(participant)}, s.svc.PerformRpc, nil) +} + +func (s *participantServer[ParticipantTopicType]) DeregisterPerformRpcTopic(participant ParticipantTopicType) { + s.rpc.DeregisterHandler("PerformRpc", []string{string(participant)}) +} + func (s *participantServer[ParticipantTopicType]) allParticipantTopicRegisterers() server.RegistererSlice { return server.RegistererSlice{ server.NewRegisterer(s.RegisterRemoveParticipantTopic, s.DeregisterRemoveParticipantTopic), @@ -231,6 +251,7 @@ func (s *participantServer[ParticipantTopicType]) allParticipantTopicRegisterers server.NewRegisterer(s.RegisterUpdateSubscriptionsTopic, s.DeregisterUpdateSubscriptionsTopic), server.NewRegisterer(s.RegisterForwardParticipantTopic, s.DeregisterForwardParticipantTopic), server.NewRegisterer(s.RegisterMoveParticipantTopic, s.DeregisterMoveParticipantTopic), + server.NewRegisterer(s.RegisterPerformRpcTopic, s.DeregisterPerformRpcTopic), } } @@ -251,27 +272,28 @@ func (s *participantServer[ParticipantTopicType]) Kill() { } var psrpcFileDescriptor6 = []byte{ - // 337 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x4f, 0x4b, 0xfb, 0x40, - 0x10, 0x25, 0xfc, 0xa0, 0x87, 0x2d, 0x3f, 0xb4, 0xab, 0x42, 0x09, 0x6a, 0xff, 0x9e, 0x13, 0xd0, - 0x6f, 0xe0, 0x41, 0xf0, 0x50, 0x28, 0x51, 0x2f, 0x5e, 0x24, 0xd9, 0xac, 0x76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ad, 0x49, 0x9e, 0xe0, 0x8f, 0xb9, 0x9f, 0x16, 0x39, 0xca, 0xcd, 0x6f, - 0xd3, 0x40, 0x33, 0x25, 0xf2, 0x59, 0xd2, 0x51, 0x2d, 0x7a, 0x83, 0x2d, 0xc2, 0xc7, 0xfb, 0x45, - 0x8d, 0x1a, 0xf0, 0x61, 0x11, 0x7a, 0x0d, 0xea, 0xd5, 0x57, 0xa1, 0xd9, 0x82, 0x6a, 0xb8, 0xdb, - 0x64, 0x51, 0xc6, 0x68, 0xaf, 0xa6, 0x51, 0x15, 0x6f, 0xe4, 0x60, 0x52, 0x5b, 0xc0, 0x5e, 0x35, - 0xdf, 0xfa, 0x72, 0xe5, 0xf1, 0xfd, 0xdd, 0x82, 0x26, 0xd9, 0x57, 0x83, 0x87, 0xde, 0xb3, 0xc0, - 0x59, 0x1a, 0x38, 0x0c, 0x62, 0x77, 0xed, 0xe9, 0x66, 0x5f, 0x85, 0x41, 0xe4, 0x2a, 0xc9, 0x82, - 0x56, 0x76, 0xba, 0xfc, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x30, 0x94, 0x6b, 0x3a, 0x8f, 0x03, 0x00, - 0x00, + // 358 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x4d, 0x4b, 0xc3, 0x40, + 0x10, 0x25, 0x08, 0x3d, 0x6c, 0x11, 0xed, 0xaa, 0x50, 0xe2, 0x47, 0x3f, 0xcf, 0x09, 0xe8, 0x3f, + 0xf0, 0x20, 0x78, 0x28, 0x94, 0xa8, 0x17, 0x2f, 0x92, 0x6c, 0xb6, 0x76, 0x69, 0x92, 0x59, 0x27, + 0x9b, 0x4a, 0xbd, 0x78, 0x10, 0x04, 0xff, 0x8e, 0xff, 0xce, 0x9b, 0x34, 0x69, 0x92, 0x6d, 0x6a, + 0x8b, 0x39, 0xee, 0x7b, 0x6f, 0xdf, 0x9b, 0x9d,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, 0x45, + 0xb5, 0x1a, 0xf0, 0x61, 0x10, 0x7a, 0x03, 0xf8, 0xea, 0xa2, 0xaf, 0xb7, 0xa0, 0x1c, 0xee, 0x26, + 0x99, 0x97, 0x31, 0xd8, 0xa9, 0xa9, 0x55, 0xc5, 0x1b, 0x39, 0x18, 0x55, 0x16, 0xb0, 0x53, 0xce, + 0xb7, 0xba, 0x5c, 0x59, 0x7c, 0x77, 0xbb, 0xa0, 0x56, 0xf6, 0x8c, 0x90, 0x31, 0xc7, 0x09, 0x60, + 0xe8, 0x48, 0x46, 0xcd, 0x72, 0xb0, 0x05, 0x98, 0x27, 0x9e, 0xfe, 0xc9, 0xd5, 0x09, 0xbb, 0xee, + 0x3d, 0x76, 0x9e, 0x85, 0x9a, 0x26, 0x9e, 0xc5, 0x20, 0xb4, 0x57, 0x76, 0x76, 0xfa, 0x2f, 0x19, + 0x04, 0x36, 0x4a, 0xe6, 0x35, 0xd2, 0xd3, 0xd5, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0a, 0xe5, + 0x58, 0xe8, 0xfc, 0x03, 0x00, 0x00, } diff --git a/rpc/rpcfakes/fake_typed_participant_client.go b/rpc/rpcfakes/fake_typed_participant_client.go index 9b66064..f5bba35 100644 --- a/rpc/rpcfakes/fake_typed_participant_client.go +++ b/rpc/rpcfakes/fake_typed_participant_client.go @@ -63,6 +63,22 @@ type FakeTypedParticipantClient struct { result1 *livekit.MuteRoomTrackResponse result2 error } + PerformRpcStub func(context.Context, rpc.ParticipantTopic, *livekit.PerformRpcRequest, ...psrpc.RequestOption) (*livekit.PerformRpcResponse, error) + performRpcMutex sync.RWMutex + performRpcArgsForCall []struct { + arg1 context.Context + arg2 rpc.ParticipantTopic + arg3 *livekit.PerformRpcRequest + arg4 []psrpc.RequestOption + } + performRpcReturns struct { + result1 *livekit.PerformRpcResponse + result2 error + } + performRpcReturnsOnCall map[int]struct { + result1 *livekit.PerformRpcResponse + result2 error + } RemoveParticipantStub func(context.Context, rpc.ParticipantTopic, *livekit.RoomParticipantIdentity, ...psrpc.RequestOption) (*livekit.RemoveParticipantResponse, error) removeParticipantMutex sync.RWMutex removeParticipantArgsForCall []struct { @@ -340,6 +356,73 @@ func (fake *FakeTypedParticipantClient) MutePublishedTrackReturnsOnCall(i int, r }{result1, result2} } +func (fake *FakeTypedParticipantClient) PerformRpc(arg1 context.Context, arg2 rpc.ParticipantTopic, arg3 *livekit.PerformRpcRequest, arg4 ...psrpc.RequestOption) (*livekit.PerformRpcResponse, error) { + fake.performRpcMutex.Lock() + ret, specificReturn := fake.performRpcReturnsOnCall[len(fake.performRpcArgsForCall)] + fake.performRpcArgsForCall = append(fake.performRpcArgsForCall, struct { + arg1 context.Context + arg2 rpc.ParticipantTopic + arg3 *livekit.PerformRpcRequest + arg4 []psrpc.RequestOption + }{arg1, arg2, arg3, arg4}) + stub := fake.PerformRpcStub + fakeReturns := fake.performRpcReturns + fake.recordInvocation("PerformRpc", []interface{}{arg1, arg2, arg3, arg4}) + fake.performRpcMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3, arg4...) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fakeReturns.result1, fakeReturns.result2 +} + +func (fake *FakeTypedParticipantClient) PerformRpcCallCount() int { + fake.performRpcMutex.RLock() + defer fake.performRpcMutex.RUnlock() + return len(fake.performRpcArgsForCall) +} + +func (fake *FakeTypedParticipantClient) PerformRpcCalls(stub func(context.Context, rpc.ParticipantTopic, *livekit.PerformRpcRequest, ...psrpc.RequestOption) (*livekit.PerformRpcResponse, error)) { + fake.performRpcMutex.Lock() + defer fake.performRpcMutex.Unlock() + fake.PerformRpcStub = stub +} + +func (fake *FakeTypedParticipantClient) PerformRpcArgsForCall(i int) (context.Context, rpc.ParticipantTopic, *livekit.PerformRpcRequest, []psrpc.RequestOption) { + fake.performRpcMutex.RLock() + defer fake.performRpcMutex.RUnlock() + argsForCall := fake.performRpcArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 +} + +func (fake *FakeTypedParticipantClient) PerformRpcReturns(result1 *livekit.PerformRpcResponse, result2 error) { + fake.performRpcMutex.Lock() + defer fake.performRpcMutex.Unlock() + fake.PerformRpcStub = nil + fake.performRpcReturns = struct { + result1 *livekit.PerformRpcResponse + result2 error + }{result1, result2} +} + +func (fake *FakeTypedParticipantClient) PerformRpcReturnsOnCall(i int, result1 *livekit.PerformRpcResponse, result2 error) { + fake.performRpcMutex.Lock() + defer fake.performRpcMutex.Unlock() + fake.PerformRpcStub = nil + if fake.performRpcReturnsOnCall == nil { + fake.performRpcReturnsOnCall = make(map[int]struct { + result1 *livekit.PerformRpcResponse + result2 error + }) + } + fake.performRpcReturnsOnCall[i] = struct { + result1 *livekit.PerformRpcResponse + result2 error + }{result1, result2} +} + func (fake *FakeTypedParticipantClient) RemoveParticipant(arg1 context.Context, arg2 rpc.ParticipantTopic, arg3 *livekit.RoomParticipantIdentity, arg4 ...psrpc.RequestOption) (*livekit.RemoveParticipantResponse, error) { fake.removeParticipantMutex.Lock() ret, specificReturn := fake.removeParticipantReturnsOnCall[len(fake.removeParticipantArgsForCall)] @@ -552,6 +635,8 @@ func (fake *FakeTypedParticipantClient) Invocations() map[string][][]interface{} defer fake.moveParticipantMutex.RUnlock() fake.mutePublishedTrackMutex.RLock() defer fake.mutePublishedTrackMutex.RUnlock() + fake.performRpcMutex.RLock() + defer fake.performRpcMutex.RUnlock() fake.removeParticipantMutex.RLock() defer fake.removeParticipantMutex.RUnlock() fake.updateParticipantMutex.RLock() diff --git a/rpc/rpcfakes/fake_typed_whipparticipant_client.go b/rpc/rpcfakes/fake_typed_whipparticipant_client.go new file mode 100644 index 0000000..7be480a --- /dev/null +++ b/rpc/rpcfakes/fake_typed_whipparticipant_client.go @@ -0,0 +1,325 @@ +// Code generated by counterfeiter. DO NOT EDIT. +package rpcfakes + +import ( + "context" + "sync" + + "github.com/livekit/protocol/rpc" + "github.com/livekit/psrpc" + "google.golang.org/protobuf/types/known/emptypb" +) + +type FakeTypedWHIPParticipantClient struct { + CloseStub func() + closeMutex sync.RWMutex + closeArgsForCall []struct { + } + DeleteSessionStub func(context.Context, rpc.ParticipantTopic, *rpc.WHIPParticipantDeleteSessionRequest, ...psrpc.RequestOption) (*emptypb.Empty, error) + deleteSessionMutex sync.RWMutex + deleteSessionArgsForCall []struct { + arg1 context.Context + arg2 rpc.ParticipantTopic + arg3 *rpc.WHIPParticipantDeleteSessionRequest + arg4 []psrpc.RequestOption + } + deleteSessionReturns struct { + result1 *emptypb.Empty + result2 error + } + deleteSessionReturnsOnCall map[int]struct { + result1 *emptypb.Empty + result2 error + } + ICERestartStub func(context.Context, rpc.ParticipantTopic, *rpc.WHIPParticipantICERestartRequest, ...psrpc.RequestOption) (*rpc.WHIPParticipantICERestartResponse, error) + iCERestartMutex sync.RWMutex + iCERestartArgsForCall []struct { + arg1 context.Context + arg2 rpc.ParticipantTopic + arg3 *rpc.WHIPParticipantICERestartRequest + arg4 []psrpc.RequestOption + } + iCERestartReturns struct { + result1 *rpc.WHIPParticipantICERestartResponse + result2 error + } + iCERestartReturnsOnCall map[int]struct { + result1 *rpc.WHIPParticipantICERestartResponse + result2 error + } + ICETrickleStub func(context.Context, rpc.ParticipantTopic, *rpc.WHIPParticipantICETrickleRequest, ...psrpc.RequestOption) (*emptypb.Empty, error) + iCETrickleMutex sync.RWMutex + iCETrickleArgsForCall []struct { + arg1 context.Context + arg2 rpc.ParticipantTopic + arg3 *rpc.WHIPParticipantICETrickleRequest + arg4 []psrpc.RequestOption + } + iCETrickleReturns struct { + result1 *emptypb.Empty + result2 error + } + iCETrickleReturnsOnCall map[int]struct { + result1 *emptypb.Empty + result2 error + } + invocations map[string][][]interface{} + invocationsMutex sync.RWMutex +} + +func (fake *FakeTypedWHIPParticipantClient) Close() { + fake.closeMutex.Lock() + fake.closeArgsForCall = append(fake.closeArgsForCall, struct { + }{}) + stub := fake.CloseStub + fake.recordInvocation("Close", []interface{}{}) + fake.closeMutex.Unlock() + if stub != nil { + fake.CloseStub() + } +} + +func (fake *FakeTypedWHIPParticipantClient) CloseCallCount() int { + fake.closeMutex.RLock() + defer fake.closeMutex.RUnlock() + return len(fake.closeArgsForCall) +} + +func (fake *FakeTypedWHIPParticipantClient) CloseCalls(stub func()) { + fake.closeMutex.Lock() + defer fake.closeMutex.Unlock() + fake.CloseStub = stub +} + +func (fake *FakeTypedWHIPParticipantClient) DeleteSession(arg1 context.Context, arg2 rpc.ParticipantTopic, arg3 *rpc.WHIPParticipantDeleteSessionRequest, arg4 ...psrpc.RequestOption) (*emptypb.Empty, error) { + fake.deleteSessionMutex.Lock() + ret, specificReturn := fake.deleteSessionReturnsOnCall[len(fake.deleteSessionArgsForCall)] + fake.deleteSessionArgsForCall = append(fake.deleteSessionArgsForCall, struct { + arg1 context.Context + arg2 rpc.ParticipantTopic + arg3 *rpc.WHIPParticipantDeleteSessionRequest + arg4 []psrpc.RequestOption + }{arg1, arg2, arg3, arg4}) + stub := fake.DeleteSessionStub + fakeReturns := fake.deleteSessionReturns + fake.recordInvocation("DeleteSession", []interface{}{arg1, arg2, arg3, arg4}) + fake.deleteSessionMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3, arg4...) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fakeReturns.result1, fakeReturns.result2 +} + +func (fake *FakeTypedWHIPParticipantClient) DeleteSessionCallCount() int { + fake.deleteSessionMutex.RLock() + defer fake.deleteSessionMutex.RUnlock() + return len(fake.deleteSessionArgsForCall) +} + +func (fake *FakeTypedWHIPParticipantClient) DeleteSessionCalls(stub func(context.Context, rpc.ParticipantTopic, *rpc.WHIPParticipantDeleteSessionRequest, ...psrpc.RequestOption) (*emptypb.Empty, error)) { + fake.deleteSessionMutex.Lock() + defer fake.deleteSessionMutex.Unlock() + fake.DeleteSessionStub = stub +} + +func (fake *FakeTypedWHIPParticipantClient) DeleteSessionArgsForCall(i int) (context.Context, rpc.ParticipantTopic, *rpc.WHIPParticipantDeleteSessionRequest, []psrpc.RequestOption) { + fake.deleteSessionMutex.RLock() + defer fake.deleteSessionMutex.RUnlock() + argsForCall := fake.deleteSessionArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 +} + +func (fake *FakeTypedWHIPParticipantClient) DeleteSessionReturns(result1 *emptypb.Empty, result2 error) { + fake.deleteSessionMutex.Lock() + defer fake.deleteSessionMutex.Unlock() + fake.DeleteSessionStub = nil + fake.deleteSessionReturns = struct { + result1 *emptypb.Empty + result2 error + }{result1, result2} +} + +func (fake *FakeTypedWHIPParticipantClient) DeleteSessionReturnsOnCall(i int, result1 *emptypb.Empty, result2 error) { + fake.deleteSessionMutex.Lock() + defer fake.deleteSessionMutex.Unlock() + fake.DeleteSessionStub = nil + if fake.deleteSessionReturnsOnCall == nil { + fake.deleteSessionReturnsOnCall = make(map[int]struct { + result1 *emptypb.Empty + result2 error + }) + } + fake.deleteSessionReturnsOnCall[i] = struct { + result1 *emptypb.Empty + result2 error + }{result1, result2} +} + +func (fake *FakeTypedWHIPParticipantClient) ICERestart(arg1 context.Context, arg2 rpc.ParticipantTopic, arg3 *rpc.WHIPParticipantICERestartRequest, arg4 ...psrpc.RequestOption) (*rpc.WHIPParticipantICERestartResponse, error) { + fake.iCERestartMutex.Lock() + ret, specificReturn := fake.iCERestartReturnsOnCall[len(fake.iCERestartArgsForCall)] + fake.iCERestartArgsForCall = append(fake.iCERestartArgsForCall, struct { + arg1 context.Context + arg2 rpc.ParticipantTopic + arg3 *rpc.WHIPParticipantICERestartRequest + arg4 []psrpc.RequestOption + }{arg1, arg2, arg3, arg4}) + stub := fake.ICERestartStub + fakeReturns := fake.iCERestartReturns + fake.recordInvocation("ICERestart", []interface{}{arg1, arg2, arg3, arg4}) + fake.iCERestartMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3, arg4...) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fakeReturns.result1, fakeReturns.result2 +} + +func (fake *FakeTypedWHIPParticipantClient) ICERestartCallCount() int { + fake.iCERestartMutex.RLock() + defer fake.iCERestartMutex.RUnlock() + return len(fake.iCERestartArgsForCall) +} + +func (fake *FakeTypedWHIPParticipantClient) ICERestartCalls(stub func(context.Context, rpc.ParticipantTopic, *rpc.WHIPParticipantICERestartRequest, ...psrpc.RequestOption) (*rpc.WHIPParticipantICERestartResponse, error)) { + fake.iCERestartMutex.Lock() + defer fake.iCERestartMutex.Unlock() + fake.ICERestartStub = stub +} + +func (fake *FakeTypedWHIPParticipantClient) ICERestartArgsForCall(i int) (context.Context, rpc.ParticipantTopic, *rpc.WHIPParticipantICERestartRequest, []psrpc.RequestOption) { + fake.iCERestartMutex.RLock() + defer fake.iCERestartMutex.RUnlock() + argsForCall := fake.iCERestartArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 +} + +func (fake *FakeTypedWHIPParticipantClient) ICERestartReturns(result1 *rpc.WHIPParticipantICERestartResponse, result2 error) { + fake.iCERestartMutex.Lock() + defer fake.iCERestartMutex.Unlock() + fake.ICERestartStub = nil + fake.iCERestartReturns = struct { + result1 *rpc.WHIPParticipantICERestartResponse + result2 error + }{result1, result2} +} + +func (fake *FakeTypedWHIPParticipantClient) ICERestartReturnsOnCall(i int, result1 *rpc.WHIPParticipantICERestartResponse, result2 error) { + fake.iCERestartMutex.Lock() + defer fake.iCERestartMutex.Unlock() + fake.ICERestartStub = nil + if fake.iCERestartReturnsOnCall == nil { + fake.iCERestartReturnsOnCall = make(map[int]struct { + result1 *rpc.WHIPParticipantICERestartResponse + result2 error + }) + } + fake.iCERestartReturnsOnCall[i] = struct { + result1 *rpc.WHIPParticipantICERestartResponse + result2 error + }{result1, result2} +} + +func (fake *FakeTypedWHIPParticipantClient) ICETrickle(arg1 context.Context, arg2 rpc.ParticipantTopic, arg3 *rpc.WHIPParticipantICETrickleRequest, arg4 ...psrpc.RequestOption) (*emptypb.Empty, error) { + fake.iCETrickleMutex.Lock() + ret, specificReturn := fake.iCETrickleReturnsOnCall[len(fake.iCETrickleArgsForCall)] + fake.iCETrickleArgsForCall = append(fake.iCETrickleArgsForCall, struct { + arg1 context.Context + arg2 rpc.ParticipantTopic + arg3 *rpc.WHIPParticipantICETrickleRequest + arg4 []psrpc.RequestOption + }{arg1, arg2, arg3, arg4}) + stub := fake.ICETrickleStub + fakeReturns := fake.iCETrickleReturns + fake.recordInvocation("ICETrickle", []interface{}{arg1, arg2, arg3, arg4}) + fake.iCETrickleMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3, arg4...) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fakeReturns.result1, fakeReturns.result2 +} + +func (fake *FakeTypedWHIPParticipantClient) ICETrickleCallCount() int { + fake.iCETrickleMutex.RLock() + defer fake.iCETrickleMutex.RUnlock() + return len(fake.iCETrickleArgsForCall) +} + +func (fake *FakeTypedWHIPParticipantClient) ICETrickleCalls(stub func(context.Context, rpc.ParticipantTopic, *rpc.WHIPParticipantICETrickleRequest, ...psrpc.RequestOption) (*emptypb.Empty, error)) { + fake.iCETrickleMutex.Lock() + defer fake.iCETrickleMutex.Unlock() + fake.ICETrickleStub = stub +} + +func (fake *FakeTypedWHIPParticipantClient) ICETrickleArgsForCall(i int) (context.Context, rpc.ParticipantTopic, *rpc.WHIPParticipantICETrickleRequest, []psrpc.RequestOption) { + fake.iCETrickleMutex.RLock() + defer fake.iCETrickleMutex.RUnlock() + argsForCall := fake.iCETrickleArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 +} + +func (fake *FakeTypedWHIPParticipantClient) ICETrickleReturns(result1 *emptypb.Empty, result2 error) { + fake.iCETrickleMutex.Lock() + defer fake.iCETrickleMutex.Unlock() + fake.ICETrickleStub = nil + fake.iCETrickleReturns = struct { + result1 *emptypb.Empty + result2 error + }{result1, result2} +} + +func (fake *FakeTypedWHIPParticipantClient) ICETrickleReturnsOnCall(i int, result1 *emptypb.Empty, result2 error) { + fake.iCETrickleMutex.Lock() + defer fake.iCETrickleMutex.Unlock() + fake.ICETrickleStub = nil + if fake.iCETrickleReturnsOnCall == nil { + fake.iCETrickleReturnsOnCall = make(map[int]struct { + result1 *emptypb.Empty + result2 error + }) + } + fake.iCETrickleReturnsOnCall[i] = struct { + result1 *emptypb.Empty + result2 error + }{result1, result2} +} + +func (fake *FakeTypedWHIPParticipantClient) Invocations() map[string][][]interface{} { + fake.invocationsMutex.RLock() + defer fake.invocationsMutex.RUnlock() + fake.closeMutex.RLock() + defer fake.closeMutex.RUnlock() + fake.deleteSessionMutex.RLock() + defer fake.deleteSessionMutex.RUnlock() + fake.iCERestartMutex.RLock() + defer fake.iCERestartMutex.RUnlock() + fake.iCETrickleMutex.RLock() + defer fake.iCETrickleMutex.RUnlock() + copiedInvocations := map[string][][]interface{}{} + for key, value := range fake.invocations { + copiedInvocations[key] = value + } + return copiedInvocations +} + +func (fake *FakeTypedWHIPParticipantClient) recordInvocation(key string, args []interface{}) { + fake.invocationsMutex.Lock() + defer fake.invocationsMutex.Unlock() + if fake.invocations == nil { + fake.invocations = map[string][][]interface{}{} + } + if fake.invocations[key] == nil { + fake.invocations[key] = [][]interface{}{} + } + fake.invocations[key] = append(fake.invocations[key], args) +} + +var _ rpc.TypedWHIPParticipantClient = new(FakeTypedWHIPParticipantClient)