Skip to content

Commit

Permalink
Merge pull request #122 from membraneframework/fix_handling_input_pad…
Browse files Browse the repository at this point in the history
…_removed_without_buffer

Fix handling input pad removed without buffer and prepare release v0.5.1
  • Loading branch information
WojciechBarczynski authored Jul 11, 2023
2 parents cc1ff8a + e8078dc commit 8a14a1d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
17 changes: 10 additions & 7 deletions lib/membrane/video_compositor/queue/strategy/live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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} ->
events_queue |> Enum.at(-1) |> PadState.event_type() != :end_of_stream

nil ->
false
end
end
end
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 8a14a1d

Please sign in to comment.