-
Notifications
You must be signed in to change notification settings - Fork 24
[RTC-435] Add tracks and their metadata #141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4187afa
e89376e
ba816cf
1f683ce
7a329cc
cae69a9
b6c7d95
122192c
74081f5
b5ce44f
41c17a0
e74f0d3
abbddef
6877c49
ba56203
8c4058e
02626a4
634e213
76ca6c1
19f8318
466931a
ff8556a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,11 +10,18 @@ defmodule Jellyfish.Event do | |
| PeerConnected, | ||
| PeerCrashed, | ||
| PeerDisconnected, | ||
| PeerMetadataUpdated, | ||
| RoomCrashed, | ||
| RoomCreated, | ||
| RoomDeleted | ||
| RoomDeleted, | ||
| Track, | ||
| TrackAdded, | ||
| TrackMetadataUpdated, | ||
| TrackRemoved | ||
| } | ||
|
|
||
| alias Membrane.RTC.Engine.Message | ||
|
|
||
| @pubsub Jellyfish.PubSub | ||
| @valid_topics [:server_notification, :metrics] | ||
|
|
||
|
|
@@ -59,6 +66,38 @@ defmodule Jellyfish.Event do | |
| defp to_proto_server_notification({:component_crashed, room_id, component_id}), | ||
| do: {:component_crashed, %ComponentCrashed{room_id: room_id, component_id: component_id}} | ||
|
|
||
| defp to_proto_server_notification({:peer_metadata_updated, room_id, peer_id, metadata}), | ||
| do: | ||
| {:peer_metadata_updated, | ||
| %PeerMetadataUpdated{room_id: room_id, peer_id: peer_id, metadata: Jason.encode!(metadata)}} | ||
|
|
||
| defp to_proto_server_notification({:track_added, room_id, endpoint_info, track_info}) do | ||
| {:track_added, | ||
| %TrackAdded{ | ||
| room_id: room_id, | ||
| endpoint_info: endpoint_info, | ||
| track: to_proto_track(track_info) | ||
| }} | ||
| end | ||
|
|
||
| defp to_proto_server_notification({:track_removed, room_id, endpoint_info, track_info}) do | ||
| {:track_removed, | ||
| %TrackRemoved{ | ||
| room_id: room_id, | ||
| endpoint_info: endpoint_info, | ||
| track: to_proto_track(track_info) | ||
| }} | ||
| end | ||
|
|
||
| defp to_proto_server_notification({:track_metadata_updated, room_id, endpoint_info, track_id}) do | ||
| {:track_metadata_updated, | ||
| %TrackMetadataUpdated{ | ||
| room_id: room_id, | ||
| endpoint_info: endpoint_info, | ||
| track: to_proto_track(track_id) | ||
| }} | ||
| end | ||
|
|
||
| defp to_proto_server_notification({:hls_playable, room_id, component_id}), | ||
| do: {:hls_playable, %HlsPlayable{room_id: room_id, component_id: component_id}} | ||
|
|
||
|
|
@@ -67,4 +106,24 @@ defmodule Jellyfish.Event do | |
|
|
||
| defp to_proto_server_notification({:hls_upload_crashed, room_id}), | ||
| do: {:hls_upload_crashed, %HlsUploadCrashed{room_id: room_id}} | ||
|
|
||
| defp to_proto_track(%Jellyfish.Track{} = track) do | ||
| %Track{ | ||
| id: track.id, | ||
| type: to_proto_track_type(track.type), | ||
| metadata: Jason.encode!(track.metadata) | ||
| } | ||
| end | ||
|
|
||
| defp to_proto_track(%Message.TrackAdded{} = track) do | ||
| %Track{ | ||
| id: track.track_id, | ||
| type: to_proto_track_type(track.track_type), | ||
| metadata: Jason.encode!(track.track_metadata) | ||
| } | ||
| end | ||
|
|
||
| defp to_proto_track_type(:video), do: :TRACK_TYPE_VIDEO | ||
| defp to_proto_track_type(:audio), do: :TRACK_TYPE_AUDIO | ||
| defp to_proto_track_type(_type), do: :TRACK_TYPE_UNSPECIFIED | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above. |
||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,7 +53,6 @@ defmodule Jellyfish.Peer.WebRTC do | |
| handshake_opts: handshake_options, | ||
| filter_codecs: filter_codecs, | ||
| log_metadata: [peer_id: options.peer_id], | ||
| trace_context: nil, | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: option removed in new WebRTC endpoint |
||
| extensions: %{opus: Membrane.RTP.VAD}, | ||
| webrtc_extensions: webrtc_extensions, | ||
| simulcast_config: %SimulcastConfig{ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: add lint rule, allowing for nullable field without type specified (metadata can have any type)