Skip to content

Commit

Permalink
Merge pull request #100 from membraneframework/release/v0.12.0
Browse files Browse the repository at this point in the history
Release membrane_rtp_plugin v0.12.0
  • Loading branch information
varsill authored May 5, 2022
2 parents aed8fc5 + 5fdb5e1 commit 50907ca
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 55 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_rtp_plugin` to your list of dep
```elixir
def deps do
[
{:membrane_rtp_plugin, "~> 0.11.0"}
{:membrane_rtp_plugin, "~> 0.12.0"}
{:ex_libsrtp, "~> 0.3.0"} # required only if SRTP/SRTCP support is needed
]
end
Expand Down
14 changes: 12 additions & 2 deletions lib/membrane/rtcp/parser.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@ defmodule Membrane.RTCP.Parser do
demand_mode: :auto

def_output_pad :output, caps: RTCP, demand_mode: :auto
def_output_pad :rtcp_output, mode: :push, caps: :any

def_output_pad :receiver_report_output,
mode: :push,
caps: {RemoteStream, type: :packetized, content_format: RTCP}

@impl true
def handle_init(_opts) do
{:ok, %{}}
end

@impl true
def handle_prepared_to_playing(_ctx, state) do
{{:ok,
caps: {:receiver_report_output, %RemoteStream{type: :packetized, content_format: RTCP}}},
state}
end

@impl true
def handle_caps(:input, _caps, _ctx, state) do
{{:ok, caps: {:output, %RTCP{}}}, state}
Expand Down Expand Up @@ -50,7 +60,7 @@ defmodule Membrane.RTCP.Parser do
@impl true
def handle_event(:output, %RTCPEvent{} = event, _ctx, state) do
buffer = %Buffer{payload: RTCP.Packet.serialize(event.rtcp)}
{{:ok, buffer: {:rtcp_output, buffer}}, state}
{{:ok, buffer: {:receiver_report_output, buffer}}, state}
end

@impl true
Expand Down
2 changes: 1 addition & 1 deletion lib/membrane/rtp/session_bin.ex
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ defmodule Membrane.RTP.SessionBin do
|> via_out(:rtcp_output)
|> then(if secure?, do: maybe_link_srtcp_decryptor, else: & &1)
|> to({:rtcp_parser, ref}, RTCP.Parser)
|> via_out(:rtcp_output)
|> via_out(:receiver_report_output)
|> then(if secure?, do: maybe_link_srtcp_encryptor, else: & &1)
|> to_bin_output(rtcp_receiver_output),
link({:rtcp_parser, ref})
Expand Down
16 changes: 8 additions & 8 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Membrane.RTP.Plugin.MixProject do
use Mix.Project

@version "0.11.0"
@version "0.12.0"
@github_url "https://github.com/membraneframework/membrane_rtp_plugin"

def project do
Expand Down Expand Up @@ -67,21 +67,21 @@ defmodule Membrane.RTP.Plugin.MixProject do

defp deps do
[
{:membrane_core, "~> 0.9.0"},
{:membrane_rtp_format, github: "membraneframework/membrane_rtp_format", override: true},
{:membrane_core, "~> 0.10.0"},
{:membrane_rtp_format, "~> 0.4.0"},
{:ex_libsrtp, "~> 0.3.0", optional: true},
{:qex, "~> 0.5.1"},
{:bunch, "~> 1.0"},
{:heap, "~> 2.0.2"},
{:bimap, "~> 1.1.0"},

# Test
{:membrane_rtp_h264_plugin, "~> 0.9", only: :test},
{:membrane_rtp_mpegaudio_plugin, "~> 0.8", only: :test},
{:membrane_h264_ffmpeg_plugin, "~> 0.18", only: :test},
{:membrane_rtp_h264_plugin, "~> 0.11", only: :test},
{:membrane_rtp_mpegaudio_plugin, "~> 0.9", only: :test},
{:membrane_h264_ffmpeg_plugin, "~> 0.19", only: :test},
{:membrane_pcap_plugin,
github: "membraneframework/membrane_pcap_plugin", tag: "v0.5.0", only: :test},
{:membrane_hackney_plugin, "~> 0.7", only: :test},
github: "membraneframework/membrane_pcap_plugin", tag: "v0.6.1", only: :test},
{:membrane_hackney_plugin, "~> 0.8.2", only: :test},

# Dev
{:ex_doc, "~> 0.21", only: :dev, runtime: false},
Expand Down
30 changes: 15 additions & 15 deletions mix.lock

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions test/membrane/rtp/jitter_buffer/pipeline_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ defmodule Membrane.RTP.JitterBuffer.PipelineTest do
end
end)

{:ok, state}
{{:ok, caps: {:output, %Membrane.RTP{}}}, state}
end

@impl true
Expand Down Expand Up @@ -105,7 +105,6 @@ defmodule Membrane.RTP.JitterBuffer.PipelineTest do
links: links
})

Membrane.Pipeline.play(pipeline)
assert_pipeline_playback_changed(pipeline, _, :prepared)
assert_pipeline_playback_changed(pipeline, _, :playing)

Expand Down Expand Up @@ -136,6 +135,6 @@ defmodule Membrane.RTP.JitterBuffer.PipelineTest do
end
end)

Membrane.Pipeline.stop_and_terminate(pipeline, blocking?: true)
Membrane.Pipeline.terminate(pipeline, blocking?: true)
end
end
4 changes: 1 addition & 3 deletions test/membrane/rtp/parser_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,11 @@ defmodule Membrane.RTP.ParserTest do
]
})

Pipeline.play(pipeline)

Enum.each(test_data_base, fn _test_data ->
assert_sink_buffer(pipeline, :sink, %Buffer{}, @buffer_receive_timeout)
end)

Pipeline.stop_and_terminate(pipeline, blocking?: true)
Pipeline.terminate(pipeline, blocking?: true)
end
end
end
4 changes: 1 addition & 3 deletions test/membrane/rtp/pipeline_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ defmodule Membrane.RTP.PipelineTest do
]
})

Pipeline.play(pipeline)

Enum.each(test_data_base, fn _test_data ->
assert_sink_buffer(pipeline, :sink, %Buffer{}, @buffer_receive_timeout)
end)

Pipeline.stop_and_terminate(pipeline, blocking?: true)
Pipeline.terminate(pipeline, blocking?: true)
end
end
10 changes: 7 additions & 3 deletions test/membrane/rtp/session_bin_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ defmodule Membrane.RTP.Session.BinTest do
{:ok, Map.from_struct(opts) |> Map.merge(%{cnt: 0})}
end

@impl true
def handle_prepared_to_playing(_ctx, state) do
{{:ok, caps: {:output, %Membrane.RemoteStream{type: :packetized}}}, state}
end

@impl true
def handle_demand(:output, size, :buffers, _ctx, %{pause_after: [pause | _]} = state) do
{{:ok, demand: {:input, min(size, pause - state.cnt)}}, state}
Expand Down Expand Up @@ -166,7 +171,7 @@ defmodule Membrane.RTP.Session.BinTest do
]
}

{{:ok, spec: spec},
{{:ok, spec: spec, playback: :playing},
%{fmt_mapping: options.fmt_mapping, payload_and_depayload: options.payload_and_depayload}}
end

Expand Down Expand Up @@ -270,7 +275,6 @@ defmodule Membrane.RTP.Session.BinTest do
}
|> Testing.Pipeline.start_link()

Testing.Pipeline.play(pipeline)
assert_pipeline_playback_changed(pipeline, _, :playing)

%{audio: %{ssrc: audio_ssrc}, video: %{ssrc: video_ssrc}} = input
Expand Down Expand Up @@ -314,7 +318,7 @@ defmodule Membrane.RTP.Session.BinTest do
end)

assert_end_of_stream(pipeline, {:sink, ^video_ssrc})
Testing.Pipeline.stop_and_terminate(pipeline, blocking?: true)
Testing.Pipeline.terminate(pipeline, blocking?: true)
assert_pipeline_playback_changed(pipeline, _, :stopped)
end
end
8 changes: 2 additions & 6 deletions test/membrane/rtp/stream_receive_bin_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ defmodule Membrane.RTP.StreamReceiveBinTest do

{:ok, pipeline} = Testing.Pipeline.start_link(opts)

Testing.Pipeline.play(pipeline)

assert_pipeline_playback_changed(pipeline, _, :playing)
assert_start_of_stream(pipeline, :rtp_parser)
assert_start_of_stream(pipeline, :frame_counter)
Expand All @@ -64,7 +62,7 @@ defmodule Membrane.RTP.StreamReceiveBinTest do
assert_pipeline_notified(pipeline, :frame_counter, {:frame_count, count})
assert count == @frames_count

Testing.Pipeline.stop_and_terminate(pipeline, blocking?: true)
Testing.Pipeline.terminate(pipeline, blocking?: true)
end

test "RTCP reports are generated properly" do
Expand Down Expand Up @@ -97,13 +95,11 @@ defmodule Membrane.RTP.StreamReceiveBinTest do

{:ok, pipeline} = Testing.Pipeline.start_link(opts)

Testing.Pipeline.play(pipeline)

assert_pipeline_playback_changed(pipeline, _, :playing)
assert_start_of_stream(pipeline, :rtp_parser)
assert_start_of_stream(pipeline, :sink)
assert_end_of_stream(pipeline, :rtp_parser, :input, 4000)
assert_end_of_stream(pipeline, :sink)
Testing.Pipeline.stop_and_terminate(pipeline, blocking?: true)
Testing.Pipeline.terminate(pipeline, blocking?: true)
end
end
14 changes: 4 additions & 10 deletions test/membrane/rtp/stream_send_bin_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ defmodule Membrane.RTP.StreamSendBinTest do
]
}

{{:ok, spec: spec}, %{}}
{{:ok, spec: spec, playback: :playing}, %{}}
end
end

Expand All @@ -136,8 +136,6 @@ defmodule Membrane.RTP.StreamSendBinTest do

{:ok, pipeline} = Testing.Pipeline.start_link(opts)

Testing.Pipeline.play(pipeline)

assert_pipeline_playback_changed(pipeline, _, :playing)
assert_start_of_stream(pipeline, :rtp_sink)

Expand All @@ -152,7 +150,7 @@ defmodule Membrane.RTP.StreamSendBinTest do
}
} = packet

Testing.Pipeline.stop_and_terminate(pipeline, blocking?: true)
Testing.Pipeline.terminate(pipeline, blocking?: true)
end

test "Depayloaded RTP stream gets payloaded and passed through bin's output properly" do
Expand All @@ -167,14 +165,12 @@ defmodule Membrane.RTP.StreamSendBinTest do

{:ok, pipeline} = Testing.Pipeline.start_link(opts)

Testing.Pipeline.play(pipeline)

assert_pipeline_playback_changed(pipeline, _, :playing)
assert_start_of_stream(pipeline, :rtp_sink)

assert_end_of_stream(pipeline, :rtp_sink, :input, 4000)

Testing.Pipeline.stop_and_terminate(pipeline, blocking?: true)
Testing.Pipeline.terminate(pipeline, blocking?: true)
end

test "Payloaded RTP stream passes through bin's output properly" do
Expand All @@ -189,8 +185,6 @@ defmodule Membrane.RTP.StreamSendBinTest do

{:ok, pipeline} = Testing.Pipeline.start_link(opts)

Testing.Pipeline.play(pipeline)

assert_pipeline_playback_changed(pipeline, _, :playing)
assert_start_of_stream(pipeline, :rtp_sink)

Expand All @@ -200,6 +194,6 @@ defmodule Membrane.RTP.StreamSendBinTest do

assert_end_of_stream(pipeline, :rtp_sink, :input)

Testing.Pipeline.stop_and_terminate(pipeline, blocking?: true)
Testing.Pipeline.terminate(pipeline, blocking?: true)
end
end

0 comments on commit 50907ca

Please sign in to comment.