Skip to content
This repository was archived by the owner on Sep 19, 2024. It is now read-only.

Enhance API for configuring simulcast. Fix switching between available simulcast encodings #109

Merged
merged 19 commits into from
Apr 19, 2022

Conversation

mickel8
Copy link
Contributor

@mickel8 mickel8 commented Apr 6, 2022

  • 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

@mickel8 mickel8 force-pushed the simulcast-frontend-api branch 5 times, most recently from 9b49751 to 8279c8a Compare April 7, 2022 13:39
@mickel8 mickel8 force-pushed the simulcast-frontend-api branch from 49d3642 to e8165d5 Compare April 7, 2022 16:52
@mickel8 mickel8 force-pushed the simulcast-frontend-api branch 2 times, most recently from 59271b1 to a43e56c Compare April 8, 2022 14:32
@mickel8 mickel8 force-pushed the simulcast-frontend-api branch 3 times, most recently from a4f5c8a to 4dda8fa Compare April 8, 2022 15:15
@mickel8 mickel8 force-pushed the simulcast-frontend-api branch 2 times, most recently from 4f7e44d to 2fba296 Compare April 11, 2022 11:47
@mickel8 mickel8 marked this pull request as ready for review April 11, 2022 11:47
@mickel8 mickel8 requested review from mat-hek and Rados13 April 11, 2022 11:47
@mickel8 mickel8 changed the title Enhance API for configuring simulcast Enhance API for configuring simulcast. Fix switching between available simulcast encodings Apr 11, 2022
Comment on lines 87 to 90
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))}
Copy link
Contributor

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?

Copy link
Contributor Author

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

@mickel8 mickel8 requested a review from Rados13 April 12, 2022 10:40
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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)


defp fulfill_subscription(%Subscription{format: _remote_format} = s, _ctx, state) do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

@mickel8 mickel8 force-pushed the simulcast-frontend-api branch from 61b1caf to 54614ca Compare April 14, 2022 18:09
@mickel8 mickel8 requested a review from mat-hek April 14, 2022 18:13
@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one more s :trollface:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥲

@mickel8 mickel8 merged commit 870cb8e into master Apr 19, 2022
@mickel8 mickel8 deleted the simulcast-frontend-api branch April 19, 2022 16:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants