Skip to content

Commit

Permalink
Send end_of_stream on deleteStream message (#53)
Browse files Browse the repository at this point in the history
* Add end_of_stream action in case of deleteStream

* Remove end_of_stream action

* Revert "Remove end_of_stream action"

This reverts commit df6a043.

* Signal EOS in case it was not done already

* Bump version

* Change validator spec
  • Loading branch information
dmorn committed May 26, 2023
1 parent 30eed46 commit 810dd3f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The package can be installed by adding `membrane_rtmp_plugin` to your list of de
```elixir
def deps do
[
{:membrane_rtmp_plugin, "~> 0.12.0"}
{:membrane_rtmp_plugin, "~> 0.12.1"}
]
end
```
Expand Down
3 changes: 1 addition & 2 deletions lib/membrane_rtmp_plugin/rtmp/source/message_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,7 @@ defmodule Membrane.RTMP.MessageHandler do
end

defp do_handle_client_message(%Messages.Anonymous{name: "deleteStream"}, _header, state) do
# We could send `:end_of_stream` here, however more reliable method is to wait for `:tcp_closed` message on the socket.
{:cont, state}
{:cont, %{state | actions: [{:end_of_stream, :output} | state.actions]}}
end

defp do_handle_client_message(%Messages.Anonymous{} = message, _header, state) do
Expand Down
2 changes: 1 addition & 1 deletion lib/membrane_rtmp_plugin/rtmp/source/message_validator.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defprotocol Membrane.RTMP.MessageValidator do
of the RTMP messages.
"""

@type validation_result_t :: {:ok, binary()} | {:error, reason :: any()}
@type validation_result_t :: {:ok, term()} | {:error, reason :: any()}

@doc """
Validates the `t:Membrane.RTMP.Messages.ReleaseStream.t/0` message.
Expand Down
8 changes: 4 additions & 4 deletions lib/membrane_rtmp_plugin/rtmp/source/source.ex
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,10 @@ defmodule Membrane.RTMP.Source do

@impl true
def handle_info({:socket_closed, _socket}, ctx, state) do
if ctx.pads.output.start_of_stream? do
{[end_of_stream: :output], state}
else
{[notify_parent: :unexpected_socket_closed], state}
cond do
ctx.pads.output.end_of_stream? -> {[], state}
ctx.pads.output.start_of_stream? -> {[end_of_stream: :output], state}
true -> {[notify_parent: :unexpected_socket_closed], state}
end
end

Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Membrane.RTMP.Mixfile do
use Mix.Project

@version "0.12.0"
@version "0.12.1"
@github_url "https://github.com/membraneframework/membrane_rtmp_plugin"

def project do
Expand Down

0 comments on commit 810dd3f

Please sign in to comment.