-
Notifications
You must be signed in to change notification settings - Fork 14
Enhance API for configuring simulcast. Fix switching between available simulcast encodings #109
Conversation
mickel8
commented
Apr 6, 2022
•
edited
Loading
edited
- enhance API for configuring simulcast both on the client and server sides. Now user can choose, which simulcast encodings should be by default enabled on the client side i.e. sent to the server. Besides this, user can choose which encoding should be by default passed to the client from the server. This can be configured per track.
- fix switching between encodings when one of them becomes active or inactive
- refactor a little internal linking mechanism
- now endpoint can subscribe only for one track i.e. it cannot pass list of tracks it subscribes for
9b49751
to
8279c8a
Compare
49d3642
to
e8165d5
Compare
59271b1
to
a43e56c
Compare
a4f5c8a
to
4dda8fa
Compare
4f7e44d
to
2fba296
Compare
Enum.each(tracks, fn track -> | ||
case Engine.subscribe(state.rtc_engine, endpoint_id, track.id, :RTP) do | ||
:ok -> | ||
{:ok, Map.update!(state, :tracks, &Map.merge(&1, new_tracks))} |
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.
Are you sure that HLS_sink
can handle RTP packets?
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.
Yeah, I think we need to write some integration tests for this
lib/membrane_rtc_engine/engine.ex
Outdated
defp do_fulfill_subscription(s, tee_kind, state) do | ||
links = prepare_track_to_endpoint_links(s, tee_kind, state) | ||
s = %Subscription{s | status: :active} | ||
state = update_in(state, [:subscriptions, s.endpoint_id], &Map.put(&1, s.track_id, s)) |
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.
state = update_in(state, [:subscriptions, s.endpoint_id], &Map.put(&1, s.track_id, s)) | |
state = put_in(state, [:subscriptions, s.endpoint_id, s.track_id], s) |
lib/membrane_rtc_engine/engine.ex
Outdated
|
||
defp fulfill_subscription(%Subscription{format: _remote_format} = s, _ctx, state) do |
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.
defp fulfill_subscription(%Subscription{format: _remote_format} = s, _ctx, state) do | |
defp fulfill_subscription(%Subscription{format: _remote_format} = subscription, _ctx, state) do |
I'd avoid shortcuts and one-letter names
61b1caf
to
54614ca
Compare
lib/membrane_rtc_engine/engine.ex
Outdated
@@ -925,7 +937,7 @@ defmodule Membrane.RTC.Engine do | |||
{:ok, state} | |||
end | |||
|
|||
defp link_inbound_track(track_id, rid, track, endpoint_id, ctx, state) do | |||
defp create_tee_and_link(track_id, rid, track, endpoint_id, ctx, state) do |
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.
defp create_tee_and_link(track_id, rid, track, endpoint_id, ctx, state) do | |
defp create_and_link_tee(track_id, rid, track, endpoint_id, ctx, state) do |
lib/membrane_rtc_engine/engine.ex
Outdated
defp fulfill_subscription(%Subscription{format: _remote_format} = s, _ctx, state) do | ||
do_fulfill_subscription(s, :tee, state) | ||
defp fulfill_subscription(%Subscription{format: _remote_format} = subscription, _ctx, state) do | ||
do_fulfill_subscription(subscription, :tee, state) | ||
end | ||
|
||
defp do_fulfill_subscription(s, tee_kind, state) do |
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.
one more s
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.
🥲