-
Notifications
You must be signed in to change notification settings - Fork 0
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
Create server #1
Changes from 5 commits
369c04d
2fa0626
cf71554
fb35c6f
cb9cf99
85019c9
c54a23c
16b94e9
0961d5b
3ed5c6a
1c2dba6
00f68d5
daf5104
79e7ea1
d3093ba
738d947
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Membrane.SimpleRTSPServer.start_link( | ||
"/Users/noarkhh/Membrane/membrane_mp4_plugin/test/fixtures/isom/ref_aac.mp4", | ||
port: 30001 | ||
) | ||
|
||
Process.sleep(:infinity) |
mat-hek marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,12 +28,12 @@ defmodule Membrane.SimpleRTSPServer.Pipeline do | |
{id, %Membrane.AAC{}} -> | ||
get_child(:mp4_demuxer) | ||
|> via_out(Pad.ref(:output, id)) | ||
|> build_track(:audio, state.media_config) | ||
|> build_track(:audio, state.media_config, state.realtime) | ||
|
||
{id, %Membrane.H264{}} -> | ||
get_child(:mp4_demuxer) | ||
|> via_out(Pad.ref(:output, id)) | ||
|> build_track(:video, state.media_config) | ||
|> build_track(:video, state.media_config, state.realtime) | ||
end) | ||
|
||
{[spec: spec], state} | ||
|
@@ -46,7 +46,6 @@ defmodule Membrane.SimpleRTSPServer.Pipeline do | |
|
||
@impl true | ||
def handle_element_end_of_stream({:udp_sink, :video}, :input, _ctx, state) do | ||
Process.sleep(50) | ||
:gen_tcp.close(state.socket) | ||
{[terminate: :normal], state} | ||
end | ||
|
@@ -56,20 +55,19 @@ defmodule Membrane.SimpleRTSPServer.Pipeline do | |
{[], state} | ||
end | ||
|
||
defp build_track(builder, :audio, %{audio: config}) do | ||
defp build_track(builder, :audio, %{audio: config}, realtime) do | ||
builder | ||
|> child(:aac_parser, %Membrane.AAC.Parser{ | ||
out_encapsulation: :none, | ||
output_config: :audio_specific_config | ||
}) | ||
|> child(%Membrane.Debug.Filter{handle_stream_format: &IO.inspect(&1, label: "strfmt")}) | ||
|> via_in(Pad.ref(:input, config.ssrc), | ||
options: [payloader: %Membrane.RTP.AAC.Payloader{frames_per_packet: 1, mode: :hbr}] | ||
) | ||
|> build_tail(:audio, config) | ||
|> build_tail(:audio, config, realtime) | ||
end | ||
|
||
defp build_track(builder, :video, %{video: config}) do | ||
defp build_track(builder, :video, %{video: config}, realtime) do | ||
builder | ||
|> child(:h264_parser, %Membrane.H264.Parser{ | ||
output_alignment: :nalu, | ||
|
@@ -80,17 +78,15 @@ defmodule Membrane.SimpleRTSPServer.Pipeline do | |
|> via_in(Pad.ref(:input, config.ssrc), | ||
options: [payloader: Membrane.RTP.H264.Payloader] | ||
) | ||
|> build_tail(:video, config) | ||
|> build_tail(:video, config, realtime) | ||
end | ||
|
||
defp build_track(builder, _type, _media_config) do | ||
defp build_track(builder, _type, _media_config, _realtime) do | ||
builder | ||
|> child(Membrane.Debug.Sink) | ||
end | ||
|
||
defp build_tail(builder, type, config) do | ||
config |> IO.inspect(label: type) | ||
|
||
defp build_tail(builder, type, config, realtime) do | ||
builder | ||
|> get_child(:rtp_session_bin) | ||
|> via_out(Pad.ref(:rtp_output, config.ssrc), | ||
|
@@ -99,7 +95,11 @@ defmodule Membrane.SimpleRTSPServer.Pipeline do | |
clock_rate: config.clock_rate | ||
] | ||
) | ||
|> child({:realtimer, type}, Membrane.Realtimer) | ||
|> then( | ||
&if realtime, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you have a use case for realtime: false? I think it would overload the socket buffer and cause packet loss There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wanted to have the test not take so long, but came to the same conclusion There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An alternative would be an option in realtimer that would speed it up a few times. And a relatively short fixture - I'm using up to 10s for such cases |
||
do: &1 |> child({:realtimer, type}, Membrane.Realtimer), | ||
else: &1 | ||
) | ||
|> child({:udp_sink, type}, %Membrane.UDP.Sink{ | ||
destination_address: config.client_address, | ||
destination_port_no: config.client_port, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perform deduping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops, a careless git add :P