Skip to content

Commit de85843

Browse files
authored
Don't flush buffer if native is not ready (#108)
* Don't flush buffers if native hasn't been initialized * Make unifex dependency version less strict * Bump to v0.27.3
1 parent 02831e7 commit de85843

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The package can be installed by adding `membrane_rtmp_plugin` to your list of de
1414
```elixir
1515
def deps do
1616
[
17-
{:membrane_rtmp_plugin, "~> 0.27.2"}
17+
{:membrane_rtmp_plugin, "~> 0.27.3"}
1818
]
1919
end
2020
```

lib/membrane_rtmp_plugin/rtmp/sink/sink.ex

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -198,21 +198,26 @@ defmodule Membrane.RTMP.Sink do
198198

199199
@impl true
200200
def handle_end_of_stream(Pad.ref(type, 0), _ctx, state) do
201-
if state.forward_mode? do
202-
Native.finalize_stream(state.native)
203-
{[], state}
204-
else
205-
# The interleave logic does not work if either one of the inputs does not
206-
# produce buffers. From this point on we act as a "forward" filter.
207-
other_pad =
208-
case type do
209-
:audio -> :video
210-
:video -> :audio
211-
end
212-
|> then(&Pad.ref(&1, 0))
213-
214-
state = flush_frame_buffer(state)
215-
{[demand: other_pad], %{state | forward_mode?: true}}
201+
cond do
202+
state.forward_mode? ->
203+
Native.finalize_stream(state.native)
204+
{[], state}
205+
206+
state.ready? ->
207+
# The interleave logic does not work if either one of the inputs does not
208+
# produce buffers. From this point on we act as a "forward" filter.
209+
other_pad =
210+
case type do
211+
:audio -> :video
212+
:video -> :audio
213+
end
214+
|> then(&Pad.ref(&1, 0))
215+
216+
state = flush_frame_buffer(state)
217+
{[demand: other_pad], %{state | forward_mode?: true}}
218+
219+
true ->
220+
{[], state}
216221
end
217222
end
218223

mix.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule Membrane.RTMP.Mixfile do
22
use Mix.Project
33

4-
@version "0.27.2"
4+
@version "0.27.3"
55
@github_url "https://github.com/membraneframework/membrane_rtmp_plugin"
66

77
def project do
@@ -39,7 +39,7 @@ defmodule Membrane.RTMP.Mixfile do
3939
defp deps do
4040
[
4141
{:membrane_core, "~> 1.0"},
42-
{:unifex, "~> 1.2.0"},
42+
{:unifex, "~> 1.2"},
4343
{:membrane_precompiled_dependency_provider, "~> 0.1.0"},
4444
{:membrane_h26x_plugin, "~> 0.10.0"},
4545
{:membrane_h264_format, "~> 0.6.1"},

0 commit comments

Comments
 (0)