-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RTMP plugin delivers end_of_stream on TCP disconnection #792
RTMP plugin delivers end_of_stream on TCP disconnection #792
Comments
Since dropping the connection means we won't send anything anymore from the source, the end of stream is quite expected. I assume that the logic is to remove the element on the connection drop and spawn a new one - in that case, some further element should take care of intercepting the end_of_stream and be linked to the newly spawned source. |
A connection drop is something related to a problem in the transport layer. It signals a network fault, which in my opinion is unrelated to the end of stream event, which means that everything is done (whereas is not in this case).
Thanks to crash groups & dynamic pads this is very easy to accomplish and it is actually how we're handling it.
This element the has to know wether that was a false positive or not. I really think this is very confusing. This is an RTMP plugin, RTMP has a message that signals the real end_of_stream, let's just stick with it @mat-hek! |
Hmm, let's assume we don't send the end_of_stream. You get the |
Not in case the removed elements and the leftovers are connected with a dynamic pad right? |
I’d have to check, but I think in this case as well |
Hi @dmorn, any update on this? BTW I checked and the end of stream is always generated: Mix.install([:membrane_core])
defmodule Source do
use Membrane.Source
def_output_pad :output, flow_control: :manual, accepted_format: _any
@impl true
def handle_demand(:output, _size, _unit, _ctx, state) do
{[], state}
end
end
defmodule Sink do
use Membrane.Sink
def_input_pad :input, availability: :on_request, accepted_format: _any
@impl true
def handle_end_of_stream(pad, _ctx, state) do
IO.puts("End of stream on pad #{inspect(pad)}")
{[], state}
end
end
defmodule Run do
import Membrane.ChildrenSpec
require Membrane.Pad, as: Pad
def run() do
p = Membrane.RCPipeline.start_link!()
Membrane.RCPipeline.exec_actions(p,
spec: [
child(:sink, Sink),
child(:src1, Source) |> via_in(Pad.ref(:input, 1)) |> get_child(:sink),
child(:src2, Source) |> via_in(Pad.ref(:input, 2)) |> get_child(:sink)
]
)
Process.sleep(1000)
Membrane.RCPipeline.exec_actions(p, remove_children: [:src1])
Process.sleep(1000)
end
end
Run.run() |
Closing this for now, feel free to reopen when you tackle this again |
@mat-hek we have a bug then 😂 I think you should discuss about this thing with your team. In an HLS stream case, end_of_stream means that the playlist turns VOD. This is irreversible . In our opinion, end_of_stream should be explicit, as in this case with the proper RTMP message, in case of errors or others, maybe the best option would be to terminate the children. Please let us know what you think as we really have to get it right in our use cases. |
Well, so I see the following options:
The second option seems the best to me, let me know what you think ;) |
Hi @mat-hek! I thought about it and maybe I have a third option: custom event for the RTMP unpublish message? |
👋 can you elaborate on how this would work? |
I'll validate and publish a PR as we need this again :D Basically I'll just record that the unpublish message is received; when sending the end_of_stream action out, I'll prepend it with a custom event action. This way behaviour will be kept unchanged, if someone wants instead to ensure the stream is actually terminated (us), it can do so monitoring the presence of that event. Basically its just option 2 above reversed |
Got it, seems like a good idea ;) |
This issue is also related to
The RTMP stream is delivering end of stream when the TCP connection is dropped, see here. For us this is plain wrong logic, as one thing is an error such as a connection drop, one thing is an actual end of stream, in amf terms a deleteStream message.
We're turning output HLS streams into VOD when the transmission is ended, and this is an event you cannot withdraw, once player see that tag they stop reloading the playlist.
Can we add an option tunes this behaviour? Or even better (this is how we deal it in our work)
Basically we just notify the parent of the event, then the pipeline can decide how the rest of the children should react.
The text was updated successfully, but these errors were encountered: