diff --git a/README.md b/README.md index 9e2fdc6..ae20958 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,13 @@ websocket url of the signaling server (`ws://127.0.0.1:port/spreed`) or -proxy (`ws://127.0.0.1:port/proxy`) and `subprotocol` must be set to `janus-events`. At least events of type `handles`, `media` and `webrtc` must be subscribed. +Warning: If the configuration between Janus and the signaling endpoint is +interrupted or can't be established, unsent events will be queued by Janus +and will use potentially lots of memory there. This can be limited by setting +`events_cap_on_reconnect` in `janus.eventhandler.wsevh.jcfg`. By default, all +events will be queued as the connection between Janus and the signaling endpoint +is assumed to be stable (most likely will be on the same machine). + Edit the `server.conf` and enter the URL to the websocket endpoint of Janus in the section `[mcu]` and key `url`. During startup, the signaling server will connect to Janus and log information of the gateway. diff --git a/sfu/janus/api.go b/sfu/janus/api.go new file mode 100644 index 0000000..b28c7b6 --- /dev/null +++ b/sfu/janus/api.go @@ -0,0 +1,514 @@ +/** + * Standalone signaling server for the Nextcloud Spreed app. + * Copyright (C) 2026 struktur AG + * + * @author Joachim Bauch + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package janus + +import ( + "encoding/json" + "fmt" +) + +const ( + janusEventTypeSession = 1 + + janusEventTypeHandle = 2 + + janusEventTypeExternal = 4 + + janusEventTypeJSEP = 8 + + janusEventTypeWebRTC = 16 + janusEventSubTypeWebRTCICE = 1 + janusEventSubTypeWebRTCLocalCandidate = 2 + janusEventSubTypeWebRTCRemoteCandidate = 3 + janusEventSubTypeWebRTCSelectedPair = 4 + janusEventSubTypeWebRTCDTLS = 5 + janusEventSubTypeWebRTCPeerConnection = 6 + + janusEventTypeMedia = 32 + janusEventSubTypeMediaState = 1 + janusEventSubTypeMediaSlowLink = 2 + janusEventSubTypeMediaStats = 3 + + janusEventTypePlugin = 64 + + janusEventTypeTransport = 128 + + janusEventTypeCore = 256 + janusEventSubTypeCoreStatusStartup = 1 + janusEventSubTypeCoreStatusShutdown = 2 +) + +func unmarshalEvent[T any](data json.RawMessage) (*T, error) { + var e T + if err := json.Unmarshal(data, &e); err != nil { + return nil, err + } + + return &e, nil +} + +func marshalEvent[T any](e T) string { + data, err := json.Marshal(e) + if err != nil { + return fmt.Sprintf("Could not serialize %#v: %s", e, err) + } + + return string(data) +} + +type janusEvent struct { + Emitter string `json:"emitter"` + Type int `json:"type"` + SubType int `json:"subtype,omitempty"` + Timestamp uint64 `json:"timestamp"` + SessionId uint64 `json:"session_id,omitempty"` + HandleId uint64 `json:"handle_id,omitempty"` + OpaqueId uint64 `json:"opaque_id,omitempty"` + Event json.RawMessage `json:"event"` +} + +func (e janusEvent) String() string { + return marshalEvent(e) +} + +func (e janusEvent) Decode() (any, error) { + switch e.Type { + case janusEventTypeSession: + return unmarshalEvent[janusEventSession](e.Event) + case janusEventTypeHandle: + return unmarshalEvent[janusEventHandle](e.Event) + case janusEventTypeExternal: + return unmarshalEvent[janusEventExternal](e.Event) + case janusEventTypeJSEP: + return unmarshalEvent[janusEventJSEP](e.Event) + case janusEventTypeWebRTC: + switch e.SubType { + case janusEventSubTypeWebRTCICE: + return unmarshalEvent[janusEventWebRTCICE](e.Event) + case janusEventSubTypeWebRTCLocalCandidate: + return unmarshalEvent[janusEventWebRTCLocalCandidate](e.Event) + case janusEventSubTypeWebRTCRemoteCandidate: + return unmarshalEvent[janusEventWebRTCRemoteCandidate](e.Event) + case janusEventSubTypeWebRTCSelectedPair: + return unmarshalEvent[janusEventWebRTCSelectedPair](e.Event) + case janusEventSubTypeWebRTCDTLS: + return unmarshalEvent[janusEventWebRTCDTLS](e.Event) + case janusEventSubTypeWebRTCPeerConnection: + return unmarshalEvent[janusEventWebRTCPeerConnection](e.Event) + } + case janusEventTypeMedia: + switch e.SubType { + case janusEventSubTypeMediaState: + return unmarshalEvent[janusEventMediaState](e.Event) + case janusEventSubTypeMediaSlowLink: + return unmarshalEvent[janusEventMediaSlowLink](e.Event) + case janusEventSubTypeMediaStats: + return unmarshalEvent[janusEventMediaStats](e.Event) + } + case janusEventTypePlugin: + return unmarshalEvent[janusEventPlugin](e.Event) + case janusEventTypeTransport: + return unmarshalEvent[janusEventTransport](e.Event) + case janusEventTypeCore: + switch e.SubType { + case janusEventSubTypeCoreStatusStartup: + event, err := unmarshalEvent[janusEventCoreStartup](e.Event) + if err != nil { + return nil, err + } + + switch event.Status { + case "started": + return unmarshalEvent[janusEventStatusStartupInfo](event.Info) + case "update": + return unmarshalEvent[janusEventStatusUpdateInfo](event.Info) + } + + return event, nil + case janusEventSubTypeCoreStatusShutdown: + return unmarshalEvent[janusEventCoreShutdown](e.Event) + } + } + + return nil, fmt.Errorf("unsupported event type %d", e.Type) +} + +type janusEventSessionTransport struct { + Transport string `json:"transport"` + ID string `json:"id"` +} + +// type=1 +type janusEventSession struct { + Name string `json:"name"` // "created", "destroyed", "timeout" + + Transport *janusEventSessionTransport `json:"transport,omitempty"` +} + +func (e janusEventSession) String() string { + return marshalEvent(e) +} + +// type=2 +type janusEventHandle struct { + Name string `json:"name"` // "attached", "detached" + Plugin string `json:"plugin"` + Token string `json:"token,omitempty"` + // Deprecated + OpaqueId string `json:"opaque_id,omitempty"` +} + +func (e janusEventHandle) String() string { + return marshalEvent(e) +} + +// type=4 +type janusEventExternal struct { + Schema string `json:"schema"` + Data json.RawMessage `json:"data"` +} + +func (e janusEventExternal) String() string { + return marshalEvent(e) +} + +// type=8 +type janusEventJSEP struct { + Owner string `json:"owner"` + Jsep struct { + Type string `json:"type"` + SDP string `json:"sdp"` + } `json:"jsep"` +} + +func (e janusEventJSEP) String() string { + return marshalEvent(e) +} + +// type=16, subtype=1 +type janusEventWebRTCICE struct { + ICE string `json:"ice"` // "gathering", "connecting", "connected", "ready" + StreamID int `json:"stream_id"` + ComponentID int `json:"component_id"` +} + +func (e janusEventWebRTCICE) String() string { + return marshalEvent(e) +} + +// type=16, subtype=2 +type janusEventWebRTCLocalCandidate struct { + LocalCandidate string `json:"local-candidate"` + StreamID int `json:"stream_id"` + ComponentID int `json:"component_id"` +} + +func (e janusEventWebRTCLocalCandidate) String() string { + return marshalEvent(e) +} + +// type=16, subtype=3 +type janusEventWebRTCRemoteCandidate struct { + RemoteCandidate string `json:"remote-candidate"` + StreamID int `json:"stream_id"` + ComponentID int `json:"component_id"` +} + +func (e janusEventWebRTCRemoteCandidate) String() string { + return marshalEvent(e) +} + +type janusEventCandidate struct { + Address string `json:"address"` + Port int `json:"port"` + Type string `json:"type"` + Transport string `json:"transport"` + Family int `json:"family"` +} + +func (e janusEventCandidate) String() string { + return marshalEvent(e) +} + +type janusEventCandidates struct { + Local janusEventCandidate `json:"local"` + Remote janusEventCandidate `json:"remote"` +} + +func (e janusEventCandidates) String() string { + return marshalEvent(e) +} + +// type=16, subtype=4 +type janusEventWebRTCSelectedPair struct { + StreamID int `json:"stream_id"` + ComponentID int `json:"component_id"` + + SelectedPair string `json:"selected-pair"` + Candidates janusEventCandidates `json:"candidates"` +} + +func (e janusEventWebRTCSelectedPair) String() string { + return marshalEvent(e) +} + +// type=16, subtype=5 +type janusEventWebRTCDTLS struct { + DTLS string `json:"dtls"` // "trying", "connected" + + StreamID int `json:"stream_id"` + ComponentID int `json:"component_id"` + + Retransmissions int `json:"retransmissions"` +} + +func (e janusEventWebRTCDTLS) String() string { + return marshalEvent(e) +} + +// type=16, subtype=6 +type janusEventWebRTCPeerConnection struct { + Connection string `json:"connection"` // "webrtcup", "hangup" + Reason string `json:"reason,omitempty"` // Only if "connection" == "hangup" +} + +func (e janusEventWebRTCPeerConnection) String() string { + return marshalEvent(e) +} + +// type=32, subtype=1 +type janusEventMediaState struct { + Media string `json:"media"` // "audio", "video" + MID string `json:"mid"` + SubStream *int `json:"substream,omitempty"` + Receiving bool `json:"receiving"` + Seconds int `json:"seconds"` +} + +func (e janusEventMediaState) String() string { + return marshalEvent(e) +} + +// type=32, subtype=2 +type janusEventMediaSlowLink struct { + Media string `json:"media"` // "audio", "video" + MID string `json:"mid"` + SlowLink string `json:"slow_link"` // "uplink", "downlink" + LostLastSec int `json:"lost_lastsec"` +} + +func (e janusEventMediaSlowLink) String() string { + return marshalEvent(e) +} + +type janusMediaStatsRTTValues struct { + NTP uint32 `json:"ntp"` + LSR uint32 `json:"lsr"` + DLSR uint32 `json:"dlsr"` +} + +func (e janusMediaStatsRTTValues) String() string { + return marshalEvent(e) +} + +// type=32, subtype=3 +type janusEventMediaStats struct { + MID string `json:"mid"` + MIndex int `json:"mindex"` + Media string `json:"media"` // "audio", "video", "video-sim1", "video-sim2" + + // Audio / video only + Codec string `json:"codec,omitempty"` + Base uint32 `json:"base"` + Lost int32 `json:"lost"` + LostByRemote int32 `json:"lost-by-remote"` + JitterLocal uint32 `json:"jitter-local"` + JitterRemote uint32 `json:"jitter-remote"` + InLinkQuality uint32 `json:"in-link-quality"` + InMediaLinkQuality uint32 `json:"in-media-link-quality"` + OutLinkQuality uint32 `json:"out-link-quality"` + OutMediaLinkQuality uint32 `json:"out-media-link-quality"` + BytesReceivedLastSec uint32 `json:"bytes-received-lastsec"` + BytesSentLastSec uint32 `json:"bytes-sent-lastsec"` + NacksReceived uint32 `json:"nacks-received"` + NacksSent uint32 `json:"nacks-sent"` + RetransmissionsReceived uint32 `json:"retransmissions-received"` + + // Only for audio / video on layer 0 + RTT uint32 `json:"rtt,omitempty"` + // Only for audio / video on layer 0 if RTCP is active + RTTValues *janusMediaStatsRTTValues `json:"rtt-values,omitempty"` + + // For all media on all layers + PacketsReceived uint32 `json:"packets-received"` + PacketsSent uint32 `json:"packets-sent"` + BytesReceived uint64 `json:"bytes-received"` + BytesSent uint64 `json:"bytes-sent"` + + // For layer 0 if REMB is enabled + REMBBitrate uint32 `json:"remb-bitrate"` +} + +func (e janusEventMediaStats) String() string { + return marshalEvent(e) +} + +// type=64 +type janusEventPlugin struct { + Plugin string `json:"plugin"` + Data json.RawMessage `json:"data"` +} + +func (e janusEventPlugin) String() string { + return marshalEvent(e) +} + +type janusEventTransportWebsocket struct { + Event string `json:"event"` + AdminApi bool `json:"admin_api,omitempty"` + IP string `json:"ip,omitempty"` +} + +// type=128 +type janusEventTransport struct { + Transport string `json:"transport"` + Id string `json:"id"` + Data janusEventTransportWebsocket `json:"data"` +} + +func (e janusEventTransport) String() string { + return marshalEvent(e) +} + +type janusEventDependenciesInfo struct { + Glib2 string `json:"glib2"` + Jansson string `json:"jansson"` + Libnice string `json:"libnice"` + Libsrtp string `json:"libsrtp"` + Libcurl string `json:"libcurl,omitempty"` + Crypto string `json:"crypto"` +} + +func (e janusEventDependenciesInfo) String() string { + return marshalEvent(e) +} + +type janusEventPluginInfo struct { + Name string `json:"name"` + Author string `json:"author"` + Description string `json:"description"` + VersionString string `json:"version_string"` + Version int `json:"version"` +} + +func (e janusEventPluginInfo) String() string { + return marshalEvent(e) +} + +// type=256, subtype=1, status="startup" +type janusEventStatusStartupInfo struct { + Janus string `json:"janus"` + Version int `json:"version"` + VersionString string `json:"version_string"` + Author string `json:"author"` + CommitHash string `json:"commit-hash"` + CompileTime string `json:"compile-time"` + LogToStdout bool `json:"log-to-stdout"` + LogToFile bool `json:"log-to-file"` + LogPath string `json:"log-path,omitempty"` + DataChannels bool `json:"data_channels"` + AcceptingNewSessions bool `json:"accepting-new-sessions"` + SessionTimeout int `json:"session-timeout"` + ReclaimSessionTimeout int `json:"reclaim-session-timeout"` + CandidatesTimeout int `json:"candidates-timeout"` + ServerName string `json:"server-name"` + LocalIP string `json:"local-ip"` + PublicIP string `json:"public-ip,omitempty"` + PublicIPs []string `json:"public-ips,omitempty"` + IPv6 bool `json:"ipv6"` + IPv6LinkLocal bool `json:"ipv6-link-local,omitempty"` + ICELite bool `json:"ice-lite"` + ICETCP bool `json:"ice-tcp"` + ICENomination string `json:"ice-nomination,omitempty"` + ICEConsentFreshness bool `json:"ice-consent-freshness"` + ICEKeepaliveConncheck bool `json:"ice-keepalive-conncheck"` + HangupOnFailed bool `json:"hangup-on-failed"` + FullTrickle bool `json:"full-trickle"` + MDNSEnabled bool `json:"mdns-enabled"` + MinNACKQueue int `json:"min-nack-queue"` + NACKOptimizations bool `json:"nack-optimizations"` + TWCCPeriod int `json:"twcc-period"` + DSCP int `json:"dscp,omitempty"` + DTLSMCU int `json:"dtls-mcu"` + STUNServer string `json:"stun-server,omitempty"` + TURNServer string `json:"turn-server,omitempty"` + AllowForceRelay bool `json:"allow-force-relay,omitempty"` + StaticEventLoops int `json:"static-event-loops"` + LoopIndication bool `json:"loop-indication,omitempty"` + APISecret bool `json:"api_secret"` + AuthToken bool `json:"auth_token"` + EventHandlers bool `json:"event_handlers"` + OpaqueIdInAPI bool `json:"opaqueid_in_api"` + WebRTCEncryption bool `json:"webrtc_encryption"` + + Dependencies *janusEventDependenciesInfo `json:"dependencies,omitempty"` + Transports map[string]janusEventPluginInfo `json:"transports,omitempty"` + Events map[string]janusEventPluginInfo `json:"events,omitempty"` + Loggers map[string]janusEventPluginInfo `json:"loggers,omitempty"` + Plugins map[string]janusEventPluginInfo `json:"plugins,omitempty"` +} + +func (e janusEventStatusStartupInfo) String() string { + return marshalEvent(e) +} + +// type=256, subtype=1, status="update" +type janusEventStatusUpdateInfo struct { + Sessions int `json:"sessions"` + Handles int `json:"handles"` + PeerConnections int `json:"peerconnections"` + StatsPeriod int `json:"stats-period"` +} + +func (e janusEventStatusUpdateInfo) String() string { + return marshalEvent(e) +} + +// type=256, subtype=1 +type janusEventCoreStartup struct { + Status string `json:"status"` + Info json.RawMessage `json:"info"` +} + +func (e janusEventCoreStartup) String() string { + return marshalEvent(e) +} + +// type=256, subtype=2 +type janusEventCoreShutdown struct { + Status string `json:"status"` + Signum int `json:"signum"` +} + +func (e janusEventCoreShutdown) String() string { + return marshalEvent(e) +} diff --git a/sfu/janus/api_easyjson.go b/sfu/janus/api_easyjson.go new file mode 100644 index 0000000..ed78b1a --- /dev/null +++ b/sfu/janus/api_easyjson.go @@ -0,0 +1,3467 @@ +// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. + +package janus + +import ( + json "encoding/json" + easyjson "github.com/mailru/easyjson" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" +) + +// suppress unused package warning +var ( + _ *json.RawMessage + _ *jlexer.Lexer + _ *jwriter.Writer + _ easyjson.Marshaler +) + +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus(in *jlexer.Lexer, out *janusMediaStatsRTTValues) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "ntp": + if in.IsNull() { + in.Skip() + } else { + out.NTP = uint32(in.Uint32()) + } + case "lsr": + if in.IsNull() { + in.Skip() + } else { + out.LSR = uint32(in.Uint32()) + } + case "dlsr": + if in.IsNull() { + in.Skip() + } else { + out.DLSR = uint32(in.Uint32()) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus(out *jwriter.Writer, in janusMediaStatsRTTValues) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"ntp\":" + out.RawString(prefix[1:]) + out.Uint32(uint32(in.NTP)) + } + { + const prefix string = ",\"lsr\":" + out.RawString(prefix) + out.Uint32(uint32(in.LSR)) + } + { + const prefix string = ",\"dlsr\":" + out.RawString(prefix) + out.Uint32(uint32(in.DLSR)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusMediaStatsRTTValues) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusMediaStatsRTTValues) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusMediaStatsRTTValues) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusMediaStatsRTTValues) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus1(in *jlexer.Lexer, out *janusEventWebRTCSelectedPair) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "stream_id": + if in.IsNull() { + in.Skip() + } else { + out.StreamID = int(in.Int()) + } + case "component_id": + if in.IsNull() { + in.Skip() + } else { + out.ComponentID = int(in.Int()) + } + case "selected-pair": + if in.IsNull() { + in.Skip() + } else { + out.SelectedPair = string(in.String()) + } + case "candidates": + if in.IsNull() { + in.Skip() + } else { + (out.Candidates).UnmarshalEasyJSON(in) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus1(out *jwriter.Writer, in janusEventWebRTCSelectedPair) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"stream_id\":" + out.RawString(prefix[1:]) + out.Int(int(in.StreamID)) + } + { + const prefix string = ",\"component_id\":" + out.RawString(prefix) + out.Int(int(in.ComponentID)) + } + { + const prefix string = ",\"selected-pair\":" + out.RawString(prefix) + out.String(string(in.SelectedPair)) + } + { + const prefix string = ",\"candidates\":" + out.RawString(prefix) + (in.Candidates).MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventWebRTCSelectedPair) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus1(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventWebRTCSelectedPair) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus1(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventWebRTCSelectedPair) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus1(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventWebRTCSelectedPair) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus1(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus2(in *jlexer.Lexer, out *janusEventWebRTCRemoteCandidate) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "remote-candidate": + if in.IsNull() { + in.Skip() + } else { + out.RemoteCandidate = string(in.String()) + } + case "stream_id": + if in.IsNull() { + in.Skip() + } else { + out.StreamID = int(in.Int()) + } + case "component_id": + if in.IsNull() { + in.Skip() + } else { + out.ComponentID = int(in.Int()) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus2(out *jwriter.Writer, in janusEventWebRTCRemoteCandidate) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"remote-candidate\":" + out.RawString(prefix[1:]) + out.String(string(in.RemoteCandidate)) + } + { + const prefix string = ",\"stream_id\":" + out.RawString(prefix) + out.Int(int(in.StreamID)) + } + { + const prefix string = ",\"component_id\":" + out.RawString(prefix) + out.Int(int(in.ComponentID)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventWebRTCRemoteCandidate) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus2(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventWebRTCRemoteCandidate) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus2(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventWebRTCRemoteCandidate) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus2(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventWebRTCRemoteCandidate) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus2(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus3(in *jlexer.Lexer, out *janusEventWebRTCPeerConnection) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "connection": + if in.IsNull() { + in.Skip() + } else { + out.Connection = string(in.String()) + } + case "reason": + if in.IsNull() { + in.Skip() + } else { + out.Reason = string(in.String()) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus3(out *jwriter.Writer, in janusEventWebRTCPeerConnection) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"connection\":" + out.RawString(prefix[1:]) + out.String(string(in.Connection)) + } + if in.Reason != "" { + const prefix string = ",\"reason\":" + out.RawString(prefix) + out.String(string(in.Reason)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventWebRTCPeerConnection) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus3(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventWebRTCPeerConnection) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus3(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventWebRTCPeerConnection) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus3(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventWebRTCPeerConnection) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus3(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus4(in *jlexer.Lexer, out *janusEventWebRTCLocalCandidate) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "local-candidate": + if in.IsNull() { + in.Skip() + } else { + out.LocalCandidate = string(in.String()) + } + case "stream_id": + if in.IsNull() { + in.Skip() + } else { + out.StreamID = int(in.Int()) + } + case "component_id": + if in.IsNull() { + in.Skip() + } else { + out.ComponentID = int(in.Int()) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus4(out *jwriter.Writer, in janusEventWebRTCLocalCandidate) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"local-candidate\":" + out.RawString(prefix[1:]) + out.String(string(in.LocalCandidate)) + } + { + const prefix string = ",\"stream_id\":" + out.RawString(prefix) + out.Int(int(in.StreamID)) + } + { + const prefix string = ",\"component_id\":" + out.RawString(prefix) + out.Int(int(in.ComponentID)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventWebRTCLocalCandidate) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus4(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventWebRTCLocalCandidate) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus4(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventWebRTCLocalCandidate) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus4(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventWebRTCLocalCandidate) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus4(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus5(in *jlexer.Lexer, out *janusEventWebRTCICE) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "ice": + if in.IsNull() { + in.Skip() + } else { + out.ICE = string(in.String()) + } + case "stream_id": + if in.IsNull() { + in.Skip() + } else { + out.StreamID = int(in.Int()) + } + case "component_id": + if in.IsNull() { + in.Skip() + } else { + out.ComponentID = int(in.Int()) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus5(out *jwriter.Writer, in janusEventWebRTCICE) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"ice\":" + out.RawString(prefix[1:]) + out.String(string(in.ICE)) + } + { + const prefix string = ",\"stream_id\":" + out.RawString(prefix) + out.Int(int(in.StreamID)) + } + { + const prefix string = ",\"component_id\":" + out.RawString(prefix) + out.Int(int(in.ComponentID)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventWebRTCICE) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus5(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventWebRTCICE) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus5(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventWebRTCICE) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus5(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventWebRTCICE) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus5(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus6(in *jlexer.Lexer, out *janusEventWebRTCDTLS) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "dtls": + if in.IsNull() { + in.Skip() + } else { + out.DTLS = string(in.String()) + } + case "stream_id": + if in.IsNull() { + in.Skip() + } else { + out.StreamID = int(in.Int()) + } + case "component_id": + if in.IsNull() { + in.Skip() + } else { + out.ComponentID = int(in.Int()) + } + case "retransmissions": + if in.IsNull() { + in.Skip() + } else { + out.Retransmissions = int(in.Int()) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus6(out *jwriter.Writer, in janusEventWebRTCDTLS) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"dtls\":" + out.RawString(prefix[1:]) + out.String(string(in.DTLS)) + } + { + const prefix string = ",\"stream_id\":" + out.RawString(prefix) + out.Int(int(in.StreamID)) + } + { + const prefix string = ",\"component_id\":" + out.RawString(prefix) + out.Int(int(in.ComponentID)) + } + { + const prefix string = ",\"retransmissions\":" + out.RawString(prefix) + out.Int(int(in.Retransmissions)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventWebRTCDTLS) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus6(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventWebRTCDTLS) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus6(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventWebRTCDTLS) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus6(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventWebRTCDTLS) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus6(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus7(in *jlexer.Lexer, out *janusEventTransportWebsocket) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "event": + if in.IsNull() { + in.Skip() + } else { + out.Event = string(in.String()) + } + case "admin_api": + if in.IsNull() { + in.Skip() + } else { + out.AdminApi = bool(in.Bool()) + } + case "ip": + if in.IsNull() { + in.Skip() + } else { + out.IP = string(in.String()) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus7(out *jwriter.Writer, in janusEventTransportWebsocket) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"event\":" + out.RawString(prefix[1:]) + out.String(string(in.Event)) + } + if in.AdminApi { + const prefix string = ",\"admin_api\":" + out.RawString(prefix) + out.Bool(bool(in.AdminApi)) + } + if in.IP != "" { + const prefix string = ",\"ip\":" + out.RawString(prefix) + out.String(string(in.IP)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventTransportWebsocket) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus7(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventTransportWebsocket) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus7(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventTransportWebsocket) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus7(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventTransportWebsocket) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus7(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus8(in *jlexer.Lexer, out *janusEventTransport) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "transport": + if in.IsNull() { + in.Skip() + } else { + out.Transport = string(in.String()) + } + case "id": + if in.IsNull() { + in.Skip() + } else { + out.Id = string(in.String()) + } + case "data": + if in.IsNull() { + in.Skip() + } else { + (out.Data).UnmarshalEasyJSON(in) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus8(out *jwriter.Writer, in janusEventTransport) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"transport\":" + out.RawString(prefix[1:]) + out.String(string(in.Transport)) + } + { + const prefix string = ",\"id\":" + out.RawString(prefix) + out.String(string(in.Id)) + } + { + const prefix string = ",\"data\":" + out.RawString(prefix) + (in.Data).MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventTransport) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus8(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventTransport) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus8(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventTransport) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus8(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventTransport) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus8(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus9(in *jlexer.Lexer, out *janusEventStatusUpdateInfo) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "sessions": + if in.IsNull() { + in.Skip() + } else { + out.Sessions = int(in.Int()) + } + case "handles": + if in.IsNull() { + in.Skip() + } else { + out.Handles = int(in.Int()) + } + case "peerconnections": + if in.IsNull() { + in.Skip() + } else { + out.PeerConnections = int(in.Int()) + } + case "stats-period": + if in.IsNull() { + in.Skip() + } else { + out.StatsPeriod = int(in.Int()) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus9(out *jwriter.Writer, in janusEventStatusUpdateInfo) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"sessions\":" + out.RawString(prefix[1:]) + out.Int(int(in.Sessions)) + } + { + const prefix string = ",\"handles\":" + out.RawString(prefix) + out.Int(int(in.Handles)) + } + { + const prefix string = ",\"peerconnections\":" + out.RawString(prefix) + out.Int(int(in.PeerConnections)) + } + { + const prefix string = ",\"stats-period\":" + out.RawString(prefix) + out.Int(int(in.StatsPeriod)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventStatusUpdateInfo) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus9(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventStatusUpdateInfo) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus9(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventStatusUpdateInfo) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus9(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventStatusUpdateInfo) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus9(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus10(in *jlexer.Lexer, out *janusEventStatusStartupInfo) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "janus": + if in.IsNull() { + in.Skip() + } else { + out.Janus = string(in.String()) + } + case "version": + if in.IsNull() { + in.Skip() + } else { + out.Version = int(in.Int()) + } + case "version_string": + if in.IsNull() { + in.Skip() + } else { + out.VersionString = string(in.String()) + } + case "author": + if in.IsNull() { + in.Skip() + } else { + out.Author = string(in.String()) + } + case "commit-hash": + if in.IsNull() { + in.Skip() + } else { + out.CommitHash = string(in.String()) + } + case "compile-time": + if in.IsNull() { + in.Skip() + } else { + out.CompileTime = string(in.String()) + } + case "log-to-stdout": + if in.IsNull() { + in.Skip() + } else { + out.LogToStdout = bool(in.Bool()) + } + case "log-to-file": + if in.IsNull() { + in.Skip() + } else { + out.LogToFile = bool(in.Bool()) + } + case "log-path": + if in.IsNull() { + in.Skip() + } else { + out.LogPath = string(in.String()) + } + case "data_channels": + if in.IsNull() { + in.Skip() + } else { + out.DataChannels = bool(in.Bool()) + } + case "accepting-new-sessions": + if in.IsNull() { + in.Skip() + } else { + out.AcceptingNewSessions = bool(in.Bool()) + } + case "session-timeout": + if in.IsNull() { + in.Skip() + } else { + out.SessionTimeout = int(in.Int()) + } + case "reclaim-session-timeout": + if in.IsNull() { + in.Skip() + } else { + out.ReclaimSessionTimeout = int(in.Int()) + } + case "candidates-timeout": + if in.IsNull() { + in.Skip() + } else { + out.CandidatesTimeout = int(in.Int()) + } + case "server-name": + if in.IsNull() { + in.Skip() + } else { + out.ServerName = string(in.String()) + } + case "local-ip": + if in.IsNull() { + in.Skip() + } else { + out.LocalIP = string(in.String()) + } + case "public-ip": + if in.IsNull() { + in.Skip() + } else { + out.PublicIP = string(in.String()) + } + case "public-ips": + if in.IsNull() { + in.Skip() + out.PublicIPs = nil + } else { + in.Delim('[') + if out.PublicIPs == nil { + if !in.IsDelim(']') { + out.PublicIPs = make([]string, 0, 4) + } else { + out.PublicIPs = []string{} + } + } else { + out.PublicIPs = (out.PublicIPs)[:0] + } + for !in.IsDelim(']') { + var v1 string + if in.IsNull() { + in.Skip() + } else { + v1 = string(in.String()) + } + out.PublicIPs = append(out.PublicIPs, v1) + in.WantComma() + } + in.Delim(']') + } + case "ipv6": + if in.IsNull() { + in.Skip() + } else { + out.IPv6 = bool(in.Bool()) + } + case "ipv6-link-local": + if in.IsNull() { + in.Skip() + } else { + out.IPv6LinkLocal = bool(in.Bool()) + } + case "ice-lite": + if in.IsNull() { + in.Skip() + } else { + out.ICELite = bool(in.Bool()) + } + case "ice-tcp": + if in.IsNull() { + in.Skip() + } else { + out.ICETCP = bool(in.Bool()) + } + case "ice-nomination": + if in.IsNull() { + in.Skip() + } else { + out.ICENomination = string(in.String()) + } + case "ice-consent-freshness": + if in.IsNull() { + in.Skip() + } else { + out.ICEConsentFreshness = bool(in.Bool()) + } + case "ice-keepalive-conncheck": + if in.IsNull() { + in.Skip() + } else { + out.ICEKeepaliveConncheck = bool(in.Bool()) + } + case "hangup-on-failed": + if in.IsNull() { + in.Skip() + } else { + out.HangupOnFailed = bool(in.Bool()) + } + case "full-trickle": + if in.IsNull() { + in.Skip() + } else { + out.FullTrickle = bool(in.Bool()) + } + case "mdns-enabled": + if in.IsNull() { + in.Skip() + } else { + out.MDNSEnabled = bool(in.Bool()) + } + case "min-nack-queue": + if in.IsNull() { + in.Skip() + } else { + out.MinNACKQueue = int(in.Int()) + } + case "nack-optimizations": + if in.IsNull() { + in.Skip() + } else { + out.NACKOptimizations = bool(in.Bool()) + } + case "twcc-period": + if in.IsNull() { + in.Skip() + } else { + out.TWCCPeriod = int(in.Int()) + } + case "dscp": + if in.IsNull() { + in.Skip() + } else { + out.DSCP = int(in.Int()) + } + case "dtls-mcu": + if in.IsNull() { + in.Skip() + } else { + out.DTLSMCU = int(in.Int()) + } + case "stun-server": + if in.IsNull() { + in.Skip() + } else { + out.STUNServer = string(in.String()) + } + case "turn-server": + if in.IsNull() { + in.Skip() + } else { + out.TURNServer = string(in.String()) + } + case "allow-force-relay": + if in.IsNull() { + in.Skip() + } else { + out.AllowForceRelay = bool(in.Bool()) + } + case "static-event-loops": + if in.IsNull() { + in.Skip() + } else { + out.StaticEventLoops = int(in.Int()) + } + case "loop-indication": + if in.IsNull() { + in.Skip() + } else { + out.LoopIndication = bool(in.Bool()) + } + case "api_secret": + if in.IsNull() { + in.Skip() + } else { + out.APISecret = bool(in.Bool()) + } + case "auth_token": + if in.IsNull() { + in.Skip() + } else { + out.AuthToken = bool(in.Bool()) + } + case "event_handlers": + if in.IsNull() { + in.Skip() + } else { + out.EventHandlers = bool(in.Bool()) + } + case "opaqueid_in_api": + if in.IsNull() { + in.Skip() + } else { + out.OpaqueIdInAPI = bool(in.Bool()) + } + case "webrtc_encryption": + if in.IsNull() { + in.Skip() + } else { + out.WebRTCEncryption = bool(in.Bool()) + } + case "dependencies": + if in.IsNull() { + in.Skip() + out.Dependencies = nil + } else { + if out.Dependencies == nil { + out.Dependencies = new(janusEventDependenciesInfo) + } + if in.IsNull() { + in.Skip() + } else { + (*out.Dependencies).UnmarshalEasyJSON(in) + } + } + case "transports": + if in.IsNull() { + in.Skip() + } else { + in.Delim('{') + if !in.IsDelim('}') { + out.Transports = make(map[string]janusEventPluginInfo) + } else { + out.Transports = nil + } + for !in.IsDelim('}') { + key := string(in.String()) + in.WantColon() + var v2 janusEventPluginInfo + if in.IsNull() { + in.Skip() + } else { + (v2).UnmarshalEasyJSON(in) + } + (out.Transports)[key] = v2 + in.WantComma() + } + in.Delim('}') + } + case "events": + if in.IsNull() { + in.Skip() + } else { + in.Delim('{') + if !in.IsDelim('}') { + out.Events = make(map[string]janusEventPluginInfo) + } else { + out.Events = nil + } + for !in.IsDelim('}') { + key := string(in.String()) + in.WantColon() + var v3 janusEventPluginInfo + if in.IsNull() { + in.Skip() + } else { + (v3).UnmarshalEasyJSON(in) + } + (out.Events)[key] = v3 + in.WantComma() + } + in.Delim('}') + } + case "loggers": + if in.IsNull() { + in.Skip() + } else { + in.Delim('{') + if !in.IsDelim('}') { + out.Loggers = make(map[string]janusEventPluginInfo) + } else { + out.Loggers = nil + } + for !in.IsDelim('}') { + key := string(in.String()) + in.WantColon() + var v4 janusEventPluginInfo + if in.IsNull() { + in.Skip() + } else { + (v4).UnmarshalEasyJSON(in) + } + (out.Loggers)[key] = v4 + in.WantComma() + } + in.Delim('}') + } + case "plugins": + if in.IsNull() { + in.Skip() + } else { + in.Delim('{') + if !in.IsDelim('}') { + out.Plugins = make(map[string]janusEventPluginInfo) + } else { + out.Plugins = nil + } + for !in.IsDelim('}') { + key := string(in.String()) + in.WantColon() + var v5 janusEventPluginInfo + if in.IsNull() { + in.Skip() + } else { + (v5).UnmarshalEasyJSON(in) + } + (out.Plugins)[key] = v5 + in.WantComma() + } + in.Delim('}') + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus10(out *jwriter.Writer, in janusEventStatusStartupInfo) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"janus\":" + out.RawString(prefix[1:]) + out.String(string(in.Janus)) + } + { + const prefix string = ",\"version\":" + out.RawString(prefix) + out.Int(int(in.Version)) + } + { + const prefix string = ",\"version_string\":" + out.RawString(prefix) + out.String(string(in.VersionString)) + } + { + const prefix string = ",\"author\":" + out.RawString(prefix) + out.String(string(in.Author)) + } + { + const prefix string = ",\"commit-hash\":" + out.RawString(prefix) + out.String(string(in.CommitHash)) + } + { + const prefix string = ",\"compile-time\":" + out.RawString(prefix) + out.String(string(in.CompileTime)) + } + { + const prefix string = ",\"log-to-stdout\":" + out.RawString(prefix) + out.Bool(bool(in.LogToStdout)) + } + { + const prefix string = ",\"log-to-file\":" + out.RawString(prefix) + out.Bool(bool(in.LogToFile)) + } + if in.LogPath != "" { + const prefix string = ",\"log-path\":" + out.RawString(prefix) + out.String(string(in.LogPath)) + } + { + const prefix string = ",\"data_channels\":" + out.RawString(prefix) + out.Bool(bool(in.DataChannels)) + } + { + const prefix string = ",\"accepting-new-sessions\":" + out.RawString(prefix) + out.Bool(bool(in.AcceptingNewSessions)) + } + { + const prefix string = ",\"session-timeout\":" + out.RawString(prefix) + out.Int(int(in.SessionTimeout)) + } + { + const prefix string = ",\"reclaim-session-timeout\":" + out.RawString(prefix) + out.Int(int(in.ReclaimSessionTimeout)) + } + { + const prefix string = ",\"candidates-timeout\":" + out.RawString(prefix) + out.Int(int(in.CandidatesTimeout)) + } + { + const prefix string = ",\"server-name\":" + out.RawString(prefix) + out.String(string(in.ServerName)) + } + { + const prefix string = ",\"local-ip\":" + out.RawString(prefix) + out.String(string(in.LocalIP)) + } + if in.PublicIP != "" { + const prefix string = ",\"public-ip\":" + out.RawString(prefix) + out.String(string(in.PublicIP)) + } + if len(in.PublicIPs) != 0 { + const prefix string = ",\"public-ips\":" + out.RawString(prefix) + { + out.RawByte('[') + for v6, v7 := range in.PublicIPs { + if v6 > 0 { + out.RawByte(',') + } + out.String(string(v7)) + } + out.RawByte(']') + } + } + { + const prefix string = ",\"ipv6\":" + out.RawString(prefix) + out.Bool(bool(in.IPv6)) + } + if in.IPv6LinkLocal { + const prefix string = ",\"ipv6-link-local\":" + out.RawString(prefix) + out.Bool(bool(in.IPv6LinkLocal)) + } + { + const prefix string = ",\"ice-lite\":" + out.RawString(prefix) + out.Bool(bool(in.ICELite)) + } + { + const prefix string = ",\"ice-tcp\":" + out.RawString(prefix) + out.Bool(bool(in.ICETCP)) + } + if in.ICENomination != "" { + const prefix string = ",\"ice-nomination\":" + out.RawString(prefix) + out.String(string(in.ICENomination)) + } + { + const prefix string = ",\"ice-consent-freshness\":" + out.RawString(prefix) + out.Bool(bool(in.ICEConsentFreshness)) + } + { + const prefix string = ",\"ice-keepalive-conncheck\":" + out.RawString(prefix) + out.Bool(bool(in.ICEKeepaliveConncheck)) + } + { + const prefix string = ",\"hangup-on-failed\":" + out.RawString(prefix) + out.Bool(bool(in.HangupOnFailed)) + } + { + const prefix string = ",\"full-trickle\":" + out.RawString(prefix) + out.Bool(bool(in.FullTrickle)) + } + { + const prefix string = ",\"mdns-enabled\":" + out.RawString(prefix) + out.Bool(bool(in.MDNSEnabled)) + } + { + const prefix string = ",\"min-nack-queue\":" + out.RawString(prefix) + out.Int(int(in.MinNACKQueue)) + } + { + const prefix string = ",\"nack-optimizations\":" + out.RawString(prefix) + out.Bool(bool(in.NACKOptimizations)) + } + { + const prefix string = ",\"twcc-period\":" + out.RawString(prefix) + out.Int(int(in.TWCCPeriod)) + } + if in.DSCP != 0 { + const prefix string = ",\"dscp\":" + out.RawString(prefix) + out.Int(int(in.DSCP)) + } + { + const prefix string = ",\"dtls-mcu\":" + out.RawString(prefix) + out.Int(int(in.DTLSMCU)) + } + if in.STUNServer != "" { + const prefix string = ",\"stun-server\":" + out.RawString(prefix) + out.String(string(in.STUNServer)) + } + if in.TURNServer != "" { + const prefix string = ",\"turn-server\":" + out.RawString(prefix) + out.String(string(in.TURNServer)) + } + if in.AllowForceRelay { + const prefix string = ",\"allow-force-relay\":" + out.RawString(prefix) + out.Bool(bool(in.AllowForceRelay)) + } + { + const prefix string = ",\"static-event-loops\":" + out.RawString(prefix) + out.Int(int(in.StaticEventLoops)) + } + if in.LoopIndication { + const prefix string = ",\"loop-indication\":" + out.RawString(prefix) + out.Bool(bool(in.LoopIndication)) + } + { + const prefix string = ",\"api_secret\":" + out.RawString(prefix) + out.Bool(bool(in.APISecret)) + } + { + const prefix string = ",\"auth_token\":" + out.RawString(prefix) + out.Bool(bool(in.AuthToken)) + } + { + const prefix string = ",\"event_handlers\":" + out.RawString(prefix) + out.Bool(bool(in.EventHandlers)) + } + { + const prefix string = ",\"opaqueid_in_api\":" + out.RawString(prefix) + out.Bool(bool(in.OpaqueIdInAPI)) + } + { + const prefix string = ",\"webrtc_encryption\":" + out.RawString(prefix) + out.Bool(bool(in.WebRTCEncryption)) + } + if in.Dependencies != nil { + const prefix string = ",\"dependencies\":" + out.RawString(prefix) + (*in.Dependencies).MarshalEasyJSON(out) + } + if len(in.Transports) != 0 { + const prefix string = ",\"transports\":" + out.RawString(prefix) + { + out.RawByte('{') + v8First := true + for v8Name, v8Value := range in.Transports { + if v8First { + v8First = false + } else { + out.RawByte(',') + } + out.String(string(v8Name)) + out.RawByte(':') + (v8Value).MarshalEasyJSON(out) + } + out.RawByte('}') + } + } + if len(in.Events) != 0 { + const prefix string = ",\"events\":" + out.RawString(prefix) + { + out.RawByte('{') + v9First := true + for v9Name, v9Value := range in.Events { + if v9First { + v9First = false + } else { + out.RawByte(',') + } + out.String(string(v9Name)) + out.RawByte(':') + (v9Value).MarshalEasyJSON(out) + } + out.RawByte('}') + } + } + if len(in.Loggers) != 0 { + const prefix string = ",\"loggers\":" + out.RawString(prefix) + { + out.RawByte('{') + v10First := true + for v10Name, v10Value := range in.Loggers { + if v10First { + v10First = false + } else { + out.RawByte(',') + } + out.String(string(v10Name)) + out.RawByte(':') + (v10Value).MarshalEasyJSON(out) + } + out.RawByte('}') + } + } + if len(in.Plugins) != 0 { + const prefix string = ",\"plugins\":" + out.RawString(prefix) + { + out.RawByte('{') + v11First := true + for v11Name, v11Value := range in.Plugins { + if v11First { + v11First = false + } else { + out.RawByte(',') + } + out.String(string(v11Name)) + out.RawByte(':') + (v11Value).MarshalEasyJSON(out) + } + out.RawByte('}') + } + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventStatusStartupInfo) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus10(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventStatusStartupInfo) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus10(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventStatusStartupInfo) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus10(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventStatusStartupInfo) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus10(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus11(in *jlexer.Lexer, out *janusEventSessionTransport) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "transport": + if in.IsNull() { + in.Skip() + } else { + out.Transport = string(in.String()) + } + case "id": + if in.IsNull() { + in.Skip() + } else { + out.ID = string(in.String()) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus11(out *jwriter.Writer, in janusEventSessionTransport) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"transport\":" + out.RawString(prefix[1:]) + out.String(string(in.Transport)) + } + { + const prefix string = ",\"id\":" + out.RawString(prefix) + out.String(string(in.ID)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventSessionTransport) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus11(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventSessionTransport) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus11(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventSessionTransport) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus11(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventSessionTransport) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus11(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus12(in *jlexer.Lexer, out *janusEventSession) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "name": + if in.IsNull() { + in.Skip() + } else { + out.Name = string(in.String()) + } + case "transport": + if in.IsNull() { + in.Skip() + out.Transport = nil + } else { + if out.Transport == nil { + out.Transport = new(janusEventSessionTransport) + } + if in.IsNull() { + in.Skip() + } else { + (*out.Transport).UnmarshalEasyJSON(in) + } + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus12(out *jwriter.Writer, in janusEventSession) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"name\":" + out.RawString(prefix[1:]) + out.String(string(in.Name)) + } + if in.Transport != nil { + const prefix string = ",\"transport\":" + out.RawString(prefix) + (*in.Transport).MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventSession) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus12(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventSession) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus12(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventSession) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus12(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventSession) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus12(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus13(in *jlexer.Lexer, out *janusEventPluginInfo) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "name": + if in.IsNull() { + in.Skip() + } else { + out.Name = string(in.String()) + } + case "author": + if in.IsNull() { + in.Skip() + } else { + out.Author = string(in.String()) + } + case "description": + if in.IsNull() { + in.Skip() + } else { + out.Description = string(in.String()) + } + case "version_string": + if in.IsNull() { + in.Skip() + } else { + out.VersionString = string(in.String()) + } + case "version": + if in.IsNull() { + in.Skip() + } else { + out.Version = int(in.Int()) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus13(out *jwriter.Writer, in janusEventPluginInfo) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"name\":" + out.RawString(prefix[1:]) + out.String(string(in.Name)) + } + { + const prefix string = ",\"author\":" + out.RawString(prefix) + out.String(string(in.Author)) + } + { + const prefix string = ",\"description\":" + out.RawString(prefix) + out.String(string(in.Description)) + } + { + const prefix string = ",\"version_string\":" + out.RawString(prefix) + out.String(string(in.VersionString)) + } + { + const prefix string = ",\"version\":" + out.RawString(prefix) + out.Int(int(in.Version)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventPluginInfo) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus13(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventPluginInfo) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus13(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventPluginInfo) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus13(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventPluginInfo) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus13(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus14(in *jlexer.Lexer, out *janusEventPlugin) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "plugin": + if in.IsNull() { + in.Skip() + } else { + out.Plugin = string(in.String()) + } + case "data": + if in.IsNull() { + in.Skip() + } else { + if data := in.Raw(); in.Ok() { + in.AddError((out.Data).UnmarshalJSON(data)) + } + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus14(out *jwriter.Writer, in janusEventPlugin) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"plugin\":" + out.RawString(prefix[1:]) + out.String(string(in.Plugin)) + } + { + const prefix string = ",\"data\":" + out.RawString(prefix) + out.Raw((in.Data).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventPlugin) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus14(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventPlugin) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus14(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventPlugin) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus14(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventPlugin) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus14(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus15(in *jlexer.Lexer, out *janusEventMediaStats) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "mid": + if in.IsNull() { + in.Skip() + } else { + out.MID = string(in.String()) + } + case "mindex": + if in.IsNull() { + in.Skip() + } else { + out.MIndex = int(in.Int()) + } + case "media": + if in.IsNull() { + in.Skip() + } else { + out.Media = string(in.String()) + } + case "codec": + if in.IsNull() { + in.Skip() + } else { + out.Codec = string(in.String()) + } + case "base": + if in.IsNull() { + in.Skip() + } else { + out.Base = uint32(in.Uint32()) + } + case "lost": + if in.IsNull() { + in.Skip() + } else { + out.Lost = int32(in.Int32()) + } + case "lost-by-remote": + if in.IsNull() { + in.Skip() + } else { + out.LostByRemote = int32(in.Int32()) + } + case "jitter-local": + if in.IsNull() { + in.Skip() + } else { + out.JitterLocal = uint32(in.Uint32()) + } + case "jitter-remote": + if in.IsNull() { + in.Skip() + } else { + out.JitterRemote = uint32(in.Uint32()) + } + case "in-link-quality": + if in.IsNull() { + in.Skip() + } else { + out.InLinkQuality = uint32(in.Uint32()) + } + case "in-media-link-quality": + if in.IsNull() { + in.Skip() + } else { + out.InMediaLinkQuality = uint32(in.Uint32()) + } + case "out-link-quality": + if in.IsNull() { + in.Skip() + } else { + out.OutLinkQuality = uint32(in.Uint32()) + } + case "out-media-link-quality": + if in.IsNull() { + in.Skip() + } else { + out.OutMediaLinkQuality = uint32(in.Uint32()) + } + case "bytes-received-lastsec": + if in.IsNull() { + in.Skip() + } else { + out.BytesReceivedLastSec = uint32(in.Uint32()) + } + case "bytes-sent-lastsec": + if in.IsNull() { + in.Skip() + } else { + out.BytesSentLastSec = uint32(in.Uint32()) + } + case "nacks-received": + if in.IsNull() { + in.Skip() + } else { + out.NacksReceived = uint32(in.Uint32()) + } + case "nacks-sent": + if in.IsNull() { + in.Skip() + } else { + out.NacksSent = uint32(in.Uint32()) + } + case "retransmissions-received": + if in.IsNull() { + in.Skip() + } else { + out.RetransmissionsReceived = uint32(in.Uint32()) + } + case "rtt": + if in.IsNull() { + in.Skip() + } else { + out.RTT = uint32(in.Uint32()) + } + case "rtt-values": + if in.IsNull() { + in.Skip() + out.RTTValues = nil + } else { + if out.RTTValues == nil { + out.RTTValues = new(janusMediaStatsRTTValues) + } + if in.IsNull() { + in.Skip() + } else { + (*out.RTTValues).UnmarshalEasyJSON(in) + } + } + case "packets-received": + if in.IsNull() { + in.Skip() + } else { + out.PacketsReceived = uint32(in.Uint32()) + } + case "packets-sent": + if in.IsNull() { + in.Skip() + } else { + out.PacketsSent = uint32(in.Uint32()) + } + case "bytes-received": + if in.IsNull() { + in.Skip() + } else { + out.BytesReceived = uint64(in.Uint64()) + } + case "bytes-sent": + if in.IsNull() { + in.Skip() + } else { + out.BytesSent = uint64(in.Uint64()) + } + case "remb-bitrate": + if in.IsNull() { + in.Skip() + } else { + out.REMBBitrate = uint32(in.Uint32()) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus15(out *jwriter.Writer, in janusEventMediaStats) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"mid\":" + out.RawString(prefix[1:]) + out.String(string(in.MID)) + } + { + const prefix string = ",\"mindex\":" + out.RawString(prefix) + out.Int(int(in.MIndex)) + } + { + const prefix string = ",\"media\":" + out.RawString(prefix) + out.String(string(in.Media)) + } + if in.Codec != "" { + const prefix string = ",\"codec\":" + out.RawString(prefix) + out.String(string(in.Codec)) + } + { + const prefix string = ",\"base\":" + out.RawString(prefix) + out.Uint32(uint32(in.Base)) + } + { + const prefix string = ",\"lost\":" + out.RawString(prefix) + out.Int32(int32(in.Lost)) + } + { + const prefix string = ",\"lost-by-remote\":" + out.RawString(prefix) + out.Int32(int32(in.LostByRemote)) + } + { + const prefix string = ",\"jitter-local\":" + out.RawString(prefix) + out.Uint32(uint32(in.JitterLocal)) + } + { + const prefix string = ",\"jitter-remote\":" + out.RawString(prefix) + out.Uint32(uint32(in.JitterRemote)) + } + { + const prefix string = ",\"in-link-quality\":" + out.RawString(prefix) + out.Uint32(uint32(in.InLinkQuality)) + } + { + const prefix string = ",\"in-media-link-quality\":" + out.RawString(prefix) + out.Uint32(uint32(in.InMediaLinkQuality)) + } + { + const prefix string = ",\"out-link-quality\":" + out.RawString(prefix) + out.Uint32(uint32(in.OutLinkQuality)) + } + { + const prefix string = ",\"out-media-link-quality\":" + out.RawString(prefix) + out.Uint32(uint32(in.OutMediaLinkQuality)) + } + { + const prefix string = ",\"bytes-received-lastsec\":" + out.RawString(prefix) + out.Uint32(uint32(in.BytesReceivedLastSec)) + } + { + const prefix string = ",\"bytes-sent-lastsec\":" + out.RawString(prefix) + out.Uint32(uint32(in.BytesSentLastSec)) + } + { + const prefix string = ",\"nacks-received\":" + out.RawString(prefix) + out.Uint32(uint32(in.NacksReceived)) + } + { + const prefix string = ",\"nacks-sent\":" + out.RawString(prefix) + out.Uint32(uint32(in.NacksSent)) + } + { + const prefix string = ",\"retransmissions-received\":" + out.RawString(prefix) + out.Uint32(uint32(in.RetransmissionsReceived)) + } + if in.RTT != 0 { + const prefix string = ",\"rtt\":" + out.RawString(prefix) + out.Uint32(uint32(in.RTT)) + } + if in.RTTValues != nil { + const prefix string = ",\"rtt-values\":" + out.RawString(prefix) + (*in.RTTValues).MarshalEasyJSON(out) + } + { + const prefix string = ",\"packets-received\":" + out.RawString(prefix) + out.Uint32(uint32(in.PacketsReceived)) + } + { + const prefix string = ",\"packets-sent\":" + out.RawString(prefix) + out.Uint32(uint32(in.PacketsSent)) + } + { + const prefix string = ",\"bytes-received\":" + out.RawString(prefix) + out.Uint64(uint64(in.BytesReceived)) + } + { + const prefix string = ",\"bytes-sent\":" + out.RawString(prefix) + out.Uint64(uint64(in.BytesSent)) + } + { + const prefix string = ",\"remb-bitrate\":" + out.RawString(prefix) + out.Uint32(uint32(in.REMBBitrate)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventMediaStats) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus15(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventMediaStats) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus15(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventMediaStats) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus15(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventMediaStats) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus15(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus16(in *jlexer.Lexer, out *janusEventMediaState) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "media": + if in.IsNull() { + in.Skip() + } else { + out.Media = string(in.String()) + } + case "mid": + if in.IsNull() { + in.Skip() + } else { + out.MID = string(in.String()) + } + case "substream": + if in.IsNull() { + in.Skip() + out.SubStream = nil + } else { + if out.SubStream == nil { + out.SubStream = new(int) + } + if in.IsNull() { + in.Skip() + } else { + *out.SubStream = int(in.Int()) + } + } + case "receiving": + if in.IsNull() { + in.Skip() + } else { + out.Receiving = bool(in.Bool()) + } + case "seconds": + if in.IsNull() { + in.Skip() + } else { + out.Seconds = int(in.Int()) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus16(out *jwriter.Writer, in janusEventMediaState) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"media\":" + out.RawString(prefix[1:]) + out.String(string(in.Media)) + } + { + const prefix string = ",\"mid\":" + out.RawString(prefix) + out.String(string(in.MID)) + } + if in.SubStream != nil { + const prefix string = ",\"substream\":" + out.RawString(prefix) + out.Int(int(*in.SubStream)) + } + { + const prefix string = ",\"receiving\":" + out.RawString(prefix) + out.Bool(bool(in.Receiving)) + } + { + const prefix string = ",\"seconds\":" + out.RawString(prefix) + out.Int(int(in.Seconds)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventMediaState) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus16(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventMediaState) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus16(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventMediaState) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus16(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventMediaState) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus16(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus17(in *jlexer.Lexer, out *janusEventMediaSlowLink) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "media": + if in.IsNull() { + in.Skip() + } else { + out.Media = string(in.String()) + } + case "mid": + if in.IsNull() { + in.Skip() + } else { + out.MID = string(in.String()) + } + case "slow_link": + if in.IsNull() { + in.Skip() + } else { + out.SlowLink = string(in.String()) + } + case "lost_lastsec": + if in.IsNull() { + in.Skip() + } else { + out.LostLastSec = int(in.Int()) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus17(out *jwriter.Writer, in janusEventMediaSlowLink) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"media\":" + out.RawString(prefix[1:]) + out.String(string(in.Media)) + } + { + const prefix string = ",\"mid\":" + out.RawString(prefix) + out.String(string(in.MID)) + } + { + const prefix string = ",\"slow_link\":" + out.RawString(prefix) + out.String(string(in.SlowLink)) + } + { + const prefix string = ",\"lost_lastsec\":" + out.RawString(prefix) + out.Int(int(in.LostLastSec)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventMediaSlowLink) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus17(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventMediaSlowLink) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus17(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventMediaSlowLink) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus17(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventMediaSlowLink) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus17(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus18(in *jlexer.Lexer, out *janusEventJSEP) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "owner": + if in.IsNull() { + in.Skip() + } else { + out.Owner = string(in.String()) + } + case "jsep": + easyjsonC1cedd36Decode(in, &out.Jsep) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus18(out *jwriter.Writer, in janusEventJSEP) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"owner\":" + out.RawString(prefix[1:]) + out.String(string(in.Owner)) + } + { + const prefix string = ",\"jsep\":" + out.RawString(prefix) + easyjsonC1cedd36Encode(out, in.Jsep) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventJSEP) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus18(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventJSEP) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus18(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventJSEP) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus18(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventJSEP) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus18(l, v) +} +func easyjsonC1cedd36Decode(in *jlexer.Lexer, out *struct { + Type string `json:"type"` + SDP string `json:"sdp"` +}) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "type": + if in.IsNull() { + in.Skip() + } else { + out.Type = string(in.String()) + } + case "sdp": + if in.IsNull() { + in.Skip() + } else { + out.SDP = string(in.String()) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36Encode(out *jwriter.Writer, in struct { + Type string `json:"type"` + SDP string `json:"sdp"` +}) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"type\":" + out.RawString(prefix[1:]) + out.String(string(in.Type)) + } + { + const prefix string = ",\"sdp\":" + out.RawString(prefix) + out.String(string(in.SDP)) + } + out.RawByte('}') +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus19(in *jlexer.Lexer, out *janusEventHandle) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "name": + if in.IsNull() { + in.Skip() + } else { + out.Name = string(in.String()) + } + case "plugin": + if in.IsNull() { + in.Skip() + } else { + out.Plugin = string(in.String()) + } + case "token": + if in.IsNull() { + in.Skip() + } else { + out.Token = string(in.String()) + } + case "opaque_id": + if in.IsNull() { + in.Skip() + } else { + out.OpaqueId = string(in.String()) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus19(out *jwriter.Writer, in janusEventHandle) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"name\":" + out.RawString(prefix[1:]) + out.String(string(in.Name)) + } + { + const prefix string = ",\"plugin\":" + out.RawString(prefix) + out.String(string(in.Plugin)) + } + if in.Token != "" { + const prefix string = ",\"token\":" + out.RawString(prefix) + out.String(string(in.Token)) + } + if in.OpaqueId != "" { + const prefix string = ",\"opaque_id\":" + out.RawString(prefix) + out.String(string(in.OpaqueId)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventHandle) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus19(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventHandle) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus19(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventHandle) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus19(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventHandle) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus19(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus20(in *jlexer.Lexer, out *janusEventExternal) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "schema": + if in.IsNull() { + in.Skip() + } else { + out.Schema = string(in.String()) + } + case "data": + if in.IsNull() { + in.Skip() + } else { + if data := in.Raw(); in.Ok() { + in.AddError((out.Data).UnmarshalJSON(data)) + } + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus20(out *jwriter.Writer, in janusEventExternal) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"schema\":" + out.RawString(prefix[1:]) + out.String(string(in.Schema)) + } + { + const prefix string = ",\"data\":" + out.RawString(prefix) + out.Raw((in.Data).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventExternal) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus20(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventExternal) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus20(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventExternal) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus20(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventExternal) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus20(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus21(in *jlexer.Lexer, out *janusEventDependenciesInfo) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "glib2": + if in.IsNull() { + in.Skip() + } else { + out.Glib2 = string(in.String()) + } + case "jansson": + if in.IsNull() { + in.Skip() + } else { + out.Jansson = string(in.String()) + } + case "libnice": + if in.IsNull() { + in.Skip() + } else { + out.Libnice = string(in.String()) + } + case "libsrtp": + if in.IsNull() { + in.Skip() + } else { + out.Libsrtp = string(in.String()) + } + case "libcurl": + if in.IsNull() { + in.Skip() + } else { + out.Libcurl = string(in.String()) + } + case "crypto": + if in.IsNull() { + in.Skip() + } else { + out.Crypto = string(in.String()) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus21(out *jwriter.Writer, in janusEventDependenciesInfo) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"glib2\":" + out.RawString(prefix[1:]) + out.String(string(in.Glib2)) + } + { + const prefix string = ",\"jansson\":" + out.RawString(prefix) + out.String(string(in.Jansson)) + } + { + const prefix string = ",\"libnice\":" + out.RawString(prefix) + out.String(string(in.Libnice)) + } + { + const prefix string = ",\"libsrtp\":" + out.RawString(prefix) + out.String(string(in.Libsrtp)) + } + if in.Libcurl != "" { + const prefix string = ",\"libcurl\":" + out.RawString(prefix) + out.String(string(in.Libcurl)) + } + { + const prefix string = ",\"crypto\":" + out.RawString(prefix) + out.String(string(in.Crypto)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventDependenciesInfo) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus21(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventDependenciesInfo) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus21(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventDependenciesInfo) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus21(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventDependenciesInfo) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus21(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus22(in *jlexer.Lexer, out *janusEventCoreStartup) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "status": + if in.IsNull() { + in.Skip() + } else { + out.Status = string(in.String()) + } + case "info": + if in.IsNull() { + in.Skip() + } else { + if data := in.Raw(); in.Ok() { + in.AddError((out.Info).UnmarshalJSON(data)) + } + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus22(out *jwriter.Writer, in janusEventCoreStartup) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"status\":" + out.RawString(prefix[1:]) + out.String(string(in.Status)) + } + { + const prefix string = ",\"info\":" + out.RawString(prefix) + out.Raw((in.Info).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventCoreStartup) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus22(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventCoreStartup) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus22(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventCoreStartup) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus22(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventCoreStartup) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus22(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus23(in *jlexer.Lexer, out *janusEventCoreShutdown) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "status": + if in.IsNull() { + in.Skip() + } else { + out.Status = string(in.String()) + } + case "signum": + if in.IsNull() { + in.Skip() + } else { + out.Signum = int(in.Int()) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus23(out *jwriter.Writer, in janusEventCoreShutdown) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"status\":" + out.RawString(prefix[1:]) + out.String(string(in.Status)) + } + { + const prefix string = ",\"signum\":" + out.RawString(prefix) + out.Int(int(in.Signum)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventCoreShutdown) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus23(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventCoreShutdown) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus23(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventCoreShutdown) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus23(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventCoreShutdown) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus23(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus24(in *jlexer.Lexer, out *janusEventCandidates) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "local": + if in.IsNull() { + in.Skip() + } else { + (out.Local).UnmarshalEasyJSON(in) + } + case "remote": + if in.IsNull() { + in.Skip() + } else { + (out.Remote).UnmarshalEasyJSON(in) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus24(out *jwriter.Writer, in janusEventCandidates) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"local\":" + out.RawString(prefix[1:]) + (in.Local).MarshalEasyJSON(out) + } + { + const prefix string = ",\"remote\":" + out.RawString(prefix) + (in.Remote).MarshalEasyJSON(out) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventCandidates) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus24(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventCandidates) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus24(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventCandidates) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus24(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventCandidates) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus24(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus25(in *jlexer.Lexer, out *janusEventCandidate) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "address": + if in.IsNull() { + in.Skip() + } else { + out.Address = string(in.String()) + } + case "port": + if in.IsNull() { + in.Skip() + } else { + out.Port = int(in.Int()) + } + case "type": + if in.IsNull() { + in.Skip() + } else { + out.Type = string(in.String()) + } + case "transport": + if in.IsNull() { + in.Skip() + } else { + out.Transport = string(in.String()) + } + case "family": + if in.IsNull() { + in.Skip() + } else { + out.Family = int(in.Int()) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus25(out *jwriter.Writer, in janusEventCandidate) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"address\":" + out.RawString(prefix[1:]) + out.String(string(in.Address)) + } + { + const prefix string = ",\"port\":" + out.RawString(prefix) + out.Int(int(in.Port)) + } + { + const prefix string = ",\"type\":" + out.RawString(prefix) + out.String(string(in.Type)) + } + { + const prefix string = ",\"transport\":" + out.RawString(prefix) + out.String(string(in.Transport)) + } + { + const prefix string = ",\"family\":" + out.RawString(prefix) + out.Int(int(in.Family)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEventCandidate) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus25(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEventCandidate) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus25(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEventCandidate) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus25(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEventCandidate) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus25(l, v) +} +func easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus26(in *jlexer.Lexer, out *janusEvent) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeFieldName(false) + in.WantColon() + switch key { + case "emitter": + if in.IsNull() { + in.Skip() + } else { + out.Emitter = string(in.String()) + } + case "type": + if in.IsNull() { + in.Skip() + } else { + out.Type = int(in.Int()) + } + case "subtype": + if in.IsNull() { + in.Skip() + } else { + out.SubType = int(in.Int()) + } + case "timestamp": + if in.IsNull() { + in.Skip() + } else { + out.Timestamp = uint64(in.Uint64()) + } + case "session_id": + if in.IsNull() { + in.Skip() + } else { + out.SessionId = uint64(in.Uint64()) + } + case "handle_id": + if in.IsNull() { + in.Skip() + } else { + out.HandleId = uint64(in.Uint64()) + } + case "opaque_id": + if in.IsNull() { + in.Skip() + } else { + out.OpaqueId = uint64(in.Uint64()) + } + case "event": + if in.IsNull() { + in.Skip() + } else { + if data := in.Raw(); in.Ok() { + in.AddError((out.Event).UnmarshalJSON(data)) + } + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus26(out *jwriter.Writer, in janusEvent) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"emitter\":" + out.RawString(prefix[1:]) + out.String(string(in.Emitter)) + } + { + const prefix string = ",\"type\":" + out.RawString(prefix) + out.Int(int(in.Type)) + } + if in.SubType != 0 { + const prefix string = ",\"subtype\":" + out.RawString(prefix) + out.Int(int(in.SubType)) + } + { + const prefix string = ",\"timestamp\":" + out.RawString(prefix) + out.Uint64(uint64(in.Timestamp)) + } + if in.SessionId != 0 { + const prefix string = ",\"session_id\":" + out.RawString(prefix) + out.Uint64(uint64(in.SessionId)) + } + if in.HandleId != 0 { + const prefix string = ",\"handle_id\":" + out.RawString(prefix) + out.Uint64(uint64(in.HandleId)) + } + if in.OpaqueId != 0 { + const prefix string = ",\"opaque_id\":" + out.RawString(prefix) + out.Uint64(uint64(in.OpaqueId)) + } + { + const prefix string = ",\"event\":" + out.RawString(prefix) + out.Raw((in.Event).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v janusEvent) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus26(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v janusEvent) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC1cedd36EncodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus26(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *janusEvent) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus26(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *janusEvent) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC1cedd36DecodeGithubComStrukturagNextcloudSpreedSignalingV2SfuJanus26(l, v) +} diff --git a/sfu/janus/events_handler.go b/sfu/janus/events_handler.go index fed5139..37cd4f3 100644 --- a/sfu/janus/events_handler.go +++ b/sfu/janus/events_handler.go @@ -45,35 +45,6 @@ import ( const ( EventsSubprotocol = "janus-events" - janusEventTypeSession = 1 - - janusEventTypeHandle = 2 - - janusEventTypeExternal = 4 - - janusEventTypeJSEP = 8 - - janusEventTypeWebRTC = 16 - janusEventSubTypeWebRTCICE = 1 - janusEventSubTypeWebRTCLocalCandidate = 2 - janusEventSubTypeWebRTCRemoteCandidate = 3 - janusEventSubTypeWebRTCSelectedPair = 4 - janusEventSubTypeWebRTCDTLS = 5 - janusEventSubTypeWebRTCPeerConnection = 6 - - janusEventTypeMedia = 32 - janusEventSubTypeMediaState = 1 - janusEventSubTypeMediaSlowLink = 2 - janusEventSubTypeMediaStats = 3 - - janusEventTypePlugin = 64 - - janusEventTypeTransport = 128 - - janusEventTypeCore = 256 - janusEventSubTypeCoreStatusStartup = 1 - janusEventSubTypeCoreStatusShutdown = 2 - // Time allowed to write a message to the peer. writeWait = 10 * time.Second @@ -82,471 +53,12 @@ const ( // Send pings to peer with this period. Must be less than pongWait. pingPeriod = (pongWait * 9) / 10 - - // Maximum message size allowed from peer. - maxMessageSize = 64 * 1024 ) var ( bufferPool pool.BufferPool ) -func unmarshalEvent[T any](data json.RawMessage) (*T, error) { - var e T - if err := json.Unmarshal(data, &e); err != nil { - return nil, err - } - - return &e, nil -} - -func marshalEvent[T any](e T) string { - data, err := json.Marshal(e) - if err != nil { - return fmt.Sprintf("Could not serialize %#v: %s", e, err) - } - - return string(data) -} - -type janusEvent struct { - Emitter string `json:"emitter"` - Type int `json:"type"` - SubType int `json:"subtype,omitempty"` - Timestamp uint64 `json:"timestamp"` - SessionId uint64 `json:"session_id,omitempty"` - HandleId uint64 `json:"handle_id,omitempty"` - OpaqueId uint64 `json:"opaque_id,omitempty"` - Event json.RawMessage `json:"event"` -} - -func (e janusEvent) String() string { - return marshalEvent(e) -} - -func (e janusEvent) Decode() (any, error) { - switch e.Type { - case janusEventTypeSession: - return unmarshalEvent[janusEventSession](e.Event) - case janusEventTypeHandle: - return unmarshalEvent[janusEventHandle](e.Event) - case janusEventTypeExternal: - return unmarshalEvent[janusEventExternal](e.Event) - case janusEventTypeJSEP: - return unmarshalEvent[janusEventJSEP](e.Event) - case janusEventTypeWebRTC: - switch e.SubType { - case janusEventSubTypeWebRTCICE: - return unmarshalEvent[janusEventWebRTCICE](e.Event) - case janusEventSubTypeWebRTCLocalCandidate: - return unmarshalEvent[janusEventWebRTCLocalCandidate](e.Event) - case janusEventSubTypeWebRTCRemoteCandidate: - return unmarshalEvent[janusEventWebRTCRemoteCandidate](e.Event) - case janusEventSubTypeWebRTCSelectedPair: - return unmarshalEvent[janusEventWebRTCSelectedPair](e.Event) - case janusEventSubTypeWebRTCDTLS: - return unmarshalEvent[janusEventWebRTCDTLS](e.Event) - case janusEventSubTypeWebRTCPeerConnection: - return unmarshalEvent[janusEventWebRTCPeerConnection](e.Event) - } - case janusEventTypeMedia: - switch e.SubType { - case janusEventSubTypeMediaState: - return unmarshalEvent[janusEventMediaState](e.Event) - case janusEventSubTypeMediaSlowLink: - return unmarshalEvent[janusEventMediaSlowLink](e.Event) - case janusEventSubTypeMediaStats: - return unmarshalEvent[janusEventMediaStats](e.Event) - } - case janusEventTypePlugin: - return unmarshalEvent[janusEventPlugin](e.Event) - case janusEventTypeTransport: - return unmarshalEvent[janusEventTransport](e.Event) - case janusEventTypeCore: - switch e.SubType { - case janusEventSubTypeCoreStatusStartup: - event, err := unmarshalEvent[janusEventCoreStartup](e.Event) - if err != nil { - return nil, err - } - - switch event.Status { - case "started": - return unmarshalEvent[janusEventStatusStartupInfo](event.Info) - case "update": - return unmarshalEvent[janusEventStatusUpdateInfo](event.Info) - } - - return event, nil - case janusEventSubTypeCoreStatusShutdown: - return unmarshalEvent[janusEventCoreShutdown](e.Event) - } - } - - return nil, fmt.Errorf("unsupported event type %d", e.Type) -} - -type janusEventSessionTransport struct { - Transport string `json:"transport"` - ID string `json:"id"` -} - -// type=1 -type janusEventSession struct { - Name string `json:"name"` // "created", "destroyed", "timeout" - - Transport *janusEventSessionTransport `json:"transport,omitempty"` -} - -func (e janusEventSession) String() string { - return marshalEvent(e) -} - -// type=2 -type janusEventHandle struct { - Name string `json:"name"` // "attached", "detached" - Plugin string `json:"plugin"` - Token string `json:"token,omitempty"` - // Deprecated - OpaqueId string `json:"opaque_id,omitempty"` -} - -func (e janusEventHandle) String() string { - return marshalEvent(e) -} - -// type=4 -type janusEventExternal struct { - Schema string `json:"schema"` - Data json.RawMessage `json:"data"` -} - -func (e janusEventExternal) String() string { - return marshalEvent(e) -} - -// type=8 -type janusEventJSEP struct { - Owner string `json:"owner"` - Jsep struct { - Type string `json:"type"` - SDP string `json:"sdp"` - } `json:"jsep"` -} - -func (e janusEventJSEP) String() string { - return marshalEvent(e) -} - -// type=16, subtype=1 -type janusEventWebRTCICE struct { - ICE string `json:"ice"` // "gathering", "connecting", "connected", "ready" - StreamID int `json:"stream_id"` - ComponentID int `json:"component_id"` -} - -func (e janusEventWebRTCICE) String() string { - return marshalEvent(e) -} - -// type=16, subtype=2 -type janusEventWebRTCLocalCandidate struct { - LocalCandidate string `json:"local-candidate"` - StreamID int `json:"stream_id"` - ComponentID int `json:"component_id"` -} - -func (e janusEventWebRTCLocalCandidate) String() string { - return marshalEvent(e) -} - -// type=16, subtype=3 -type janusEventWebRTCRemoteCandidate struct { - RemoteCandidate string `json:"remote-candidate"` - StreamID int `json:"stream_id"` - ComponentID int `json:"component_id"` -} - -func (e janusEventWebRTCRemoteCandidate) String() string { - return marshalEvent(e) -} - -type janusEventCandidate struct { - Address string `json:"address"` - Port int `json:"port"` - Type string `json:"type"` - Transport string `json:"transport"` - Family int `json:"family"` -} - -func (e janusEventCandidate) String() string { - return marshalEvent(e) -} - -type janusEventCandidates struct { - Local janusEventCandidate `json:"local"` - Remote janusEventCandidate `json:"remote"` -} - -func (e janusEventCandidates) String() string { - return marshalEvent(e) -} - -// type=16, subtype=4 -type janusEventWebRTCSelectedPair struct { - StreamID int `json:"stream_id"` - ComponentID int `json:"component_id"` - - SelectedPair string `json:"selected-pair"` - Candidates janusEventCandidates `json:"candidates"` -} - -func (e janusEventWebRTCSelectedPair) String() string { - return marshalEvent(e) -} - -// type=16, subtype=5 -type janusEventWebRTCDTLS struct { - DTLS string `json:"dtls"` // "trying", "connected" - - StreamID int `json:"stream_id"` - ComponentID int `json:"component_id"` - - Retransmissions int `json:"retransmissions"` -} - -func (e janusEventWebRTCDTLS) String() string { - return marshalEvent(e) -} - -// type=16, subtype=6 -type janusEventWebRTCPeerConnection struct { - Connection string `json:"connection"` // "webrtcup", "hangup" - Reason string `json:"reason,omitempty"` // Only if "connection" == "hangup" -} - -func (e janusEventWebRTCPeerConnection) String() string { - return marshalEvent(e) -} - -// type=32, subtype=1 -type janusEventMediaState struct { - Media string `json:"media"` // "audio", "video" - MID string `json:"mid"` - SubStream *int `json:"substream,omitempty"` - Receiving bool `json:"receiving"` - Seconds int `json:"seconds"` -} - -func (e janusEventMediaState) String() string { - return marshalEvent(e) -} - -// type=32, subtype=2 -type janusEventMediaSlowLink struct { - Media string `json:"media"` // "audio", "video" - MID string `json:"mid"` - SlowLink string `json:"slow_link"` // "uplink", "downlink" - LostLastSec int `json:"lost_lastsec"` -} - -func (e janusEventMediaSlowLink) String() string { - return marshalEvent(e) -} - -type janusMediaStatsRTTValues struct { - NTP uint32 `json:"ntp"` - LSR uint32 `json:"lsr"` - DLSR uint32 `json:"dlsr"` -} - -func (e janusMediaStatsRTTValues) String() string { - return marshalEvent(e) -} - -// type=32, subtype=3 -type janusEventMediaStats struct { - MID string `json:"mid"` - MIndex int `json:"mindex"` - Media string `json:"media"` // "audio", "video", "video-sim1", "video-sim2" - - // Audio / video only - Codec string `json:"codec,omitempty"` - Base uint32 `json:"base"` - Lost int32 `json:"lost"` - LostByRemote int32 `json:"lost-by-remote"` - JitterLocal uint32 `json:"jitter-local"` - JitterRemote uint32 `json:"jitter-remote"` - InLinkQuality uint32 `json:"in-link-quality"` - InMediaLinkQuality uint32 `json:"in-media-link-quality"` - OutLinkQuality uint32 `json:"out-link-quality"` - OutMediaLinkQuality uint32 `json:"out-media-link-quality"` - BytesReceivedLastSec uint32 `json:"bytes-received-lastsec"` - BytesSentLastSec uint32 `json:"bytes-sent-lastsec"` - NacksReceived uint32 `json:"nacks-received"` - NacksSent uint32 `json:"nacks-sent"` - RetransmissionsReceived uint32 `json:"retransmissions-received"` - - // Only for audio / video on layer 0 - RTT uint32 `json:"rtt,omitempty"` - // Only for audio / video on layer 0 if RTCP is active - RTTValues *janusMediaStatsRTTValues `json:"rtt-values,omitempty"` - - // For all media on all layers - PacketsReceived uint32 `json:"packets-received"` - PacketsSent uint32 `json:"packets-sent"` - BytesReceived uint64 `json:"bytes-received"` - BytesSent uint64 `json:"bytes-sent"` - - // For layer 0 if REMB is enabled - REMBBitrate uint32 `json:"remb-bitrate"` -} - -func (e janusEventMediaStats) String() string { - return marshalEvent(e) -} - -// type=64 -type janusEventPlugin struct { - Plugin string `json:"plugin"` - Data json.RawMessage `json:"data"` -} - -func (e janusEventPlugin) String() string { - return marshalEvent(e) -} - -type janusEventTransportWebsocket struct { - Event string `json:"event"` - AdminApi bool `json:"admin_api,omitempty"` - IP string `json:"ip,omitempty"` -} - -// type=128 -type janusEventTransport struct { - Transport string `json:"transport"` - Id string `json:"id"` - Data janusEventTransportWebsocket `json:"data"` -} - -func (e janusEventTransport) String() string { - return marshalEvent(e) -} - -type janusEventDependenciesInfo struct { - Glib2 string `json:"glib2"` - Jansson string `json:"jansson"` - Libnice string `json:"libnice"` - Libsrtp string `json:"libsrtp"` - Libcurl string `json:"libcurl,omitempty"` - Crypto string `json:"crypto"` -} - -func (e janusEventDependenciesInfo) String() string { - return marshalEvent(e) -} - -type janusEventPluginInfo struct { - Name string `json:"name"` - Author string `json:"author"` - Description string `json:"description"` - VersionString string `json:"version_string"` - Version int `json:"version"` -} - -func (e janusEventPluginInfo) String() string { - return marshalEvent(e) -} - -// type=256, subtype=1, status="startup" -type janusEventStatusStartupInfo struct { - Janus string `json:"janus"` - Version int `json:"version"` - VersionString string `json:"version_string"` - Author string `json:"author"` - CommitHash string `json:"commit-hash"` - CompileTime string `json:"compile-time"` - LogToStdout bool `json:"log-to-stdout"` - LogToFile bool `json:"log-to-file"` - LogPath string `json:"log-path,omitempty"` - DataChannels bool `json:"data_channels"` - AcceptingNewSessions bool `json:"accepting-new-sessions"` - SessionTimeout int `json:"session-timeout"` - ReclaimSessionTimeout int `json:"reclaim-session-timeout"` - CandidatesTimeout int `json:"candidates-timeout"` - ServerName string `json:"server-name"` - LocalIP string `json:"local-ip"` - PublicIP string `json:"public-ip,omitempty"` - PublicIPs []string `json:"public-ips,omitempty"` - IPv6 bool `json:"ipv6"` - IPv6LinkLocal bool `json:"ipv6-link-local,omitempty"` - ICELite bool `json:"ice-lite"` - ICETCP bool `json:"ice-tcp"` - ICENomination string `json:"ice-nomination,omitempty"` - ICEConsentFreshness bool `json:"ice-consent-freshness"` - ICEKeepaliveConncheck bool `json:"ice-keepalive-conncheck"` - HangupOnFailed bool `json:"hangup-on-failed"` - FullTrickle bool `json:"full-trickle"` - MDNSEnabled bool `json:"mdns-enabled"` - MinNACKQueue int `json:"min-nack-queue"` - NACKOptimizations bool `json:"nack-optimizations"` - TWCCPeriod int `json:"twcc-period"` - DSCP int `json:"dscp,omitempty"` - DTLSMCU int `json:"dtls-mcu"` - STUNServer string `json:"stun-server,omitempty"` - TURNServer string `json:"turn-server,omitempty"` - AllowForceRelay bool `json:"allow-force-relay,omitempty"` - StaticEventLoops int `json:"static-event-loops"` - LoopIndication bool `json:"loop-indication,omitempty"` - APISecret bool `json:"api_secret"` - AuthToken bool `json:"auth_token"` - EventHandlers bool `json:"event_handlers"` - OpaqueIdInAPI bool `json:"opaqueid_in_api"` - WebRTCEncryption bool `json:"webrtc_encryption"` - - Dependencies *janusEventDependenciesInfo `json:"dependencies,omitempty"` - Transports map[string]janusEventPluginInfo `json:"transports,omitempty"` - Events map[string]janusEventPluginInfo `json:"events,omitempty"` - Loggers map[string]janusEventPluginInfo `json:"loggers,omitempty"` - Plugins map[string]janusEventPluginInfo `json:"plugins,omitempty"` -} - -func (e janusEventStatusStartupInfo) String() string { - return marshalEvent(e) -} - -// type=256, subtype=1, status="update" -type janusEventStatusUpdateInfo struct { - Sessions int `json:"sessions"` - Handles int `json:"handles"` - PeerConnections int `json:"peerconnections"` - StatsPeriod int `json:"stats-period"` -} - -func (e janusEventStatusUpdateInfo) String() string { - return marshalEvent(e) -} - -// type=256, subtype=1 -type janusEventCoreStartup struct { - Status string `json:"status"` - Info json.RawMessage `json:"info"` -} - -func (e janusEventCoreStartup) String() string { - return marshalEvent(e) -} - -// type=256, subtype=2 -type janusEventCoreShutdown struct { - Status string `json:"status"` - Signum int `json:"signum"` -} - -func (e janusEventCoreShutdown) String() string { - return marshalEvent(e) -} - type EventHandler interface { UpdateBandwidth(handle uint64, media string, sent api.Bandwidth, received api.Bandwidth) } @@ -727,7 +239,6 @@ func (h *EventsHandler) readPump() { return } - conn.SetReadLimit(maxMessageSize) conn.SetPongHandler(func(msg string) error { now := time.Now() conn.SetReadDeadline(now.Add(pongWait)) // nolint