From d6ba9bd702a2959e44e8f60deb73274f734cfaf2 Mon Sep 17 00:00:00 2001 From: Wojciech Barczynski Date: Tue, 11 Jul 2023 11:51:48 +0200 Subject: [PATCH 1/3] Fix handling input pad removed without buffer --- .../video_compositor/queue/strategy/live.ex | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/membrane/video_compositor/queue/strategy/live.ex b/lib/membrane/video_compositor/queue/strategy/live.ex index d1960f60..3012e2bb 100644 --- a/lib/membrane/video_compositor/queue/strategy/live.ex +++ b/lib/membrane/video_compositor/queue/strategy/live.ex @@ -110,7 +110,7 @@ defmodule Membrane.VideoCompositor.Queue.Strategy.Live do @impl true def handle_pad_removed(pad, _ctx, state) do state = - if non_eos_input_queue?(state, pad) do + if removed_without_start_of_stream?(state, pad) do Bunch.Struct.delete_in(state, [:pads_states, pad]) else state @@ -288,11 +288,14 @@ defmodule Membrane.VideoCompositor.Queue.Strategy.Live do end) end - @spec non_eos_input_queue?(State.t(), Membrane.Pad.ref()) :: boolean() - defp non_eos_input_queue?(state, pad) do - state - |> Bunch.Struct.get_in([:pads_states, pad, :events_queue]) - |> Enum.at(-1) - |> PadState.event_type() != :end_of_stream + @spec removed_without_start_of_stream?(State.t(), Membrane.Pad.ref()) :: boolean() + defp removed_without_start_of_stream?(state, pad) do + case Bunch.Struct.get_in(state, [:pads_states, pad]) do + %PadState{events_queue: events_queue} -> + Enum.at(events_queue, -1) != :end_of_stream + + nil -> + false + end end end From be15737c505e13ef0dbef1e2b7faf7acfb025f85 Mon Sep 17 00:00:00 2001 From: Wojciech Barczynski Date: Tue, 11 Jul 2023 12:01:49 +0200 Subject: [PATCH 2/3] Add pad event type check --- lib/membrane/video_compositor/queue/strategy/live.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/membrane/video_compositor/queue/strategy/live.ex b/lib/membrane/video_compositor/queue/strategy/live.ex index 3012e2bb..12d9564c 100644 --- a/lib/membrane/video_compositor/queue/strategy/live.ex +++ b/lib/membrane/video_compositor/queue/strategy/live.ex @@ -292,7 +292,7 @@ defmodule Membrane.VideoCompositor.Queue.Strategy.Live do defp removed_without_start_of_stream?(state, pad) do case Bunch.Struct.get_in(state, [:pads_states, pad]) do %PadState{events_queue: events_queue} -> - Enum.at(events_queue, -1) != :end_of_stream + events_queue |> Enum.at(-1) |> PadState.event_type() != :end_of_stream nil -> false From e8078dc9d00d70ce6c00e54d2faf01e78560d160 Mon Sep 17 00:00:00 2001 From: Wojciech Barczynski Date: Tue, 11 Jul 2023 12:10:08 +0200 Subject: [PATCH 3/3] Prepare release v0.5.1 --- README.md | 2 +- mix.exs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 35365b9d..8c974458 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ The package can be installed by adding `membrane_video_compositor_plugin` to you ```elixir def deps do [ - {:membrane_video_compositor_plugin, "~> 0.5.0"} + {:membrane_video_compositor_plugin, "~> 0.5.1"} ] end ``` diff --git a/mix.exs b/mix.exs index 37f0030c..0c3f5b3d 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Membrane.VideoCompositor.Mixfile do use Mix.Project - @version "0.5.0" + @version "0.5.1" @github_url "https://github.com/membraneframework/membrane_video_compositor_plugin" def project do