diff --git a/doc/docs.md b/doc/docs.md index ad51cca..705340c 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -3,6 +3,17 @@ ## Table of Contents +- [fishjam/agent_notifications.proto](#fishjam_agent_notifications-proto) + - [AgentRequest](#fishjam-AgentRequest) + - [AgentRequest.AddTrack](#fishjam-AgentRequest-AddTrack) + - [AgentRequest.AddTrack.CodecParameters](#fishjam-AgentRequest-AddTrack-CodecParameters) + - [AgentRequest.AuthRequest](#fishjam-AgentRequest-AuthRequest) + - [AgentRequest.RemoveTrack](#fishjam-AgentRequest-RemoveTrack) + - [AgentRequest.TrackData](#fishjam-AgentRequest-TrackData) + - [AgentResponse](#fishjam-AgentResponse) + - [AgentResponse.Authenticated](#fishjam-AgentResponse-Authenticated) + - [AgentResponse.TrackData](#fishjam-AgentResponse-TrackData) + - [fishjam/media_events/peer/peer.proto](#fishjam_media_events_peer_peer-proto) - [MediaEvent](#fishjam-media_events-peer-MediaEvent) - [MediaEvent.Connect](#fishjam-media_events-peer-MediaEvent-Connect) @@ -84,21 +95,186 @@ - [ServerMessage.StreamDisconnected](#fishjam-ServerMessage-StreamDisconnected) - [ServerMessage.SubscribeRequest](#fishjam-ServerMessage-SubscribeRequest) - [ServerMessage.SubscribeResponse](#fishjam-ServerMessage-SubscribeResponse) - - [ServerMessage.Track](#fishjam-ServerMessage-Track) - [ServerMessage.TrackAdded](#fishjam-ServerMessage-TrackAdded) - - [ServerMessage.TrackData](#fishjam-ServerMessage-TrackData) - [ServerMessage.TrackMetadataUpdated](#fishjam-ServerMessage-TrackMetadataUpdated) - [ServerMessage.TrackRemoved](#fishjam-ServerMessage-TrackRemoved) - [ServerMessage.ViewerConnected](#fishjam-ServerMessage-ViewerConnected) - [ServerMessage.ViewerDisconnected](#fishjam-ServerMessage-ViewerDisconnected) - [ServerMessage.EventType](#fishjam-ServerMessage-EventType) - - [ServerMessage.TrackType](#fishjam-ServerMessage-TrackType) + +- [fishjam/shared_notifications.proto](#fishjam_shared_notifications-proto) + - [Track](#fishjam-Track) + + - [TrackEncoding](#fishjam-TrackEncoding) + - [TrackType](#fishjam-TrackType) - [Scalar Value Types](#scalar-value-types) + +

Top

+ +## fishjam/agent_notifications.proto + + + + + +### AgentRequest +Defines any type of message passed from agent peer to Fishjam + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| auth_request | [AgentRequest.AuthRequest](#fishjam-AgentRequest-AuthRequest) | | | +| add_track | [AgentRequest.AddTrack](#fishjam-AgentRequest-AddTrack) | | | +| remove_track | [AgentRequest.RemoveTrack](#fishjam-AgentRequest-RemoveTrack) | | | +| track_data | [AgentRequest.TrackData](#fishjam-AgentRequest-TrackData) | | | + + + + + + + + +### AgentRequest.AddTrack +Request to add a track of the specified type + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| track | [Track](#fishjam-Track) | | Specification of the track to be added | +| codec_params | [AgentRequest.AddTrack.CodecParameters](#fishjam-AgentRequest-AddTrack-CodecParameters) | | Parameters of the input data stream | + + + + + + + + +### AgentRequest.AddTrack.CodecParameters + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| encoding | [TrackEncoding](#fishjam-TrackEncoding) | | The format of the input stream, defaults to pcm16 | +| sample_rate | [uint32](#uint32) | | The sample rate of the input stream, may be omitted for opus | +| channels | [uint32](#uint32) | | The number of channels. 1 means mono, 2 means stereo | + + + + + + + + +### AgentRequest.AuthRequest +Request sent by agent, to authenticate to Fishjam server + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| token | [string](#string) | | | +| room_id | [string](#string) | | | + + + + + + + + +### AgentRequest.RemoveTrack +Removes the given track + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| track_id | [string](#string) | | | + + + + + + + + +### AgentRequest.TrackData +Notification containing a chunk of an agent's track's data stream + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| track_id | [string](#string) | | | +| data | [bytes](#bytes) | | | + + + + + + + + +### AgentResponse +Defines any type of message passed from Fishjam to agent peer + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| authenticated | [AgentResponse.Authenticated](#fishjam-AgentResponse-Authenticated) | | | +| track_data | [AgentResponse.TrackData](#fishjam-AgentResponse-TrackData) | | | + + + + + + + + +### AgentResponse.Authenticated +Response confirming successful authentication + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| peer_id | [string](#string) | | The Peer ID assigned to the connected Agent | + + + + + + + + +### AgentResponse.TrackData +Notification containing a chunk of a track's data stream + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| peer_id | [string](#string) | | | +| track | [Track](#fishjam-Track) | | | +| data | [bytes](#bytes) | | | + + + + + + + + + + + + + + +

Top

@@ -1004,7 +1180,6 @@ Defines any type of message passed between FJ and server peer | stream_disconnected | [ServerMessage.StreamDisconnected](#fishjam-ServerMessage-StreamDisconnected) | | | | viewer_connected | [ServerMessage.ViewerConnected](#fishjam-ServerMessage-ViewerConnected) | | | | viewer_disconnected | [ServerMessage.ViewerDisconnected](#fishjam-ServerMessage-ViewerDisconnected) | | | -| track_data | [ServerMessage.TrackData](#fishjam-ServerMessage-TrackData) | | | @@ -1301,23 +1476,6 @@ Response sent by FJ, confirming subscription for message type - - -### ServerMessage.Track -Describes a media track - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| id | [string](#string) | | | -| type | [ServerMessage.TrackType](#fishjam-ServerMessage-TrackType) | | | -| metadata | [string](#string) | | | - - - - - - ### ServerMessage.TrackAdded @@ -1329,25 +1487,7 @@ Notification sent when peer or component adds new track | room_id | [string](#string) | | | | peer_id | [string](#string) | | | | component_id | [string](#string) | | | -| track | [ServerMessage.Track](#fishjam-ServerMessage-Track) | | | - - - - - - - - -### ServerMessage.TrackData -Notification containing a chunk of a track's data stream - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| room_id | [string](#string) | | | -| peer_id | [string](#string) | | | -| track | [ServerMessage.Track](#fishjam-ServerMessage-Track) | | | -| data | [bytes](#bytes) | | | +| track | [Track](#fishjam-Track) | | | @@ -1365,7 +1505,7 @@ Notification sent when metadata of a multimedia track is updated | room_id | [string](#string) | | | | peer_id | [string](#string) | | | | component_id | [string](#string) | | | -| track | [ServerMessage.Track](#fishjam-ServerMessage-Track) | | | +| track | [Track](#fishjam-Track) | | | @@ -1383,7 +1523,7 @@ Notification sent when a track is removed | room_id | [string](#string) | | | | peer_id | [string](#string) | | | | component_id | [string](#string) | | | -| track | [ServerMessage.Track](#fishjam-ServerMessage-Track) | | | +| track | [Track](#fishjam-Track) | | | @@ -1435,10 +1575,56 @@ Defines message groups for which peer can subscribe | EVENT_TYPE_SERVER_NOTIFICATION | 1 | | + + + + + + + + + +

Top

+ +## fishjam/shared_notifications.proto + + + + + +### Track +Describes a media track + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [string](#string) | | | +| type | [TrackType](#fishjam-TrackType) | | | +| metadata | [string](#string) | | | + + + + + + + + + + +### TrackEncoding + + +| Name | Number | Description | +| ---- | ------ | ----------- | +| TRACK_ENCODING_UNSPECIFIED | 0 | | +| TRACK_ENCODING_PCM16 | 1 | | +| TRACK_ENCODING_OPUS | 2 | | + + - + -### ServerMessage.TrackType +### TrackType Defines types of tracks being published by peers and component | Name | Number | Description | diff --git a/fishjam/agent_notifications.proto b/fishjam/agent_notifications.proto new file mode 100644 index 0000000..a6e4ba2 --- /dev/null +++ b/fishjam/agent_notifications.proto @@ -0,0 +1,70 @@ +syntax = "proto3"; + +package fishjam; + +import "fishjam/shared_notifications.proto"; + +// Defines any type of message passed from agent peer to Fishjam +message AgentRequest { + // Request sent by agent, to authenticate to Fishjam server + message AuthRequest { + string token = 1; + string room_id = 2; + } + + // Request to add a track of the specified type + message AddTrack { + message CodecParameters { + // The format of the input stream, defaults to pcm16 + fishjam.TrackEncoding encoding = 1; + // The sample rate of the input stream, may be omitted for opus + uint32 sample_rate = 2; + // The number of channels. 1 means mono, 2 means stereo + uint32 channels = 3; + } + + // Specification of the track to be added + fishjam.Track track = 1; + // Parameters of the input data stream + CodecParameters codec_params = 2; + } + + // Removes the given track + message RemoveTrack { + string track_id = 1; + } + + // Notification containing a chunk of an agent's track's data stream + message TrackData { + string track_id = 1; + bytes data = 2; + } + + oneof content { + AuthRequest auth_request = 1; + AddTrack add_track = 2; + RemoveTrack remove_track = 3; + TrackData track_data = 4; + } +} + +// Defines any type of message passed from Fishjam to agent peer +message AgentResponse { + // Response confirming successful authentication + message Authenticated { + // The Peer ID assigned to the connected Agent + string peer_id = 1; + } + + // Notification containing a chunk of a track's data stream + message TrackData { + string peer_id = 1; + fishjam.Track track = 2; + bytes data = 3; + } + + oneof content { + Authenticated authenticated = 1; + TrackData track_data = 2; + } +} diff --git a/fishjam/server_notifications.proto b/fishjam/server_notifications.proto index 385afab..b392df5 100644 --- a/fishjam/server_notifications.proto +++ b/fishjam/server_notifications.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package fishjam; +import "fishjam/shared_notifications.proto"; + // Defines any type of message passed between FJ and server peer message ServerMessage { // Notification sent when a room crashes @@ -104,20 +106,6 @@ message ServerMessage { string metadata = 3; } - // Defines types of tracks being published by peers and component - enum TrackType { - TRACK_TYPE_UNSPECIFIED = 0; - TRACK_TYPE_VIDEO = 1; - TRACK_TYPE_AUDIO = 2; - } - - // Describes a media track - message Track { - string id = 1; - TrackType type = 2; - string metadata = 3; - } - // Notification sent when peer or component adds new track message TrackAdded { string room_id = 1; @@ -125,7 +113,7 @@ message ServerMessage { string peer_id = 2; string component_id = 3; } - Track track = 4; + fishjam.Track track = 4; } // Notification sent when a track is removed @@ -135,7 +123,7 @@ message ServerMessage { string peer_id = 2; string component_id = 3; } - Track track = 4; + fishjam.Track track = 4; } // Notification sent when metadata of a multimedia track is updated @@ -145,15 +133,7 @@ message ServerMessage { string peer_id = 2; string component_id = 3; } - Track track = 4; - } - - // Notification containing a chunk of a track's data stream - message TrackData { - string room_id = 1; - string peer_id = 2; - Track track = 3; - bytes data = 4; + fishjam.Track track = 4; } // Notification sent when streamer successfully connects @@ -205,6 +185,5 @@ message ServerMessage { StreamDisconnected stream_disconnected = 23; ViewerConnected viewer_connected = 24; ViewerDisconnected viewer_disconnected = 25; - TrackData track_data = 26; } } diff --git a/fishjam/shared_notifications.proto b/fishjam/shared_notifications.proto new file mode 100644 index 0000000..061353f --- /dev/null +++ b/fishjam/shared_notifications.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; + +package fishjam; + +// Defines types of tracks being published by peers and component +enum TrackType { + TRACK_TYPE_UNSPECIFIED = 0; + TRACK_TYPE_VIDEO = 1; + TRACK_TYPE_AUDIO = 2; +} + +// Describes a media track +message Track { + string id = 1; + TrackType type = 2; + string metadata = 3; +} + +enum TrackEncoding { + TRACK_ENCODING_UNSPECIFIED = 0; + TRACK_ENCODING_PCM16 = 1; + TRACK_ENCODING_OPUS = 2; +} diff --git a/fishjam_protos/lib/fishjam/agent_notifications.pb.ex b/fishjam_protos/lib/fishjam/agent_notifications.pb.ex new file mode 100644 index 0000000..eed4969 --- /dev/null +++ b/fishjam_protos/lib/fishjam/agent_notifications.pb.ex @@ -0,0 +1,98 @@ +defmodule Fishjam.AgentRequest.AuthRequest do + @moduledoc false + + use Protobuf, protoc_gen_elixir_version: "0.15.0", syntax: :proto3 + + field :token, 1, type: :string + field :room_id, 2, type: :string, json_name: "roomId" +end + +defmodule Fishjam.AgentRequest.AddTrack.CodecParameters do + @moduledoc false + + use Protobuf, protoc_gen_elixir_version: "0.15.0", syntax: :proto3 + + field :encoding, 1, type: Fishjam.TrackEncoding, enum: true + field :sample_rate, 2, type: :uint32, json_name: "sampleRate" + field :channels, 3, type: :uint32 +end + +defmodule Fishjam.AgentRequest.AddTrack do + @moduledoc false + + use Protobuf, protoc_gen_elixir_version: "0.15.0", syntax: :proto3 + + field :track, 1, type: Fishjam.Track + + field :codec_params, 2, + type: Fishjam.AgentRequest.AddTrack.CodecParameters, + json_name: "codecParams" +end + +defmodule Fishjam.AgentRequest.RemoveTrack do + @moduledoc false + + use Protobuf, protoc_gen_elixir_version: "0.15.0", syntax: :proto3 + + field :track_id, 1, type: :string, json_name: "trackId" +end + +defmodule Fishjam.AgentRequest.TrackData do + @moduledoc false + + use Protobuf, protoc_gen_elixir_version: "0.15.0", syntax: :proto3 + + field :track_id, 1, type: :string, json_name: "trackId" + field :data, 2, type: :bytes +end + +defmodule Fishjam.AgentRequest do + @moduledoc false + + use Protobuf, protoc_gen_elixir_version: "0.15.0", syntax: :proto3 + + oneof :content, 0 + + field :auth_request, 1, + type: Fishjam.AgentRequest.AuthRequest, + json_name: "authRequest", + oneof: 0 + + field :add_track, 2, type: Fishjam.AgentRequest.AddTrack, json_name: "addTrack", oneof: 0 + + field :remove_track, 3, + type: Fishjam.AgentRequest.RemoveTrack, + json_name: "removeTrack", + oneof: 0 + + field :track_data, 4, type: Fishjam.AgentRequest.TrackData, json_name: "trackData", oneof: 0 +end + +defmodule Fishjam.AgentResponse.Authenticated do + @moduledoc false + + use Protobuf, protoc_gen_elixir_version: "0.15.0", syntax: :proto3 + + field :peer_id, 1, type: :string, json_name: "peerId" +end + +defmodule Fishjam.AgentResponse.TrackData do + @moduledoc false + + use Protobuf, protoc_gen_elixir_version: "0.15.0", syntax: :proto3 + + field :peer_id, 1, type: :string, json_name: "peerId" + field :track, 2, type: Fishjam.Track + field :data, 3, type: :bytes +end + +defmodule Fishjam.AgentResponse do + @moduledoc false + + use Protobuf, protoc_gen_elixir_version: "0.15.0", syntax: :proto3 + + oneof :content, 0 + + field :authenticated, 1, type: Fishjam.AgentResponse.Authenticated, oneof: 0 + field :track_data, 2, type: Fishjam.AgentResponse.TrackData, json_name: "trackData", oneof: 0 +end diff --git a/fishjam_protos/lib/fishjam/server_notifications.pb.ex b/fishjam_protos/lib/fishjam/server_notifications.pb.ex index f0debf7..e14a683 100644 --- a/fishjam_protos/lib/fishjam/server_notifications.pb.ex +++ b/fishjam_protos/lib/fishjam/server_notifications.pb.ex @@ -7,16 +7,6 @@ defmodule Fishjam.ServerMessage.EventType do field :EVENT_TYPE_SERVER_NOTIFICATION, 1 end -defmodule Fishjam.ServerMessage.TrackType do - @moduledoc false - - use Protobuf, enum: true, protoc_gen_elixir_version: "0.15.0", syntax: :proto3 - - field :TRACK_TYPE_UNSPECIFIED, 0 - field :TRACK_TYPE_VIDEO, 1 - field :TRACK_TYPE_AUDIO, 2 -end - defmodule Fishjam.ServerMessage.RoomCrashed do @moduledoc false @@ -161,16 +151,6 @@ defmodule Fishjam.ServerMessage.PeerMetadataUpdated do field :metadata, 3, type: :string end -defmodule Fishjam.ServerMessage.Track do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.15.0", syntax: :proto3 - - field :id, 1, type: :string - field :type, 2, type: Fishjam.ServerMessage.TrackType, enum: true - field :metadata, 3, type: :string -end - defmodule Fishjam.ServerMessage.TrackAdded do @moduledoc false @@ -181,7 +161,7 @@ defmodule Fishjam.ServerMessage.TrackAdded do field :room_id, 1, type: :string, json_name: "roomId" field :peer_id, 2, type: :string, json_name: "peerId", oneof: 0 field :component_id, 3, type: :string, json_name: "componentId", oneof: 0 - field :track, 4, type: Fishjam.ServerMessage.Track + field :track, 4, type: Fishjam.Track end defmodule Fishjam.ServerMessage.TrackRemoved do @@ -194,7 +174,7 @@ defmodule Fishjam.ServerMessage.TrackRemoved do field :room_id, 1, type: :string, json_name: "roomId" field :peer_id, 2, type: :string, json_name: "peerId", oneof: 0 field :component_id, 3, type: :string, json_name: "componentId", oneof: 0 - field :track, 4, type: Fishjam.ServerMessage.Track + field :track, 4, type: Fishjam.Track end defmodule Fishjam.ServerMessage.TrackMetadataUpdated do @@ -207,18 +187,7 @@ defmodule Fishjam.ServerMessage.TrackMetadataUpdated do field :room_id, 1, type: :string, json_name: "roomId" field :peer_id, 2, type: :string, json_name: "peerId", oneof: 0 field :component_id, 3, type: :string, json_name: "componentId", oneof: 0 - field :track, 4, type: Fishjam.ServerMessage.Track -end - -defmodule Fishjam.ServerMessage.TrackData do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.15.0", syntax: :proto3 - - field :room_id, 1, type: :string, json_name: "roomId" - field :peer_id, 2, type: :string, json_name: "peerId" - field :track, 3, type: Fishjam.ServerMessage.Track - field :data, 4, type: :bytes + field :track, 4, type: Fishjam.Track end defmodule Fishjam.ServerMessage.StreamConnected do @@ -375,6 +344,4 @@ defmodule Fishjam.ServerMessage do type: Fishjam.ServerMessage.ViewerDisconnected, json_name: "viewerDisconnected", oneof: 0 - - field :track_data, 26, type: Fishjam.ServerMessage.TrackData, json_name: "trackData", oneof: 0 end diff --git a/fishjam_protos/lib/fishjam/shared_notifications.pb.ex b/fishjam_protos/lib/fishjam/shared_notifications.pb.ex new file mode 100644 index 0000000..0e39892 --- /dev/null +++ b/fishjam_protos/lib/fishjam/shared_notifications.pb.ex @@ -0,0 +1,29 @@ +defmodule Fishjam.TrackType do + @moduledoc false + + use Protobuf, enum: true, protoc_gen_elixir_version: "0.15.0", syntax: :proto3 + + field :TRACK_TYPE_UNSPECIFIED, 0 + field :TRACK_TYPE_VIDEO, 1 + field :TRACK_TYPE_AUDIO, 2 +end + +defmodule Fishjam.TrackEncoding do + @moduledoc false + + use Protobuf, enum: true, protoc_gen_elixir_version: "0.15.0", syntax: :proto3 + + field :TRACK_ENCODING_UNSPECIFIED, 0 + field :TRACK_ENCODING_PCM16, 1 + field :TRACK_ENCODING_OPUS, 2 +end + +defmodule Fishjam.Track do + @moduledoc false + + use Protobuf, protoc_gen_elixir_version: "0.15.0", syntax: :proto3 + + field :id, 1, type: :string + field :type, 2, type: Fishjam.TrackType, enum: true + field :metadata, 3, type: :string +end