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

Commit

Permalink
Send update_track_metadata also for pending subscriptions (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rados13 authored Mar 3, 2023
1 parent 93e8ff3 commit 247a3c3
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
1 change: 0 additions & 1 deletion config/prod.exs
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion config/test.exs
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 1 addition & 0 deletions lib/membrane_rtc_engine/engine.ex
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ defmodule Membrane.RTC.Engine do
state.subscriptions
|> Map.values()
|> Enum.flat_map(&Map.values/1)
|> then(&(&1 ++ state.pending_subscriptions))
|> Enum.filter(&(&1.track_id == track_id))
|> Enum.map(& &1.endpoint_id)
|> Enum.map(
Expand Down
2 changes: 2 additions & 0 deletions test/membrane_rtc_engine/engine_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ defmodule Membrane.RTC.EngineTest do

Engine.register(pid, self())

on_exit(fn -> assert :ok = Engine.terminate(pid, blocking?: true) end)

[rtc_engine: pid]
end

Expand Down
1 change: 1 addition & 0 deletions test/membrane_rtc_engine/hls_endpoint_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ defmodule Membrane.RTC.HLSEndpointTest do
describe "HLS Endpoint test" do
@describetag :tmp_dir

# FIXME: Test prints logs informing of parent crashing (HLS Endpoint)
test "creates correct hls stream from single (h264) input", %{
rtc_engine: rtc_engine,
tmp_dir: tmp_dir
Expand Down
14 changes: 7 additions & 7 deletions test/membrane_rtc_engine/tee_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ defmodule Membrane.RTC.Engine.TeeTest do
refute_sink_event(pipeline, :other_sink, %TrackVariantResumed{variant: :high}, 0)
refute_sink_event(pipeline, :other_sink, %TrackVariantResumed{variant: :medium}, 0)

Pipeline.terminate(pipeline, blocking?: true)
:ok = Pipeline.terminate(pipeline, blocking?: true)
end

test "Tee forwards TrackVariantPaused" do
Expand All @@ -81,7 +81,7 @@ defmodule Membrane.RTC.Engine.TeeTest do
refute_sink_event(pipeline, :sink, %TrackVariantPaused{variant: :high})
refute_sink_event(pipeline, :sink, %TrackVariantPaused{variant: :medium}, 0)

Pipeline.terminate(pipeline, blocking?: true)
:ok = Pipeline.terminate(pipeline, blocking?: true)
end

test "Tee generates KeyframeRequestEvent on receiving RequestTrackVariant event" do
Expand All @@ -104,7 +104,7 @@ defmodule Membrane.RTC.Engine.TeeTest do
refute_sink_event(pipeline, {:source, :medium}, %Membrane.KeyframeRequestEvent{}, 0)
refute_sink_event(pipeline, {:source, :low}, %Membrane.KeyframeRequestEvent{}, 0)

Pipeline.terminate(pipeline, blocking?: true)
:ok = Pipeline.terminate(pipeline, blocking?: true)
end

test "Tee raises on receiving invalid RequestTrackVariant event" do
Expand Down Expand Up @@ -188,7 +188,7 @@ defmodule Membrane.RTC.Engine.TeeTest do

request_and_check_high.(pipeline)

Pipeline.terminate(pipeline, blocking?: true)
:ok = Pipeline.terminate(pipeline, blocking?: true)
end

test "Tee raises on receiving data from inactive track variant" do
Expand Down Expand Up @@ -216,7 +216,7 @@ defmodule Membrane.RTC.Engine.TeeTest do
refute_sink_event(pipeline, {:source, :medium}, %Membrane.KeyframeRequestEvent{}, 0)
refute_sink_event(pipeline, {:source, :low}, %Membrane.KeyframeRequestEvent{}, 0)

Pipeline.terminate(pipeline, blocking?: true)
:ok = Pipeline.terminate(pipeline, blocking?: true)
end

test "Tee forwards KeyframeRequestEvent when there is some variant being forwarded" do
Expand All @@ -240,7 +240,7 @@ defmodule Membrane.RTC.Engine.TeeTest do
refute_sink_event(pipeline, {:source, :medium}, %Membrane.KeyframeRequestEvent{})
refute_sink_event(pipeline, {:source, :low}, %Membrane.KeyframeRequestEvent{}, 0)

Pipeline.terminate(pipeline, blocking?: true)
:ok = Pipeline.terminate(pipeline, blocking?: true)
end

test "forwards VoiceActivityChanged" do
Expand Down Expand Up @@ -269,7 +269,7 @@ defmodule Membrane.RTC.Engine.TeeTest do
# We're already on high, so we expect the event to be forwarded
assert_sink_event(pipeline, :sink, ^event)

Pipeline.terminate(pipeline, blocking?: true)
:ok = Pipeline.terminate(pipeline, blocking?: true)
end

test "forwards VoiceActivityChanged after TrackVariantSwitched" do
Expand Down

0 comments on commit 247a3c3

Please sign in to comment.