From 677a43b27a960097bcb5bc3d2104ff7f4f0f5261 Mon Sep 17 00:00:00 2001 From: "feliks.pobiedzinski@swmansion.com" Date: Fri, 10 Nov 2023 15:16:59 +0100 Subject: [PATCH 1/4] bump to 0.19.0 --- mix.exs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mix.exs b/mix.exs index b68fe62..d8329b2 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Membrane.Opus.Plugin.Mixfile do use Mix.Project - @version "0.18.1" + @version "0.19.0" @github_url "https://github.com/membraneframework/membrane_opus_plugin" def project do @@ -36,17 +36,17 @@ defmodule Membrane.Opus.Plugin.Mixfile do defp deps do [ {:bunch, "~> 1.3"}, - {:membrane_core, "~> 0.12.3"}, + {:membrane_core, "~> 1.0"}, {:membrane_opus_format, "~> 0.3.0"}, - {:membrane_raw_audio_format, "~> 0.11.0"}, + {:membrane_raw_audio_format, "~> 0.12.0"}, {:unifex, "~> 1.0"}, - {:membrane_common_c, "~> 0.15.0"}, + {:membrane_common_c, "~> 0.16.0"}, {:bundlex, "~> 1.2"}, {:dialyxir, ">= 0.0.0", only: :dev, runtime: false}, {:ex_doc, "~> 0.28", only: :dev, runtime: false}, {:credo, ">= 0.0.0", only: :dev, runtime: false}, {:membrane_file_plugin, "~> 0.13.0", only: :test}, - {:membrane_raw_audio_parser_plugin, "~> 0.3.0", only: :test} + {:membrane_raw_audio_parser_plugin, "~> 0.4.0", only: :test} ] end From 663b60e81eca1a3193d623caf0b40df170ee9360 Mon Sep 17 00:00:00 2001 From: "feliks.pobiedzinski@swmansion.com" Date: Fri, 10 Nov 2023 15:16:59 +0100 Subject: [PATCH 2/4] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cf082db..d8a3a46 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ The package can be installed by adding `membrane_opus_plugin` to your list of de ```elixir def deps do [ - {:membrane_opus_plugin, "~> 0.18.0"} + {:membrane_opus_plugin, "~> 0.19.0"} ] end ``` From fc7baf5a22e2b57a55c9cbbc4abacd978d9e32cb Mon Sep 17 00:00:00 2001 From: "feliks.pobiedzinski@swmansion.com" Date: Fri, 10 Nov 2023 15:40:28 +0100 Subject: [PATCH 3/4] Adjust to core 1.0 --- README.md | 2 +- lib/membrane_opus/decoder.ex | 6 ++---- lib/membrane_opus/encoder.ex | 6 ++---- lib/membrane_opus/parser.ex | 10 ++++------ mix.exs | 2 +- mix.lock | 14 +++++++------- test/membrane_opus/decoder_test.exs | 6 +++--- test/membrane_opus/encoder_test.exs | 10 +++++----- test/membrane_opus/parser_test.exs | 18 +++++++++--------- 9 files changed, 34 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index d8a3a46..ba5106e 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ The package can be installed by adding `membrane_opus_plugin` to your list of de ```elixir def deps do [ - {:membrane_opus_plugin, "~> 0.19.0"} + {:membrane_opus_plugin, "~> 0.19.0"} ] end ``` diff --git a/lib/membrane_opus/decoder.ex b/lib/membrane_opus/decoder.ex index b8ff314..847b6cc 100644 --- a/lib/membrane_opus/decoder.ex +++ b/lib/membrane_opus/decoder.ex @@ -23,15 +23,13 @@ defmodule Membrane.Opus.Decoder do ] def_input_pad :input, - demand_unit: :buffers, - demand_mode: :auto, accepted_format: any_of( %Opus{self_delimiting?: false}, %RemoteStream{type: :packetized, content_format: format} when format in [Opus, nil] ) - def_output_pad :output, accepted_format: %RawAudio{sample_format: :s16le}, demand_mode: :auto + def_output_pad :output, accepted_format: %RawAudio{sample_format: :s16le} @impl true def handle_init(_ctx, %__MODULE__{} = options) do @@ -54,7 +52,7 @@ defmodule Membrane.Opus.Decoder do end @impl true - def handle_process(:input, buffer, _ctx, state) do + def handle_buffer(:input, buffer, _ctx, state) do if buffer.payload === "" do Membrane.Logger.warning("Payload is empty.") {[], state} diff --git a/lib/membrane_opus/encoder.ex b/lib/membrane_opus/encoder.ex index 473d08b..7ec00e3 100644 --- a/lib/membrane_opus/encoder.ex +++ b/lib/membrane_opus/encoder.ex @@ -39,8 +39,6 @@ defmodule Membrane.Opus.Encoder do ] def_input_pad :input, - demand_unit: :bytes, - demand_mode: :auto, accepted_format: any_of( %RawAudio{ @@ -52,7 +50,7 @@ defmodule Membrane.Opus.Encoder do Membrane.RemoteStream ) - def_output_pad :output, accepted_format: %Opus{self_delimiting?: false}, demand_mode: :auto + def_output_pad :output, accepted_format: %Opus{self_delimiting?: false} @impl true def handle_init(_ctx, %__MODULE__{} = options) do @@ -134,7 +132,7 @@ defmodule Membrane.Opus.Encoder do end @impl true - def handle_process(:input, %Buffer{payload: data}, _ctx, state) do + def handle_buffer(:input, %Buffer{payload: data}, _ctx, state) do case encode_buffer(state.queue <> data, state, frame_size_in_bytes(state)) do {:ok, {[], rest}} -> # nothing was encoded diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index 73597e8..8de3830 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -38,19 +38,17 @@ defmodule Membrane.Opus.Parser do default: false, description: """ If you know that the input is self-delimitted? but you're reading from - some element that isn't sending the correct structure, you can set this + some element that isn't sending the correct spec, you can set this to true to force the Parser to assume the input is self-delimitted? and ignore upstream stream_format information on self-delimitation. """ ] def_input_pad :input, - demand_unit: :buffers, - demand_mode: :auto, accepted_format: any_of(Opus, %RemoteStream{content_format: format} when format in [Opus, nil]) - def_output_pad :output, accepted_format: Opus, demand_mode: :auto + def_output_pad :output, accepted_format: Opus @impl true def handle_init(_ctx, %__MODULE__{} = options) do @@ -67,12 +65,12 @@ defmodule Membrane.Opus.Parser do @impl true def handle_stream_format(:input, _stream_format, _ctx, state) do - # ignore stream_format, they will be sent in handle_process + # ignore stream_formats, they will be sent in handle_buffer {[], state} end @impl true - def handle_process(:input, %Buffer{payload: data}, ctx, state) do + def handle_buffer(:input, %Buffer{payload: data}, ctx, state) do {delimitation_processor, self_delimiting?} = Delimitation.get_processor(state.delimitation, state.input_delimitted?) diff --git a/mix.exs b/mix.exs index d8329b2..3cabc9c 100644 --- a/mix.exs +++ b/mix.exs @@ -45,7 +45,7 @@ defmodule Membrane.Opus.Plugin.Mixfile do {:dialyxir, ">= 0.0.0", only: :dev, runtime: false}, {:ex_doc, "~> 0.28", only: :dev, runtime: false}, {:credo, ">= 0.0.0", only: :dev, runtime: false}, - {:membrane_file_plugin, "~> 0.13.0", only: :test}, + {:membrane_file_plugin, "~> 0.16.0", only: :test}, {:membrane_raw_audio_parser_plugin, "~> 0.4.0", only: :test} ] end diff --git a/mix.lock b/mix.lock index e9fec55..ed062e9 100644 --- a/mix.lock +++ b/mix.lock @@ -18,21 +18,21 @@ "makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"}, "makeup_elixir": {:hex, :makeup_elixir, "0.16.1", "cc9e3ca312f1cfeccc572b37a09980287e243648108384b97ff2b76e505c3555", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "e127a341ad1b209bd80f7bd1620a15693a9908ed780c3b763bccf7d200c767c6"}, "makeup_erlang": {:hex, :makeup_erlang, "0.1.2", "ad87296a092a46e03b7e9b0be7631ddcf64c790fa68a9ef5323b6cbb36affc72", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f3f5a1ca93ce6e092d92b6d9c049bcda58a3b617a8d888f8e7231c85630e8108"}, - "membrane_common_c": {:hex, :membrane_common_c, "0.15.0", "4b6005c562bf025e4a53c95a9646a9f5fa993ac440dd44c1a4d1ea210ec53793", [:mix], [{:membrane_core, "~> 0.12.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:shmex, "~> 0.5.0", [hex: :shmex, repo: "hexpm", optional: false]}, {:unifex, "~> 1.0", [hex: :unifex, repo: "hexpm", optional: false]}], "hexpm", "f9584cca9865ed754b8333e362d49d6c449c708d7c87be6c5f7bd5a1d978d6bf"}, - "membrane_core": {:hex, :membrane_core, "0.12.9", "b80239deacf98f24cfd2e0703b632e92ddded8b989227cd6e724140f433b0aac", [:mix], [{:bunch, "~> 1.6", [hex: :bunch, repo: "hexpm", optional: false]}, {:qex, "~> 0.3", [hex: :qex, repo: "hexpm", optional: false]}, {:ratio, "~> 2.0", [hex: :ratio, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "389b4b22da0e35d5b053ec2fa87bf36882e0ab88f8fb841af895982fb4abe504"}, - "membrane_file_plugin": {:hex, :membrane_file_plugin, "0.13.3", "aaf40a72e5fccf6da47ec85ef525234acbec828425f1300f74c464bca1487f40", [:mix], [{:membrane_core, "~> 0.11", [hex: :membrane_core, repo: "hexpm", optional: false]}], "hexpm", "1c1acf610d4fc0279b7fd65a5db06c8bc3ef6a276bf40fb033c2c735c25839ba"}, + "membrane_common_c": {:hex, :membrane_common_c, "0.16.0", "caf3f29d2f5a1d32d8c2c122866110775866db2726e4272be58e66dfdf4bce40", [:mix], [{:membrane_core, "~> 1.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:shmex, "~> 0.5.0", [hex: :shmex, repo: "hexpm", optional: false]}, {:unifex, "~> 1.0", [hex: :unifex, repo: "hexpm", optional: false]}], "hexpm", "a3c7e91de1ce1f8b23b9823188a5d13654d317235ea0ca781c05353ed3be9b1c"}, + "membrane_core": {:hex, :membrane_core, "1.0.0", "1b543aefd952283be1f2a215a1db213aa4d91222722ba03cd35280622f1905ee", [:mix], [{:bunch, "~> 1.6", [hex: :bunch, repo: "hexpm", optional: false]}, {:qex, "~> 0.3", [hex: :qex, repo: "hexpm", optional: false]}, {:ratio, "~> 3.0", [hex: :ratio, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "352c90fd0a29942143c4bf7a727cc05c632e323f50a1a4e99321b1e8982f1533"}, + "membrane_file_plugin": {:hex, :membrane_file_plugin, "0.16.0", "7917f6682c22b9bcfc2ca20ed960eee0f7d03ad31fd5f59ed850f1fe3ddd545a", [:mix], [{:membrane_core, "~> 1.0", [hex: :membrane_core, repo: "hexpm", optional: false]}], "hexpm", "b0727998f75a9b4dab8a2baefdfc13c3eac00a04e061ab1b0e61dc5566927acc"}, "membrane_opus_format": {:hex, :membrane_opus_format, "0.3.0", "3804d9916058b7cfa2baa0131a644d8186198d64f52d592ae09e0942513cb4c2", [:mix], [], "hexpm", "8fc89c97be50de23ded15f2050fe603dcce732566fe6fdd15a2de01cb6b81afe"}, - "membrane_raw_audio_format": {:hex, :membrane_raw_audio_format, "0.11.0", "9b7e8c77f321a3fa1cac2ef157c897938084b704a90ac5450d9f5c87a249b613", [:mix], [{:bimap, "~> 1.1", [hex: :bimap, repo: "hexpm", optional: false]}, {:bunch, "~> 1.0", [hex: :bunch, repo: "hexpm", optional: false]}, {:membrane_core, "~> 0.12.0", [hex: :membrane_core, repo: "hexpm", optional: false]}], "hexpm", "89e0d46893b7cd63d1ab76467d3aae95bd8081e487b18ab0d1679c70d75f7bd8"}, + "membrane_raw_audio_format": {:hex, :membrane_raw_audio_format, "0.12.0", "b574cd90f69ce2a8b6201b0ccf0826ca28b0fbc8245b8078d9f11cef65f7d5d5", [:mix], [{:bimap, "~> 1.1", [hex: :bimap, repo: "hexpm", optional: false]}, {:bunch, "~> 1.0", [hex: :bunch, repo: "hexpm", optional: false]}, {:membrane_core, "~> 1.0", [hex: :membrane_core, repo: "hexpm", optional: false]}], "hexpm", "6e6c98e3622a2b9df19eab50ba65d7eb45949b1ba306fa8423df6cdb12fd0b44"}, + "membrane_raw_audio_parser_plugin": {:hex, :membrane_raw_audio_parser_plugin, "0.4.0", "7a1e53b68a221d00e47fb5d3c7e29200dfe8f7bc0862e69000b61c6562093acc", [:mix], [{:membrane_core, "~> 1.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:membrane_raw_audio_format, "~> 0.12.0", [hex: :membrane_raw_audio_format, repo: "hexpm", optional: false]}], "hexpm", "ff8d3fba45b1c2814b68d49878f19d2c1ad1147b53f606b48b6b67068435dcd0"}, "mime": {:hex, :mime, "2.0.5", "dc34c8efd439abe6ae0343edbb8556f4d63f178594894720607772a041b04b02", [:mix], [], "hexpm", "da0d64a365c45bc9935cc5c8a7fc5e49a0e0f9932a761c55d6c52b142780a05c"}, "mint": {:hex, :mint, "1.5.1", "8db5239e56738552d85af398798c80648db0e90f343c8469f6c6d8898944fb6f", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "4a63e1e76a7c3956abd2c72f370a0d0aecddc3976dea5c27eccbecfa5e7d5b1e"}, "nimble_options": {:hex, :nimble_options, "1.0.2", "92098a74df0072ff37d0c12ace58574d26880e522c22801437151a159392270e", [:mix], [], "hexpm", "fd12a8db2021036ce12a309f26f564ec367373265b53e25403f0ee697380f1b8"}, - "membrane_raw_audio_parser_plugin": {:hex, :membrane_raw_audio_parser_plugin, "0.3.0", "30cd762226c2629966c7848f8cdb0fff61660110f93fbb70b90fc1070e0dcce6", [:mix], [{:membrane_core, "~> 0.12.0", [hex: :membrane_core, repo: "hexpm", optional: false]}, {:membrane_raw_audio_format, "~> 0.11.0", [hex: :membrane_raw_audio_format, repo: "hexpm", optional: false]}], "hexpm", "52b05198243cd90c852a24d7982e08aaee113901b1e7fcf062479ab165ded390"}, "nimble_parsec": {:hex, :nimble_parsec, "1.3.1", "2c54013ecf170e249e9291ed0a62e5832f70a476c61da16f6aac6dca0189f2af", [:mix], [], "hexpm", "2682e3c0b2eb58d90c6375fc0cc30bc7be06f365bf72608804fb9cffa5e1b167"}, "nimble_pool": {:hex, :nimble_pool, "1.0.0", "5eb82705d138f4dd4423f69ceb19ac667b3b492ae570c9f5c900bb3d2f50a847", [:mix], [], "hexpm", "80be3b882d2d351882256087078e1b1952a28bf98d0a287be87e4a24a710b67a"}, "numbers": {:hex, :numbers, "5.2.4", "f123d5bb7f6acc366f8f445e10a32bd403c8469bdbce8ce049e1f0972b607080", [:mix], [{:coerce, "~> 1.0", [hex: :coerce, repo: "hexpm", optional: false]}, {:decimal, "~> 1.9 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "eeccf5c61d5f4922198395bf87a465b6f980b8b862dd22d28198c5e6fab38582"}, "qex": {:hex, :qex, "0.5.1", "0d82c0f008551d24fffb99d97f8299afcb8ea9cf99582b770bd004ed5af63fd6", [:mix], [], "hexpm", "935a39fdaf2445834b95951456559e9dc2063d0a055742c558a99987b38d6bab"}, - "ratio": {:hex, :ratio, "2.4.2", "c8518f3536d49b1b00d88dd20d49f8b11abb7819638093314a6348139f14f9f9", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:numbers, "~> 5.2.0", [hex: :numbers, repo: "hexpm", optional: false]}], "hexpm", "441ef6f73172a3503de65ccf1769030997b0d533b1039422f1e5e0e0b4cbf89e"}, - "req": {:hex, :req, "0.4.4", "a17b6bec956c9af4f08b5d8e8a6fc6e4edf24ccc0ac7bf363a90bba7a0f0138c", [:mix], [{:brotli, "~> 0.3.1", [hex: :brotli, repo: "hexpm", optional: true]}, {:ezstd, "~> 1.0", [hex: :ezstd, repo: "hexpm", optional: true]}, {:finch, "~> 0.9", [hex: :finch, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:nimble_csv, "~> 1.0", [hex: :nimble_csv, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "2618c0493444fee927d12073afb42e9154e766b3f4448e1011f0d3d551d1a011"}, + "ratio": {:hex, :ratio, "3.0.2", "60a5976872a4dc3d873ecc57eed1738589e99d1094834b9c935b118231297cfb", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:numbers, "~> 5.2.0", [hex: :numbers, repo: "hexpm", optional: false]}], "hexpm", "3a13ed5a30ad0bfd7e4a86bf86d93d2b5a06f5904417d38d3f3ea6406cdfc7bb"}, + "req": {:hex, :req, "0.4.5", "2071bbedd280f107b9e33e1ddff2beb3991ec1ae06caa2cca2ab756393d8aca5", [:mix], [{:brotli, "~> 0.3.1", [hex: :brotli, repo: "hexpm", optional: true]}, {:ezstd, "~> 1.0", [hex: :ezstd, repo: "hexpm", optional: true]}, {:finch, "~> 0.9", [hex: :finch, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:nimble_csv, "~> 1.0", [hex: :nimble_csv, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "dd23e9c7303ddeb2dee09ff11ad8102cca019e38394456f265fb7b9655c64dd8"}, "secure_random": {:hex, :secure_random, "0.5.1", "c5532b37c89d175c328f5196a0c2a5680b15ebce3e654da37129a9fe40ebf51b", [:mix], [], "hexpm", "1b9754f15e3940a143baafd19da12293f100044df69ea12db5d72878312ae6ab"}, "shmex": {:hex, :shmex, "0.5.0", "7dc4fb1a8bd851085a652605d690bdd070628717864b442f53d3447326bcd3e8", [:mix], [{:bunch_native, "~> 0.5.0", [hex: :bunch_native, repo: "hexpm", optional: false]}, {:bundlex, "~> 1.0", [hex: :bundlex, repo: "hexpm", optional: false]}], "hexpm", "b67bb1e22734758397c84458dbb746519e28eac210423c267c7248e59fc97bdc"}, "telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"}, diff --git a/test/membrane_opus/decoder_test.exs b/test/membrane_opus/decoder_test.exs index 571301f..7488cfb 100644 --- a/test/membrane_opus/decoder_test.exs +++ b/test/membrane_opus/decoder_test.exs @@ -13,7 +13,7 @@ defmodule Membrane.Opus.Decoder.DecoderTest do import Membrane.ChildrenSpec import Membrane.Testing.Assertions - structure = [ + spec = [ child(:source, %Testing.Source{ output: @sample_opus_packets, stream_format: %RemoteStream{type: :packetized} @@ -22,7 +22,7 @@ defmodule Membrane.Opus.Decoder.DecoderTest do |> child(:sink, Testing.Sink) ] - pipeline = Pipeline.start_link_supervised!(structure: structure) + pipeline = Pipeline.start_link_supervised!(spec: spec) assert_start_of_stream(pipeline, :sink) @@ -34,6 +34,6 @@ defmodule Membrane.Opus.Decoder.DecoderTest do assert_end_of_stream(pipeline, :sink) refute_sink_buffer(pipeline, :sink, _, 0) - Membrane.Pipeline.terminate(pipeline, blocking?: true) + Membrane.Pipeline.terminate(pipeline) end end diff --git a/test/membrane_opus/encoder_test.exs b/test/membrane_opus/encoder_test.exs index 5337e6f..ce42744 100644 --- a/test/membrane_opus/encoder_test.exs +++ b/test/membrane_opus/encoder_test.exs @@ -14,7 +14,7 @@ defmodule Membrane.Opus.Encoder.EncoderTest do defp setup_pipeline(output_path) do on_exit(fn -> File.rm(output_path) end) - structure = [ + spec = [ child(:source, %Membrane.File.Source{ location: @input_path }) @@ -31,7 +31,7 @@ defmodule Membrane.Opus.Encoder.EncoderTest do }) ] - Pipeline.start_link_supervised!(structure: structure) + Pipeline.start_link_supervised!(spec: spec) end @tag :tmp_dir @@ -45,11 +45,11 @@ defmodule Membrane.Opus.Encoder.EncoderTest do output = File.read!(output_path) assert reference == output - Membrane.Pipeline.terminate(pipeline_pid, blocking?: true) + Membrane.Pipeline.terminate(pipeline_pid) end test "encoder works with stream format received on :input pad" do - structure = [ + spec = [ child(:source, %Membrane.File.Source{ location: @input_path }) @@ -60,7 +60,7 @@ defmodule Membrane.Opus.Encoder.EncoderTest do |> child(:sink, Sink) ] - pipeline = Pipeline.start_link_supervised!(structure: structure) + pipeline = Pipeline.start_link_supervised!(spec: spec) assert_start_of_stream(pipeline, :encoder, :input) end end diff --git a/test/membrane_opus/parser_test.exs b/test/membrane_opus/parser_test.exs index df13aec..1eca460 100644 --- a/test/membrane_opus/parser_test.exs +++ b/test/membrane_opus/parser_test.exs @@ -94,13 +94,13 @@ defmodule Membrane.Opus.Parser.ParserTest do @fixtures |> Enum.map(fn fixture -> fixture.normal end) - structure = [ + spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) |> child(:parser, Parser) |> child(:sink, Sink) ] - pipeline = Pipeline.start_link_supervised!(structure: structure) + pipeline = Pipeline.start_link_supervised!(spec: spec) do_test(pipeline, false) end @@ -110,13 +110,13 @@ defmodule Membrane.Opus.Parser.ParserTest do @fixtures |> Enum.map(fn fixture -> fixture.normal end) - structure = [ + spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) |> child(:parser, %Parser{delimitation: :delimit}) |> child(:sink, Sink) ] - pipeline = Pipeline.start_link_supervised!(structure: structure) + pipeline = Pipeline.start_link_supervised!(spec: spec) do_test(pipeline, true) end @@ -126,13 +126,13 @@ defmodule Membrane.Opus.Parser.ParserTest do @fixtures |> Enum.map(fn fixture -> fixture.delimited end) - structure = [ + spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) |> child(:parser, %Parser{input_delimitted?: true}) |> child(:sink, Sink) ] - pipeline = Pipeline.start_link_supervised!(structure: structure) + pipeline = Pipeline.start_link_supervised!(spec: spec) do_test(pipeline, true) end @@ -142,13 +142,13 @@ defmodule Membrane.Opus.Parser.ParserTest do @fixtures |> Enum.map(fn fixture -> fixture.delimited end) - structure = [ + spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) |> child(:parser, %Parser{delimitation: :undelimit, input_delimitted?: true}) |> child(:sink, Sink) ] - pipeline = Pipeline.start_link_supervised!(structure: structure) + pipeline = Pipeline.start_link_supervised!(spec: spec) do_test(pipeline, false) end @@ -187,6 +187,6 @@ defmodule Membrane.Opus.Parser.ParserTest do assert_end_of_stream(pipeline, :sink) refute_sink_buffer(pipeline, :sink, _, 0) - Pipeline.terminate(pipeline, blocking?: true) + Pipeline.terminate(pipeline) end end From 883c1057525e70d1560958ec3982192585830355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Feliks=20Pobiedzi=C5=84ski?= <38541925+FelonEkonom@users.noreply.github.com> Date: Fri, 10 Nov 2023 18:19:12 +0100 Subject: [PATCH 4/4] Update parser.ex --- lib/membrane_opus/parser.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index 8de3830..cefd5c7 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -38,7 +38,7 @@ defmodule Membrane.Opus.Parser do default: false, description: """ If you know that the input is self-delimitted? but you're reading from - some element that isn't sending the correct spec, you can set this + some element that isn't sending the correct structure, you can set this to true to force the Parser to assume the input is self-delimitted? and ignore upstream stream_format information on self-delimitation. """