From 957a363a67e00a4995ec80703730cc699e2b4ed4 Mon Sep 17 00:00:00 2001 From: bartkrak Date: Tue, 12 Dec 2023 15:51:34 +0100 Subject: [PATCH 01/39] vip --- .vscode/settings.json | 3 ++ lib/membrane_opus/decoder.ex | 2 ++ lib/membrane_opus/encoder.ex | 8 ++++++ lib/membrane_opus/parser.ex | 44 ++++++++++++++++++++++-------- test/membrane_opus/parser_test.exs | 38 ++++++++++++++++++-------- 5 files changed, 72 insertions(+), 23 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..fc4c15b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "C_Cpp.errorSquiggles": "enabled" +} \ No newline at end of file diff --git a/lib/membrane_opus/decoder.ex b/lib/membrane_opus/decoder.ex index 847b6cc..cee32e2 100644 --- a/lib/membrane_opus/decoder.ex +++ b/lib/membrane_opus/decoder.ex @@ -57,12 +57,14 @@ defmodule Membrane.Opus.Decoder do Membrane.Logger.warning("Payload is empty.") {[], state} else + IO.inspect(buffer.pts, label: "buffer in") {:ok, _config_number, stereo_flag, _frame_packing} = Util.parse_toc_byte(buffer.payload) channels = Util.parse_channels(stereo_flag) {stream_format, state} = maybe_make_native(channels, state) decoded = Native.decode_packet(state.native, buffer.payload) buffer = %Buffer{buffer | payload: decoded} + IO.inspect(buffer) {stream_format ++ [buffer: {:output, buffer}], state} end end diff --git a/lib/membrane_opus/encoder.ex b/lib/membrane_opus/encoder.ex index 7ec00e3..42e01de 100644 --- a/lib/membrane_opus/encoder.ex +++ b/lib/membrane_opus/encoder.ex @@ -36,6 +36,13 @@ defmodule Membrane.Opus.Encoder do description: """ Input type - used to set input sample rate and channels. """ + ], + generate_best_effort_timestamps: [ + spec: boolean(), + default: false, + description: """ + generate_best_effort_timestamps - missing description + """ ] def_input_pad :input, @@ -205,6 +212,7 @@ defmodule Membrane.Opus.Encoder do # Encode a single frame because buffer contains at least one frame <> = raw_buffer {:ok, raw_encoded} = Native.encode_packet(state.native, raw_frame, frame_size(state)) + IO.inspect(raw_encoded) # maybe keep encoding if there are more frames encode_buffer( diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index cefd5c7..32ebefb 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -42,8 +42,16 @@ defmodule Membrane.Opus.Parser do to true to force the Parser to assume the input is self-delimitted? and ignore upstream stream_format information on self-delimitation. """ + ], + generate_best_effort_timestamps: [ + spec: boolean(), + default: false, + description: """ + generate_best_effort_timestamps - missing description + """ ] + def_input_pad :input, accepted_format: any_of(Opus, %RemoteStream{content_format: format} when format in [Opus, nil]) @@ -52,6 +60,7 @@ defmodule Membrane.Opus.Parser do @impl true def handle_init(_ctx, %__MODULE__{} = options) do + state = options |> Map.from_struct() @@ -71,14 +80,15 @@ defmodule Membrane.Opus.Parser do @impl true def handle_buffer(:input, %Buffer{payload: data}, ctx, state) do + {delimitation_processor, self_delimiting?} = Delimitation.get_processor(state.delimitation, state.input_delimitted?) - case maybe_parse( state.buffer <> data, state.pts, state.input_delimitted?, - delimitation_processor + delimitation_processor, + state.generate_best_effort_timestamps ) do {:ok, buffer, pts, packets, channels} -> stream_format = %Opus{ @@ -112,24 +122,24 @@ defmodule Membrane.Opus.Parser do pts :: Membrane.Time.t(), input_delimitted? :: boolean, processor :: Delimitation.processor_t(), + generate_best_effort_timestamps :: boolean, packets :: [Buffer.t()], channels :: 0..2 ) :: {:ok, remaining_buffer :: binary, pts :: Membrane.Time.t(), packets :: [Buffer.t()], channels :: 0..2} | :error - defp maybe_parse(data, pts, input_delimitted?, processor, packets \\ [], channels \\ 0) + defp maybe_parse(data, pts, input_delimitted?, processor, generate_best_effort_timestamps, packets \\ [], channels \\ 0) - defp maybe_parse(data, pts, input_delimitted?, processor, packets, channels) + defp maybe_parse(data, pts, input_delimitted?, processor, generate_best_effort_timestamps, packets, channels) when byte_size(data) > 0 do with {:ok, configuration_number, stereo_flag, frame_packing} <- Util.parse_toc_byte(data), channels <- max(channels, Util.parse_channels(stereo_flag)), - {:ok, _mode, _bandwidth, frame_duration} <- - Util.parse_configuration(configuration_number), - {:ok, header_size, frame_lengths, padding_size} <- - FrameLengths.parse(frame_packing, data, input_delimitted?), + {:ok, _mode, _bandwidth, frame_duration} <- Util.parse_configuration(configuration_number), + {:ok, header_size, frame_lengths, padding_size} <- FrameLengths.parse(frame_packing, data, input_delimitted?), expected_packet_size <- header_size + Enum.sum(frame_lengths) + padding_size, {:ok, raw_packet, rest} <- rest_of_packet(data, expected_packet_size) do + duration = elapsed_time(frame_lengths, frame_duration) packet = %Buffer{ @@ -139,12 +149,15 @@ defmodule Membrane.Opus.Parser do duration: duration } } - + IO.inspect(pts, label: "pts in") + IO.inspect(rest, label: "rest") + IO.inspect(raw_packet, label: "raw") maybe_parse( rest, - pts + duration, + generate_pts(pts,duration,generate_best_effort_timestamps), input_delimitted?, processor, + generate_best_effort_timestamps, [packet | packets], channels ) @@ -157,7 +170,16 @@ defmodule Membrane.Opus.Parser do end end - defp maybe_parse(data, pts, _input_delimitted?, _processor, packets, channels) do + defp generate_pts(pts, duration, generate_best_effort_timestamps) do + IO.inspect(generate_best_effort_timestamps, label: "generate_best_effort_timestamps") + if generate_best_effort_timestamps do + pts + duration + else + 2137 + end + end + + defp maybe_parse(data, pts, _input_delimitted?, _processor, _generate_best_effort_timestamps, packets, channels) do {:ok, data, pts, packets |> Enum.reverse(), channels} end diff --git a/test/membrane_opus/parser_test.exs b/test/membrane_opus/parser_test.exs index 1eca460..22901ac 100644 --- a/test/membrane_opus/parser_test.exs +++ b/test/membrane_opus/parser_test.exs @@ -17,7 +17,8 @@ defmodule Membrane.Opus.Parser.ParserTest do delimited: <<4, 0>>, channels: 2, duration: 0, - pts: 0 + pts: 0, + generate_best_effort_timestamps: true }, %{ desc: "code 1", @@ -25,7 +26,8 @@ defmodule Membrane.Opus.Parser.ParserTest do delimited: <<121, 2, 0, 0, 0, 0>>, channels: 1, duration: 40 |> milliseconds(), - pts: 0 + pts: 0, + generate_best_effort_timestamps: true }, %{ desc: "code 2", @@ -33,7 +35,8 @@ defmodule Membrane.Opus.Parser.ParserTest do delimited: <<198, 1, 3, 0, 0, 0, 0>>, channels: 2, duration: 5 |> milliseconds(), - pts: 40 |> milliseconds() + pts: 40 |> milliseconds(), + generate_best_effort_timestamps: true }, %{ desc: "code 3 cbr, no padding", @@ -41,7 +44,8 @@ defmodule Membrane.Opus.Parser.ParserTest do delimited: <<199, 3, 1, 0, 0, 0>>, channels: 2, duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), - pts: 45 |> milliseconds() + pts: 45 |> milliseconds(), + generate_best_effort_timestamps: true }, %{ desc: "code 3 cbr, padding", @@ -49,7 +53,8 @@ defmodule Membrane.Opus.Parser.ParserTest do delimited: <<199, 67, 2, 1, 0, 0, 0, 0, 0>>, channels: 2, duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), - pts: (52.5 * 1_000_000) |> trunc() |> nanoseconds() + pts: (52.5 * 1_000_000) |> trunc() |> nanoseconds(), + generate_best_effort_timestamps: true }, %{ desc: "code 3 vbr, no padding", @@ -57,7 +62,17 @@ defmodule Membrane.Opus.Parser.ParserTest do delimited: <<199, 131, 1, 2, 1, 0, 0, 0, 0>>, channels: 2, duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), - pts: 60 |> milliseconds() + pts: 60 |> milliseconds(), + generate_best_effort_timestamps: true + }, + %{ + desc: "code 3 vbr, conc", + normal: <<199, 131, 1, 2, 0, 0, 0, 0>>, + delimited: <<199, 131, 1, 2, 1, 0, 0, 0, 0, 199, 67, 2, 1, 0, 0, 0, 0, 0>>, + channels: 2, + duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), + pts: 60 |> milliseconds(), + generate_best_effort_timestamps: true }, %{ desc: "code 3 vbr, no padding, long length", @@ -85,10 +100,10 @@ defmodule Membrane.Opus.Parser.ParserTest do 0, 0, 3, 3, 3>>, channels: 2, duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), - pts: (67.5 * 1_000_000) |> trunc() |> nanoseconds() + pts: (67.5 * 1_000_000) |> trunc() |> nanoseconds(), + generate_best_effort_timestamps: true } ] - test "non-self-delimiting input and output" do inputs = @fixtures @@ -112,7 +127,7 @@ defmodule Membrane.Opus.Parser.ParserTest do spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) - |> child(:parser, %Parser{delimitation: :delimit}) + |> child(:parser, %Parser{delimitation: :delimit, generate_best_effort_timestamps: true}) |> child(:sink, Sink) ] @@ -128,7 +143,7 @@ defmodule Membrane.Opus.Parser.ParserTest do spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) - |> child(:parser, %Parser{input_delimitted?: true}) + |> child(:parser, %Parser{input_delimitted?: true,generate_best_effort_timestamps: true}) |> child(:sink, Sink) ] @@ -144,7 +159,7 @@ defmodule Membrane.Opus.Parser.ParserTest do spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) - |> child(:parser, %Parser{delimitation: :undelimit, input_delimitted?: true}) + |> child(:parser, %Parser{delimitation: :undelimit, input_delimitted?: true, generate_best_effort_timestamps: true}) |> child(:sink, Sink) ] @@ -155,7 +170,6 @@ defmodule Membrane.Opus.Parser.ParserTest do defp do_test(pipeline, self_delimiting?) do assert_start_of_stream(pipeline, :sink) - @fixtures |> Enum.each(fn fixture -> expected_buffer = %Buffer{ From 9bb6bc0b6c32ebf07a119076983ebfbc32c629d8 Mon Sep 17 00:00:00 2001 From: bartkrak Date: Thu, 14 Dec 2023 16:03:38 +0100 Subject: [PATCH 02/39] encoder ready for testing --- lib/membrane_opus/decoder.ex | 6 +- lib/membrane_opus/encoder.ex | 46 ++++--- lib/membrane_opus/parser.ex | 68 +++++++--- test/membrane_opus/encoder_test.exs | 3 + test/membrane_opus/parser_test.exs | 199 ++++++++++++++++------------ 5 files changed, 193 insertions(+), 129 deletions(-) diff --git a/lib/membrane_opus/decoder.ex b/lib/membrane_opus/decoder.ex index cee32e2..6d199d7 100644 --- a/lib/membrane_opus/decoder.ex +++ b/lib/membrane_opus/decoder.ex @@ -53,18 +53,20 @@ defmodule Membrane.Opus.Decoder do @impl true def handle_buffer(:input, buffer, _ctx, state) do + IO.inspect(buffer, label: "buffer in") + buffer = %Buffer{buffer | pts: 2} + if buffer.payload === "" do Membrane.Logger.warning("Payload is empty.") {[], state} else - IO.inspect(buffer.pts, label: "buffer in") {:ok, _config_number, stereo_flag, _frame_packing} = Util.parse_toc_byte(buffer.payload) channels = Util.parse_channels(stereo_flag) {stream_format, state} = maybe_make_native(channels, state) decoded = Native.decode_packet(state.native, buffer.payload) buffer = %Buffer{buffer | payload: decoded} - IO.inspect(buffer) + IO.inspect(buffer, label: "buffer out") {stream_format ++ [buffer: {:output, buffer}], state} end end diff --git a/lib/membrane_opus/encoder.ex b/lib/membrane_opus/encoder.ex index 42e01de..99debee 100644 --- a/lib/membrane_opus/encoder.ex +++ b/lib/membrane_opus/encoder.ex @@ -36,13 +36,6 @@ defmodule Membrane.Opus.Encoder do description: """ Input type - used to set input sample rate and channels. """ - ], - generate_best_effort_timestamps: [ - spec: boolean(), - default: false, - description: """ - generate_best_effort_timestamps - missing description - """ ] def_input_pad :input, @@ -65,6 +58,7 @@ defmodule Membrane.Opus.Encoder do options |> Map.from_struct() |> Map.merge(%{ + pts: nil, native: nil, queue: <<>> }) @@ -139,15 +133,16 @@ defmodule Membrane.Opus.Encoder do end @impl true - 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}} -> + def handle_buffer(:input, %Buffer{payload: data, pts: pts}, _ctx, state) do + case encode_buffer(state.queue <> data, %{state | pts: pts}, frame_size_in_bytes(state)) do + {:ok, {[], rest}, new_state} -> # nothing was encoded - {[], %{state | queue: rest}} + {[], %{state | queue: rest, pts: new_state.pts}} - {:ok, {encoded_buffers, rest}} -> + {:ok, {encoded_buffers, rest}, new_state} -> # something was encoded - {[buffer: {:output, encoded_buffers}], %{state | queue: rest}} + IO.inspect(encoded_buffers, label: "encoded_buffers") + {[buffer: {:output, encoded_buffers}], %{state | queue: rest, pts: new_state.pts }} end end @@ -210,21 +205,36 @@ defmodule Membrane.Opus.Encoder do defp encode_buffer(raw_buffer, state, target_byte_size, encoded_frames) when byte_size(raw_buffer) >= target_byte_size do # Encode a single frame because buffer contains at least one frame + <> = raw_buffer {:ok, raw_encoded} = Native.encode_packet(state.native, raw_frame, frame_size(state)) - IO.inspect(raw_encoded) # maybe keep encoding if there are more frames + out_buffer = [%Buffer{payload: raw_encoded, pts: state.pts} | encoded_frames] + new_state = update_state_pts(state, raw_frame) + encode_buffer( rest, - state, + new_state, target_byte_size, - [%Buffer{payload: raw_encoded} | encoded_frames] + out_buffer ) end - defp encode_buffer(raw_buffer, _state, _target_byte_size, encoded_frames) do + defp encode_buffer(raw_buffer, state, _target_byte_size, encoded_frames) do # Invariant for encode_buffer - return what we have encoded - {:ok, {encoded_frames |> Enum.reverse(), raw_buffer}} + {:ok, {encoded_frames |> Enum.reverse(), raw_buffer}, state} + end + + defp update_state_pts(state, raw_frame) do + if state.pts == nil do + state + else + duration = + raw_frame + |> byte_size() + |> RawAudio.bytes_to_time(state.input_stream_format) + %{state | pts: state.pts + duration} + end end end diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index 32ebefb..491e3de 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -51,7 +51,6 @@ defmodule Membrane.Opus.Parser do """ ] - def_input_pad :input, accepted_format: any_of(Opus, %RemoteStream{content_format: format} when format in [Opus, nil]) @@ -60,7 +59,6 @@ defmodule Membrane.Opus.Parser do @impl true def handle_init(_ctx, %__MODULE__{} = options) do - state = options |> Map.from_struct() @@ -80,9 +78,9 @@ defmodule Membrane.Opus.Parser do @impl true def handle_buffer(:input, %Buffer{payload: data}, ctx, state) do - {delimitation_processor, self_delimiting?} = Delimitation.get_processor(state.delimitation, state.input_delimitted?) + case maybe_parse( state.buffer <> data, state.pts, @@ -129,17 +127,34 @@ defmodule Membrane.Opus.Parser do {:ok, remaining_buffer :: binary, pts :: Membrane.Time.t(), packets :: [Buffer.t()], channels :: 0..2} | :error - defp maybe_parse(data, pts, input_delimitted?, processor, generate_best_effort_timestamps, packets \\ [], channels \\ 0) - - defp maybe_parse(data, pts, input_delimitted?, processor, generate_best_effort_timestamps, packets, channels) + defp maybe_parse( + data, + pts, + input_delimitted?, + processor, + generate_best_effort_timestamps, + packets \\ [], + channels \\ 0 + ) + + defp maybe_parse( + data, + pts, + input_delimitted?, + processor, + generate_best_effort_timestamps, + packets, + channels + ) when byte_size(data) > 0 do with {:ok, configuration_number, stereo_flag, frame_packing} <- Util.parse_toc_byte(data), channels <- max(channels, Util.parse_channels(stereo_flag)), - {:ok, _mode, _bandwidth, frame_duration} <- Util.parse_configuration(configuration_number), - {:ok, header_size, frame_lengths, padding_size} <- FrameLengths.parse(frame_packing, data, input_delimitted?), + {:ok, _mode, _bandwidth, frame_duration} <- + Util.parse_configuration(configuration_number), + {:ok, header_size, frame_lengths, padding_size} <- + FrameLengths.parse(frame_packing, data, input_delimitted?), expected_packet_size <- header_size + Enum.sum(frame_lengths) + padding_size, {:ok, raw_packet, rest} <- rest_of_packet(data, expected_packet_size) do - duration = elapsed_time(frame_lengths, frame_duration) packet = %Buffer{ @@ -149,12 +164,24 @@ defmodule Membrane.Opus.Parser do duration: duration } } + IO.inspect(pts, label: "pts in") IO.inspect(rest, label: "rest") - IO.inspect(raw_packet, label: "raw") + IO.inspect(packet, label: "packet") + + generate_pts = fn pts, duration, generate_best_effort_timestamps -> + IO.inspect(generate_best_effort_timestamps, label: "generate_best_effort_timestamps") + + if generate_best_effort_timestamps do + pts + duration + else + pts + duration + end + end + maybe_parse( rest, - generate_pts(pts,duration,generate_best_effort_timestamps), + generate_pts.(pts, duration, generate_best_effort_timestamps), input_delimitted?, processor, generate_best_effort_timestamps, @@ -170,16 +197,15 @@ defmodule Membrane.Opus.Parser do end end - defp generate_pts(pts, duration, generate_best_effort_timestamps) do - IO.inspect(generate_best_effort_timestamps, label: "generate_best_effort_timestamps") - if generate_best_effort_timestamps do - pts + duration - else - 2137 - end - end - - defp maybe_parse(data, pts, _input_delimitted?, _processor, _generate_best_effort_timestamps, packets, channels) do + defp maybe_parse( + data, + pts, + _input_delimitted?, + _processor, + _generate_best_effort_timestamps, + packets, + channels + ) do {:ok, data, pts, packets |> Enum.reverse(), channels} end diff --git a/test/membrane_opus/encoder_test.exs b/test/membrane_opus/encoder_test.exs index ce42744..dc96d09 100644 --- a/test/membrane_opus/encoder_test.exs +++ b/test/membrane_opus/encoder_test.exs @@ -48,6 +48,7 @@ defmodule Membrane.Opus.Encoder.EncoderTest do Membrane.Pipeline.terminate(pipeline_pid) end + @tag :a test "encoder works with stream format received on :input pad" do spec = [ child(:source, %Membrane.File.Source{ @@ -62,5 +63,7 @@ defmodule Membrane.Opus.Encoder.EncoderTest do pipeline = Pipeline.start_link_supervised!(spec: spec) assert_start_of_stream(pipeline, :encoder, :input) + + Pipeline.terminate(pipeline) end end diff --git a/test/membrane_opus/parser_test.exs b/test/membrane_opus/parser_test.exs index 22901ac..aada0d4 100644 --- a/test/membrane_opus/parser_test.exs +++ b/test/membrane_opus/parser_test.exs @@ -11,98 +11,100 @@ defmodule Membrane.Opus.Parser.ParserTest do alias Membrane.Testing.{Pipeline, Sink, Source} @fixtures [ - %{ - desc: "dropped packet, code 0", - normal: <<4>>, - delimited: <<4, 0>>, - channels: 2, - duration: 0, - pts: 0, - generate_best_effort_timestamps: true - }, - %{ - desc: "code 1", - normal: <<121, 0, 0, 0, 0>>, - delimited: <<121, 2, 0, 0, 0, 0>>, - channels: 1, - duration: 40 |> milliseconds(), - pts: 0, - generate_best_effort_timestamps: true - }, + # %{ + # desc: "dropped packet, code 0", + # normal: <<4>>, + # delimited: <<4, 0>>, + # channels: 2, + # duration: 0, + # pts: 0, + # generate_best_effort_timestamps: true + # }, + # %{ + # desc: "code 1", + # normal: <<121, 0, 0, 0, 0>>, + # delimited: <<121, 2, 0, 0, 0, 0>>, + # channels: 1, + # duration: 40 |> milliseconds(), + # pts: 0, + # generate_best_effort_timestamps: true + # }, + # original + # %{ + # desc: "code 2", + # normal: <<198, 1, 0, 0, 0, 0>>, + # delimited: <<198, 1, 3, 0, 0, 0, 0>>, + # channels: 2, + # duration: 15 |> milliseconds(), + # pts: 0 |> milliseconds(), + # generate_best_effort_timestamps: true + # }, + # 3x longer %{ desc: "code 2", normal: <<198, 1, 0, 0, 0, 0>>, - delimited: <<198, 1, 3, 0, 0, 0, 0>>, - channels: 2, - duration: 5 |> milliseconds(), - pts: 40 |> milliseconds(), - generate_best_effort_timestamps: true - }, - %{ - desc: "code 3 cbr, no padding", - normal: <<199, 3, 0, 0, 0>>, - delimited: <<199, 3, 1, 0, 0, 0>>, - channels: 2, - duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), - pts: 45 |> milliseconds(), - generate_best_effort_timestamps: true - }, - %{ - desc: "code 3 cbr, padding", - normal: <<199, 67, 2, 0, 0, 0, 0, 0>>, - delimited: <<199, 67, 2, 1, 0, 0, 0, 0, 0>>, - channels: 2, - duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), - pts: (52.5 * 1_000_000) |> trunc() |> nanoseconds(), - generate_best_effort_timestamps: true - }, - %{ - desc: "code 3 vbr, no padding", - normal: <<199, 131, 1, 2, 0, 0, 0, 0>>, - delimited: <<199, 131, 1, 2, 1, 0, 0, 0, 0>>, + delimited: <<198, 1, 3, 0, 0, 0, 0, 198, 1, 3, 0, 0, 0, 0, 198, 1, 3, 0, 0, 0, 0>>, channels: 2, - duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), - pts: 60 |> milliseconds(), - generate_best_effort_timestamps: true - }, - %{ - desc: "code 3 vbr, conc", - normal: <<199, 131, 1, 2, 0, 0, 0, 0>>, - delimited: <<199, 131, 1, 2, 1, 0, 0, 0, 0, 199, 67, 2, 1, 0, 0, 0, 0, 0>>, - channels: 2, - duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), - pts: 60 |> milliseconds(), - generate_best_effort_timestamps: true - }, - %{ - desc: "code 3 vbr, no padding, long length", - normal: - <<199, 131, 253, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, - 0, 3, 3, 3>>, - delimited: - <<199, 131, 253, 0, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 3, 3, 3>>, - channels: 2, - duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), - pts: (67.5 * 1_000_000) |> trunc() |> nanoseconds(), + duration: 15 |> milliseconds(), + pts: 0 |> milliseconds(), generate_best_effort_timestamps: true } + # %{ + # desc: "code 3 cbr, no padding", + # normal: <<199, 3, 0, 0, 0>>, + # delimited: <<199, 3, 1, 0, 0, 0>>, + # channels: 2, + # duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), + # pts: 45 |> milliseconds(), + # generate_best_effort_timestamps: true + # }, + # %{ + # desc: "code 3 cbr, padding", + # normal: <<199, 67, 2, 0, 0, 0, 0, 0>>, + # delimited: <<199, 67, 2, 1, 0, 0, 0, 0, 0>>, + # channels: 2, + # duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), + # pts: (52.5 * 1_000_000) |> trunc() |> nanoseconds(), + # generate_best_effort_timestamps: true + # }, + # %{ + # desc: "code 3 vbr, no padding", + # normal: <<199, 131, 1, 2, 0, 0, 0, 0>>, + # delimited: <<199, 131, 1, 2, 1, 0, 0, 0, 0>>, + # channels: 2, + # duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), + # pts: 60 |> milliseconds(), + # generate_best_effort_timestamps: true + # }, + # %{ + # desc: "code 3 vbr, no padding, long length", + # normal: + # <<199, 131, 253, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + # 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + # 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + # 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + # 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + # 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + # 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, + # 0, 0, 3, 3, 3>>, + # channels: 2, + # duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), + # pts: (67.5 * 1_000_000) |> trunc() |> nanoseconds(), + # generate_best_effort_timestamps: true + # } ] test "non-self-delimiting input and output" do inputs = @@ -143,7 +145,7 @@ defmodule Membrane.Opus.Parser.ParserTest do spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) - |> child(:parser, %Parser{input_delimitted?: true,generate_best_effort_timestamps: true}) + |> child(:parser, %Parser{input_delimitted?: true, generate_best_effort_timestamps: true}) |> child(:sink, Sink) ] @@ -159,7 +161,11 @@ defmodule Membrane.Opus.Parser.ParserTest do spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) - |> child(:parser, %Parser{delimitation: :undelimit, input_delimitted?: true, generate_best_effort_timestamps: true}) + |> child(:parser, %Parser{ + delimitation: :undelimit, + input_delimitted?: true, + generate_best_effort_timestamps: true + }) |> child(:sink, Sink) ] @@ -168,8 +174,25 @@ defmodule Membrane.Opus.Parser.ParserTest do do_test(pipeline, false) end + test "self-delimiting input, multiple self-delimiting outputs" do + inputs = + @fixtures + |> Enum.map(fn fixture -> fixture.delimited end) + + spec = [ + child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) + |> child(:parser, %Parser{input_delimitted?: true, generate_best_effort_timestamps: true}) + |> child(:sink, Sink) + ] + + pipeline = Pipeline.start_link_supervised!(spec: spec) + + do_test(pipeline, true) + end + defp do_test(pipeline, self_delimiting?) do assert_start_of_stream(pipeline, :sink) + @fixtures |> Enum.each(fn fixture -> expected_buffer = %Buffer{ From a3282d192374c475da026dff0081ad32e1f12f7a Mon Sep 17 00:00:00 2001 From: bartkrak Date: Thu, 14 Dec 2023 17:50:23 +0100 Subject: [PATCH 03/39] encoder works, custom test data --- lib/membrane_opus/encoder.ex | 13 ++++++++++++- lib/membrane_opus/parser.ex | 2 +- test/fixtures/raw_packets | 3 +-- test/membrane_opus/encoder_test.exs | 19 ++++++++++++++++--- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/lib/membrane_opus/encoder.ex b/lib/membrane_opus/encoder.ex index 99debee..ab1f3f7 100644 --- a/lib/membrane_opus/encoder.ex +++ b/lib/membrane_opus/encoder.ex @@ -134,7 +134,16 @@ defmodule Membrane.Opus.Encoder do @impl true def handle_buffer(:input, %Buffer{payload: data, pts: pts}, _ctx, state) do - case encode_buffer(state.queue <> data, %{state | pts: pts}, frame_size_in_bytes(state)) do + # IO.inspect(state.pts, label: "handle_buffer state.pts") + # IO.inspect(pts, label: "handle_buffer pts") + pepare_state = fn state, pts -> + if state.pts == nil do + %{state | pts: pts} + else + state + end + end + case encode_buffer(state.queue <> data, pepare_state.(state, pts), frame_size_in_bytes(state)) do {:ok, {[], rest}, new_state} -> # nothing was encoded {[], %{state | queue: rest, pts: new_state.pts}} @@ -142,6 +151,7 @@ defmodule Membrane.Opus.Encoder do {:ok, {encoded_buffers, rest}, new_state} -> # something was encoded IO.inspect(encoded_buffers, label: "encoded_buffers") + # IO.inspect(new_state.pts, label: "new_state.pts") {[buffer: {:output, encoded_buffers}], %{state | queue: rest, pts: new_state.pts }} end end @@ -227,6 +237,7 @@ defmodule Membrane.Opus.Encoder do end defp update_state_pts(state, raw_frame) do + # IO.inspect(state.pts, label: "state.pts") if state.pts == nil do state else diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index 491e3de..bd4a630 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -63,7 +63,7 @@ defmodule Membrane.Opus.Parser do options |> Map.from_struct() |> Map.merge(%{ - pts: 0, + pts: 0, # if generate_best_effort_timestamps pts = nil (jak to zapisac?) buffer: <<>> }) diff --git a/test/fixtures/raw_packets b/test/fixtures/raw_packets index 5012c12..70892d6 100644 --- a/test/fixtures/raw_packets +++ b/test/fixtures/raw_packets @@ -1,3 +1,2 @@ -000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFF00000000000001000000FEFFFFFFF7FFFDFFF4FFFCFFF5FFFCFFF7FFFCFFF7FFFCFFF6FFFCFFF5FFFCFFF5FFFCFFF6FFFDFFF6FFFDFFF5FFFDFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFDFFF5FFFDFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF5FFFCFFF6FFFCFFF7FFFDFFF7FFFDFFF6FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF7FFFDFFF6FFFDFFF5FFFCFFF6FFFCFFF6FFFCFFF6FFFCFFF5FFFCFFF5FFFDFFF5FFFDFFF6FFFDFFF6FFFCFFF6FFFCFFF7FFFCFFF6FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF8FFFCFFF8FFFCFFF6FFFCFFF5FFFCFFF5FFFCFFF5FFFDFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF6FFFCFFF6FFFCFFF5FFFCFFF6FFFCFFF7FFFDFFF7FFFDFFF7FFFCFFF6FFFCFFF7FFFCFFF6FFFCFFF6FFFCFFF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7FFFDFFF7FFFDFFF7FFFCFFF7FFFCFFF7FFFCFFF7FFFCFFF7FFFCFFF7FFFDFFF8FFFEFFF9FFFEFFF8FFFEFFF7FFFDFFF7FFFDFFF7FFFDFFF7FFFCFFF7FFFCFFF7FFFCFFF7FFFCFFF7FFFCFFF8FFFDFFF8FFFDFFF9FFFCFFF8FFFDFFF7FFFDFFF7FFFDFFF7FFFEFFF7FFFCFFF7FFFCFFF8FFFEFFFAFFFEFFF9FFFDFFF9FFFCFFF9FFFDFFF9FFFEFFF9FFFDFFF8FFFDFFF7FFFDFFF8FFFDFFF8FFFDFFF8FFFCFFF8FFFCFFF7FFFDFFF7FFFCFFF8FFFDFFF8FFFDFFF8FFFDFFF8FFFDFFF8FFFDFFF8FFFCFFF8FFFCFFF8FFFDFFF8FFFDFF +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFF00000000000001000000FEFFFFFFF7FFFDFFF4FFFCFFF5FFFCFFF7FFFCFFF7FFFCFFF6FFFCFFF5FFFCFFF5FFFCFFF6FFFDFFF6FFFDFFF5FFFDFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFDFFF5FFFDFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFF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FFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFF0000FDFF0000FDFF0000FDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFF0000FEFF0000FEFFFFFFFDFFFFFFFCFF0000FDFF0000FEFF0000FDFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFF0000 diff --git a/test/membrane_opus/encoder_test.exs b/test/membrane_opus/encoder_test.exs index dc96d09..3790f55 100644 --- a/test/membrane_opus/encoder_test.exs +++ b/test/membrane_opus/encoder_test.exs @@ -11,9 +11,21 @@ defmodule Membrane.Opus.Encoder.EncoderTest do @input_path "test/fixtures/raw_packets" @reference_path "test/fixtures/encoder_output_reference" + defp raw_packets() do + File.read!(@input_path) + |> String.split() + |> Enum.zip(0..2) + |> Enum.map(fn {payload, index} -> + %Membrane.Buffer{payload: payload, pts: index * 20000000} + # %Membrane.Buffer{payload: payload, pts: nil} + + end) + end + defp setup_pipeline(output_path) do on_exit(fn -> File.rm(output_path) end) + spec = [ child(:source, %Membrane.File.Source{ location: @input_path @@ -51,9 +63,10 @@ defmodule Membrane.Opus.Encoder.EncoderTest do @tag :a test "encoder works with stream format received on :input pad" do spec = [ - child(:source, %Membrane.File.Source{ - location: @input_path - }) + # child(:source, %Membrane.File.Source{ + # location: @input_path + # }) + child(:source, %Membrane.Testing.Source{output: raw_packets()}) |> child(:parser, %Membrane.RawAudioParser{ stream_format: %Membrane.RawAudio{channels: 2, sample_format: :s16le, sample_rate: 48_000} }) From 46c9c78072bc50f7e3a8d5dbea057e8878282389 Mon Sep 17 00:00:00 2001 From: bartkrak Date: Fri, 15 Dec 2023 12:01:15 +0100 Subject: [PATCH 04/39] backup --- lib/membrane_opus/encoder.ex | 3 +-- test/membrane_opus/encoder_test.exs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/membrane_opus/encoder.ex b/lib/membrane_opus/encoder.ex index ab1f3f7..0e0c15b 100644 --- a/lib/membrane_opus/encoder.ex +++ b/lib/membrane_opus/encoder.ex @@ -135,7 +135,7 @@ defmodule Membrane.Opus.Encoder do @impl true def handle_buffer(:input, %Buffer{payload: data, pts: pts}, _ctx, state) do # IO.inspect(state.pts, label: "handle_buffer state.pts") - # IO.inspect(pts, label: "handle_buffer pts") + IO.inspect(pts, label: "handle_buffer pts") pepare_state = fn state, pts -> if state.pts == nil do %{state | pts: pts} @@ -151,7 +151,6 @@ defmodule Membrane.Opus.Encoder do {:ok, {encoded_buffers, rest}, new_state} -> # something was encoded IO.inspect(encoded_buffers, label: "encoded_buffers") - # IO.inspect(new_state.pts, label: "new_state.pts") {[buffer: {:output, encoded_buffers}], %{state | queue: rest, pts: new_state.pts }} end end diff --git a/test/membrane_opus/encoder_test.exs b/test/membrane_opus/encoder_test.exs index 3790f55..52a12ed 100644 --- a/test/membrane_opus/encoder_test.exs +++ b/test/membrane_opus/encoder_test.exs @@ -16,7 +16,7 @@ defmodule Membrane.Opus.Encoder.EncoderTest do |> String.split() |> Enum.zip(0..2) |> Enum.map(fn {payload, index} -> - %Membrane.Buffer{payload: payload, pts: index * 20000000} + %Membrane.Buffer{payload: payload, pts: index } # %Membrane.Buffer{payload: payload, pts: nil} end) From 0b1650793d8495001ef2a9f7e0f999967e2408a0 Mon Sep 17 00:00:00 2001 From: bartkrak Date: Fri, 15 Dec 2023 15:11:16 +0100 Subject: [PATCH 05/39] parser seems to work --- lib/membrane_opus/encoder.ex | 4 +-- lib/membrane_opus/parser.ex | 43 ++++++++++++++++------------- test/fixtures/raw_packets | 4 ++- test/fixtures/raw_packets_long | 2 ++ test/membrane_opus/encoder_test.exs | 2 +- test/membrane_opus/parser_test.exs | 15 ++-------- 6 files changed, 35 insertions(+), 35 deletions(-) create mode 100644 test/fixtures/raw_packets_long diff --git a/lib/membrane_opus/encoder.ex b/lib/membrane_opus/encoder.ex index 0e0c15b..b59c6ae 100644 --- a/lib/membrane_opus/encoder.ex +++ b/lib/membrane_opus/encoder.ex @@ -135,7 +135,7 @@ defmodule Membrane.Opus.Encoder do @impl true def handle_buffer(:input, %Buffer{payload: data, pts: pts}, _ctx, state) do # IO.inspect(state.pts, label: "handle_buffer state.pts") - IO.inspect(pts, label: "handle_buffer pts") + # IO.inspect(pts, label: "handle_buffer pts") pepare_state = fn state, pts -> if state.pts == nil do %{state | pts: pts} @@ -214,7 +214,7 @@ defmodule Membrane.Opus.Encoder do defp encode_buffer(raw_buffer, state, target_byte_size, encoded_frames) when byte_size(raw_buffer) >= target_byte_size do # Encode a single frame because buffer contains at least one frame - + # IO.puts("encode_buffer") <> = raw_buffer {:ok, raw_encoded} = Native.encode_packet(state.native, raw_frame, frame_size(state)) diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index bd4a630..fc35c6d 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -63,7 +63,6 @@ defmodule Membrane.Opus.Parser do options |> Map.from_struct() |> Map.merge(%{ - pts: 0, # if generate_best_effort_timestamps pts = nil (jak to zapisac?) buffer: <<>> }) @@ -77,13 +76,14 @@ defmodule Membrane.Opus.Parser do end @impl true - def handle_buffer(:input, %Buffer{payload: data}, ctx, state) do + def handle_buffer(:input, %Buffer{payload: data, pts: pts}, ctx, state) do {delimitation_processor, self_delimiting?} = Delimitation.get_processor(state.delimitation, state.input_delimitted?) - + IO.inspect(pts, label: "pts in") + IO.inspect(state.generate_best_effort_timestamps, label: "generate_best_effort_timestamps") case maybe_parse( state.buffer <> data, - state.pts, + if pts == nil && state.generate_best_effort_timestamps do 0 else pts end, state.input_delimitted?, delimitation_processor, state.generate_best_effort_timestamps @@ -108,7 +108,7 @@ defmodule Membrane.Opus.Parser do [] end - {packet_actions, %{state | buffer: buffer, pts: pts}} + {packet_actions, %{state | buffer: buffer}} :error -> {{:error, "An error occured in parsing"}, state} @@ -164,24 +164,11 @@ defmodule Membrane.Opus.Parser do duration: duration } } - - IO.inspect(pts, label: "pts in") - IO.inspect(rest, label: "rest") IO.inspect(packet, label: "packet") - generate_pts = fn pts, duration, generate_best_effort_timestamps -> - IO.inspect(generate_best_effort_timestamps, label: "generate_best_effort_timestamps") - - if generate_best_effort_timestamps do - pts + duration - else - pts + duration - end - end - maybe_parse( rest, - generate_pts.(pts, duration, generate_best_effort_timestamps), + calculate_pts(pts,duration,generate_best_effort_timestamps), input_delimitted?, processor, generate_best_effort_timestamps, @@ -209,6 +196,24 @@ defmodule Membrane.Opus.Parser do {:ok, data, pts, packets |> Enum.reverse(), channels} end + defp calculate_pts(pts, duration, generate_best_effort_timestamps) do + if generate_best_effort_timestamps do + # generowac nawet jak na wejsciu nil, zaczynac od zera + if pts == nil do + 0 + else + pts + duration + end + else + # dzialac tak jak encoder, jak jest nil to przepisac na wyjscie + if pts == nil do + nil + else + pts + duration + end + end + end + @spec rest_of_packet(data :: binary, expected_packet_size :: pos_integer) :: {:ok, raw_packet :: binary, rest :: binary} | {:error, :cont} defp rest_of_packet(data, expected_packet_size) do diff --git a/test/fixtures/raw_packets b/test/fixtures/raw_packets index 70892d6..4b3fc1e 100644 --- a/test/fixtures/raw_packets +++ b/test/fixtures/raw_packets @@ -1,2 +1,4 @@ -000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFF00000000000001000000FEFFFFFFF7FFFDFFF4FFFCFFF5FFFCFFF7FFFCFFF7FFFCFFF6FFFCFFF5FFFCFFF5FFFCFFF6FFFDFFF6FFFDFF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F8FFFDFFF8FFFDFFF8FFFCFFF8FFFCFFF8FFFDFFF8FFFDFF +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFF00000000000001000000FEFFFFFFF7FFFDFFF4FFFCFFF5FFFCFFF7FFFCFFF7FFFCFFF6FFFCFFF5FFFCFFF5FFFCFFF6FFFDFFF6FFFDFFF5FFFDFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFDFFF5FFFDFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF5FFFCFFF6FFFCFFF7FFFDFFF7FFFDFFF6FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF7FFFDFFF6FFFDFFF5FFFCFFF6FFFCFFF6FFFCFFF6FFFCFFF5FFFCFFF5FFFDFFF5FFFDFFF6FFFDFFF6FFFCFFF6FFFCFFF7FFFCFFF6FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF8FFFCFFF8FFFCFFF6FFFCFFF5FFFCFFF5FFFCFFF5FFFDFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF6FFFCFFF6FFFCFF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FDFFFEFFFDFFFFFFFCFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFCFFFFFFFCFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFF0000FDFF0000FDFFFFFFFDFF0000FDFFFFFFFDFFFFFFFDFF0000FCFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFF0000FCFF0000FCFF0000FDFF0000FDFF0000FDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFFFFFFFFFFFF0000FFFF0000FFFF0000FEFF0000FEFFFFFFFEFFFFFFFDFFFFFFFCFFFFFFFDFFFFFFFEFFFFFFFDFFFFFFFDFFFFFFFCFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFEFF0000FEFF0000FDFF0000FDFF0000FCFFFFFFFDFFFFFFFEFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFFFFFFFEFF0000FEFF0000FDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFF0000FDFF0000FDFF0000FDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFF0000FEFF0000FEFFFFFFFDFFFFFFFCFF0000FDFF0000FEFF0000FDFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFF0000 diff --git a/test/fixtures/raw_packets_long b/test/fixtures/raw_packets_long new file mode 100644 index 0000000..076bd89 --- /dev/null +++ b/test/fixtures/raw_packets_long @@ -0,0 +1,2 @@ +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFF00000000000001000000FEFFFFFFF7FFFDFFF4FFFCFFF5FFFCFFF7FFFCFFF7FFFCFFF6FFFCFFF5FFFCFFF5FFFCFFF6FFFDFFF6FFFDFFF5FFFDFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFDFFF5FFFDFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF5FFFCFFF6FFFCFFF7FFFDFFF7FFFDFFF6FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF7FFFDFFF6FFFDFFF5FFFCFFF6FFFCFFF6FFFCFFF6FFFCFFF5FFFCFFF5FFFDFFF5FFFDFFF6FFFDFFF6FFFCFFF6FFFCFFF7FFFCFFF6FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF8FFFCFFF8FFFCFFF6FFFCFFF5FFFCFFF5FFFCFFF5FFFDFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF6FFFCFFF6FFFCFFF5FFFCFFF6FFFCFFF7FFFDFFF7FFFDFFF7FFFCFFF6FFFCFFF7FFFCFFF6FFFCFFF6FFFCFFF6FFFCFFF7FFFCFFF6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FFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFF0000FDFF0000FDFFFFFFFDFF0000FDFFFFFFFDFFFFFFFDFF0000FCFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFF0000FCFF0000FCFF0000FDFF0000FDFF0000FDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFFFFFFFFFFFF0000FFFF0000FFFF0000FEFF0000FEFFFFFFFEFFFFFFFDFFFFFFFCFFFFFFFDFFFFFFFEFFFFFFFDFFFFFFFDFFFFFFFCFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFEFF0000FEFF0000FDFF0000FDFF0000FCFFFFFFFDFFFFFFFEFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFFFFFFFEFF0000FEFF0000FDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFF0000FDFF0000FDFF0000FDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFF0000FEFF0000FEFFFFFFFDFFFFFFFCFF0000FDFF0000FEFF0000FDFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFF0000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFF00000000000001000000FEFFFFFFF7FFFDFFF4FFFCFFF5FFFCFFF7FFFCFFF7FFFCFFF6FFFCFFF5FFFCFFF5FFFCFFF6FFFDFFF6FFFDFFF5FFFDFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFDFFF5FFFDFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF5FFFCFFF6FFFCFFF7FFFDFFF7FFFDFFF6FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF7FFFDFFF6FFFDFFF5FFFCFFF6FFFCFFF6FFFCFFF6FFFCFFF5FFFCFFF5FFFDFFF5FFFDFFF6FFFDFFF6FFFCFFF6FFFCFFF7FFFCFFF6FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF8FFFCFFF8FFFCFFF6FFFCFFF5FFFCFFF5FFFCFFF5FFFDFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF6FFFCFFF6FFFCFFF5FFFCFFF6FFFCFFF7FFFDFFF7FFFDFFF7FFFCFFF6FFFCFFF7FFFCFFF6FFFCFFF6FFFCFFF6FFFCFFF7FFFCFFF6FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF7FFFCFFF6FFFCFFF7FFFCFFF6FFFDFFF7FFFDFFF6FFFCFFF5FFFCFFF6FFFCFFF7FFFCFFF7FFFCFFF7FFFCFFF6FFFCFFF6FFFCFFF7FFFCFFF7FFFCFFF6FFFCFFF7FFFCFFF9FFF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FFDFFFFFFFEFFFFFFFFFFFFFFFFFF0000FFFF0000FFFF0000FEFF0000FEFFFFFFFEFFFFFFFDFFFFFFFCFFFFFFFDFFFFFFFEFFFFFFFDFFFFFFFDFFFFFFFCFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFEFF0000FEFF0000FDFF0000FDFF0000FCFFFFFFFDFFFFFFFEFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFFFFFFFEFF0000FEFF0000FDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFF0000FDFF0000FDFF0000FDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFF0000FEFF0000FEFFFFFFFDFFFFFFFCFF0000FDFF0000FEFF0000FDFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFF0000 diff --git a/test/membrane_opus/encoder_test.exs b/test/membrane_opus/encoder_test.exs index 52a12ed..ef58c5f 100644 --- a/test/membrane_opus/encoder_test.exs +++ b/test/membrane_opus/encoder_test.exs @@ -16,7 +16,7 @@ defmodule Membrane.Opus.Encoder.EncoderTest do |> String.split() |> Enum.zip(0..2) |> Enum.map(fn {payload, index} -> - %Membrane.Buffer{payload: payload, pts: index } + %Membrane.Buffer{payload: payload, pts: nil } # %Membrane.Buffer{payload: payload, pts: nil} end) diff --git a/test/membrane_opus/parser_test.exs b/test/membrane_opus/parser_test.exs index aada0d4..837013c 100644 --- a/test/membrane_opus/parser_test.exs +++ b/test/membrane_opus/parser_test.exs @@ -18,7 +18,6 @@ defmodule Membrane.Opus.Parser.ParserTest do # channels: 2, # duration: 0, # pts: 0, - # generate_best_effort_timestamps: true # }, # %{ # desc: "code 1", @@ -27,7 +26,6 @@ defmodule Membrane.Opus.Parser.ParserTest do # channels: 1, # duration: 40 |> milliseconds(), # pts: 0, - # generate_best_effort_timestamps: true # }, # original # %{ @@ -37,7 +35,6 @@ defmodule Membrane.Opus.Parser.ParserTest do # channels: 2, # duration: 15 |> milliseconds(), # pts: 0 |> milliseconds(), - # generate_best_effort_timestamps: true # }, # 3x longer %{ @@ -46,8 +43,7 @@ defmodule Membrane.Opus.Parser.ParserTest do delimited: <<198, 1, 3, 0, 0, 0, 0, 198, 1, 3, 0, 0, 0, 0, 198, 1, 3, 0, 0, 0, 0>>, channels: 2, duration: 15 |> milliseconds(), - pts: 0 |> milliseconds(), - generate_best_effort_timestamps: true + pts: 60 |> milliseconds(), } # %{ # desc: "code 3 cbr, no padding", @@ -56,7 +52,6 @@ defmodule Membrane.Opus.Parser.ParserTest do # channels: 2, # duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), # pts: 45 |> milliseconds(), - # generate_best_effort_timestamps: true # }, # %{ # desc: "code 3 cbr, padding", @@ -65,7 +60,6 @@ defmodule Membrane.Opus.Parser.ParserTest do # channels: 2, # duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), # pts: (52.5 * 1_000_000) |> trunc() |> nanoseconds(), - # generate_best_effort_timestamps: true # }, # %{ # desc: "code 3 vbr, no padding", @@ -74,7 +68,6 @@ defmodule Membrane.Opus.Parser.ParserTest do # channels: 2, # duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), # pts: 60 |> milliseconds(), - # generate_best_effort_timestamps: true # }, # %{ # desc: "code 3 vbr, no padding, long length", @@ -103,7 +96,6 @@ defmodule Membrane.Opus.Parser.ParserTest do # channels: 2, # duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), # pts: (67.5 * 1_000_000) |> trunc() |> nanoseconds(), - # generate_best_effort_timestamps: true # } ] test "non-self-delimiting input and output" do @@ -177,11 +169,10 @@ defmodule Membrane.Opus.Parser.ParserTest do test "self-delimiting input, multiple self-delimiting outputs" do inputs = @fixtures - |> Enum.map(fn fixture -> fixture.delimited end) - + |> Enum.map(fn fixture -> %Membrane.Buffer{payload: fixture.delimited, pts: fixture.pts } end) spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) - |> child(:parser, %Parser{input_delimitted?: true, generate_best_effort_timestamps: true}) + |> child(:parser, %Parser{input_delimitted?: true, generate_best_effort_timestamps: false}) |> child(:sink, Sink) ] From 2d9455cc149dafb4fdabfe07d46cc5ec32fca80f Mon Sep 17 00:00:00 2001 From: bartkrak Date: Fri, 15 Dec 2023 16:07:04 +0100 Subject: [PATCH 06/39] parser tests fail --- lib/membrane_opus/decoder.ex | 4 - lib/membrane_opus/encoder.ex | 4 +- lib/membrane_opus/parser.ex | 23 +++-- test/fixtures/raw_packets | 3 +- test/membrane_opus/encoder_test.exs | 4 +- test/membrane_opus/parser_test.exs | 155 +++++++++++++--------------- 6 files changed, 93 insertions(+), 100 deletions(-) diff --git a/lib/membrane_opus/decoder.ex b/lib/membrane_opus/decoder.ex index 6d199d7..847b6cc 100644 --- a/lib/membrane_opus/decoder.ex +++ b/lib/membrane_opus/decoder.ex @@ -53,9 +53,6 @@ defmodule Membrane.Opus.Decoder do @impl true def handle_buffer(:input, buffer, _ctx, state) do - IO.inspect(buffer, label: "buffer in") - buffer = %Buffer{buffer | pts: 2} - if buffer.payload === "" do Membrane.Logger.warning("Payload is empty.") {[], state} @@ -66,7 +63,6 @@ defmodule Membrane.Opus.Decoder do decoded = Native.decode_packet(state.native, buffer.payload) buffer = %Buffer{buffer | payload: decoded} - IO.inspect(buffer, label: "buffer out") {stream_format ++ [buffer: {:output, buffer}], state} end end diff --git a/lib/membrane_opus/encoder.ex b/lib/membrane_opus/encoder.ex index b59c6ae..652c040 100644 --- a/lib/membrane_opus/encoder.ex +++ b/lib/membrane_opus/encoder.ex @@ -143,6 +143,7 @@ defmodule Membrane.Opus.Encoder do state end end + case encode_buffer(state.queue <> data, pepare_state.(state, pts), frame_size_in_bytes(state)) do {:ok, {[], rest}, new_state} -> # nothing was encoded @@ -151,7 +152,7 @@ defmodule Membrane.Opus.Encoder do {:ok, {encoded_buffers, rest}, new_state} -> # something was encoded IO.inspect(encoded_buffers, label: "encoded_buffers") - {[buffer: {:output, encoded_buffers}], %{state | queue: rest, pts: new_state.pts }} + {[buffer: {:output, encoded_buffers}], %{state | queue: rest, pts: new_state.pts}} end end @@ -244,6 +245,7 @@ defmodule Membrane.Opus.Encoder do raw_frame |> byte_size() |> RawAudio.bytes_to_time(state.input_stream_format) + %{state | pts: state.pts + duration} end end diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index fc35c6d..1aa8a66 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -79,16 +79,22 @@ defmodule Membrane.Opus.Parser do def handle_buffer(:input, %Buffer{payload: data, pts: pts}, ctx, state) do {delimitation_processor, self_delimiting?} = Delimitation.get_processor(state.delimitation, state.input_delimitted?) - IO.inspect(pts, label: "pts in") - IO.inspect(state.generate_best_effort_timestamps, label: "generate_best_effort_timestamps") + + IO.inspect(pts, label: "pts in") + IO.inspect(state.generate_best_effort_timestamps, label: "generate_best_effort_timestamps") + case maybe_parse( state.buffer <> data, - if pts == nil && state.generate_best_effort_timestamps do 0 else pts end, + if pts == nil && state.generate_best_effort_timestamps do + 0 + else + pts + end, state.input_delimitted?, delimitation_processor, state.generate_best_effort_timestamps ) do - {:ok, buffer, pts, packets, channels} -> + {:ok, buffer, packets, channels} -> stream_format = %Opus{ self_delimiting?: self_delimiting?, channels: channels @@ -164,11 +170,12 @@ defmodule Membrane.Opus.Parser do duration: duration } } + IO.inspect(packet, label: "packet") maybe_parse( rest, - calculate_pts(pts,duration,generate_best_effort_timestamps), + calculate_pts(pts, duration, generate_best_effort_timestamps), input_delimitted?, processor, generate_best_effort_timestamps, @@ -177,7 +184,7 @@ defmodule Membrane.Opus.Parser do ) else {:error, :cont} -> - {:ok, data, pts, packets |> Enum.reverse(), channels} + {:ok, data, packets |> Enum.reverse(), channels} :error -> :error @@ -186,14 +193,14 @@ defmodule Membrane.Opus.Parser do defp maybe_parse( data, - pts, + _pts, _input_delimitted?, _processor, _generate_best_effort_timestamps, packets, channels ) do - {:ok, data, pts, packets |> Enum.reverse(), channels} + {:ok, data, packets |> Enum.reverse(), channels} end defp calculate_pts(pts, duration, generate_best_effort_timestamps) do diff --git a/test/fixtures/raw_packets b/test/fixtures/raw_packets index 4b3fc1e..5012c12 100644 --- a/test/fixtures/raw_packets +++ b/test/fixtures/raw_packets @@ -1,4 +1,3 @@ -000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFF00000000000001000000FEFFFFFFF7FFFDFFF4FFFCFFF5FFFCFFF7FFFCFFF7FFFCFFF6FFFCFFF5FFFCFFF5FFFCFFF6FFFDFFF6FFFDFFF5FFFDFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFDFFF5FFFDFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF5FFFCFFF6FFFCFFF7FFFDFFF7FFFDFFF6FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF7FFFDFFF6FFFDFFF5FFFCFFF6FFFCFFF6FFFCFFF6FFFCFFF5FFFCFFF5FFFDFFF5FFFDFFF6FFFDFFF6FFFCFFF6FFFCFFF7FFFCFFF6FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF8FFFCFFF8FFFCFFF6FFFCFFF5FFFCFFF5FFFCFFF5FFFDFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF6FFFCFFF6FFFCFFF5FFFCFFF6FFFCFFF7FFFDFFF7FFFDFFF7FFFCFFF6FFFCFFF7FFFCFFF6FFFCFFF6FFFCFFF6FFFCFFF7FFFCFFF6FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF7FFFCFFF6FFFCFFF7FFFCFFF6FFFDFFF7FFFDFFF6FFFCFFF5FFFCFFF6FFFCFFF7FF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0000FCFF0000FCFF0000FDFF0000FDFF0000FDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFFFFFFFFFFFF0000FFFF0000FFFF0000FEFF0000FEFFFFFFFEFFFFFFFDFFFFFFFCFFFFFFFDFFFFFFFEFFFFFFFDFFFFFFFDFFFFFFFCFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFEFF0000FEFF0000FDFF0000FDFF0000FCFFFFFFFDFFFFFFFEFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFFFFFFFEFF0000FEFF0000FDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFF0000FDFF0000FDFF0000FDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFF0000FEFF0000FEFFFFFFFDFFFFFFFCFF0000FDFF0000FEFF0000FDFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFF0000 diff --git a/test/membrane_opus/encoder_test.exs b/test/membrane_opus/encoder_test.exs index ef58c5f..5ed6a6c 100644 --- a/test/membrane_opus/encoder_test.exs +++ b/test/membrane_opus/encoder_test.exs @@ -16,16 +16,14 @@ defmodule Membrane.Opus.Encoder.EncoderTest do |> String.split() |> Enum.zip(0..2) |> Enum.map(fn {payload, index} -> - %Membrane.Buffer{payload: payload, pts: nil } + %Membrane.Buffer{payload: payload, pts: nil} # %Membrane.Buffer{payload: payload, pts: nil} - end) end defp setup_pipeline(output_path) do on_exit(fn -> File.rm(output_path) end) - spec = [ child(:source, %Membrane.File.Source{ location: @input_path diff --git a/test/membrane_opus/parser_test.exs b/test/membrane_opus/parser_test.exs index 837013c..fdca02c 100644 --- a/test/membrane_opus/parser_test.exs +++ b/test/membrane_opus/parser_test.exs @@ -11,92 +11,82 @@ defmodule Membrane.Opus.Parser.ParserTest do alias Membrane.Testing.{Pipeline, Sink, Source} @fixtures [ - # %{ - # desc: "dropped packet, code 0", - # normal: <<4>>, - # delimited: <<4, 0>>, - # channels: 2, - # duration: 0, - # pts: 0, - # }, - # %{ - # desc: "code 1", - # normal: <<121, 0, 0, 0, 0>>, - # delimited: <<121, 2, 0, 0, 0, 0>>, - # channels: 1, - # duration: 40 |> milliseconds(), - # pts: 0, - # }, - # original - # %{ - # desc: "code 2", - # normal: <<198, 1, 0, 0, 0, 0>>, - # delimited: <<198, 1, 3, 0, 0, 0, 0>>, - # channels: 2, - # duration: 15 |> milliseconds(), - # pts: 0 |> milliseconds(), - # }, - # 3x longer + %{ + desc: "dropped packet, code 0", + normal: <<4>>, + delimited: <<4, 0>>, + channels: 2, + duration: 0, + pts: 0 + }, + %{ + desc: "code 1", + normal: <<121, 0, 0, 0, 0>>, + delimited: <<121, 2, 0, 0, 0, 0>>, + channels: 1, + duration: 40 |> milliseconds(), + pts: 0 + }, %{ desc: "code 2", normal: <<198, 1, 0, 0, 0, 0>>, - delimited: <<198, 1, 3, 0, 0, 0, 0, 198, 1, 3, 0, 0, 0, 0, 198, 1, 3, 0, 0, 0, 0>>, + delimited: <<198, 1, 3, 0, 0, 0, 0>>, + channels: 2, + duration: 5 |> milliseconds(), + pts: 40 |> milliseconds() + }, + %{ + desc: "code 3 cbr, no padding", + normal: <<199, 3, 0, 0, 0>>, + delimited: <<199, 3, 1, 0, 0, 0>>, + channels: 2, + duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), + pts: 45 |> milliseconds() + }, + %{ + desc: "code 3 cbr, padding", + normal: <<199, 67, 2, 0, 0, 0, 0, 0>>, + delimited: <<199, 67, 2, 1, 0, 0, 0, 0, 0>>, + channels: 2, + duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), + pts: (52.5 * 1_000_000) |> trunc() |> nanoseconds() + }, + %{ + desc: "code 3 vbr, no padding", + normal: <<199, 131, 1, 2, 0, 0, 0, 0>>, + delimited: <<199, 131, 1, 2, 1, 0, 0, 0, 0>>, channels: 2, - duration: 15 |> milliseconds(), - pts: 60 |> milliseconds(), + duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), + pts: 60 |> milliseconds() + }, + %{ + desc: "code 3 vbr, no padding, long length", + normal: + <<199, 131, 253, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, + 0, 3, 3, 3>>, + delimited: + <<199, 131, 253, 0, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 3, 3, 3>>, + channels: 2, + duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), + pts: (67.5 * 1_000_000) |> trunc() |> nanoseconds() } - # %{ - # desc: "code 3 cbr, no padding", - # normal: <<199, 3, 0, 0, 0>>, - # delimited: <<199, 3, 1, 0, 0, 0>>, - # channels: 2, - # duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), - # pts: 45 |> milliseconds(), - # }, - # %{ - # desc: "code 3 cbr, padding", - # normal: <<199, 67, 2, 0, 0, 0, 0, 0>>, - # delimited: <<199, 67, 2, 1, 0, 0, 0, 0, 0>>, - # channels: 2, - # duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), - # pts: (52.5 * 1_000_000) |> trunc() |> nanoseconds(), - # }, - # %{ - # desc: "code 3 vbr, no padding", - # normal: <<199, 131, 1, 2, 0, 0, 0, 0>>, - # delimited: <<199, 131, 1, 2, 1, 0, 0, 0, 0>>, - # channels: 2, - # duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), - # pts: 60 |> milliseconds(), - # }, - # %{ - # desc: "code 3 vbr, no padding, long length", - # normal: - # <<199, 131, 253, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - # 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - # 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - # 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - # 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - # 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - # 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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- # channels: 2, - # duration: (2.5 * 3 * 1_000_000) |> trunc() |> nanoseconds(), - # pts: (67.5 * 1_000_000) |> trunc() |> nanoseconds(), - # } ] test "non-self-delimiting input and output" do inputs = @@ -169,7 +159,8 @@ defmodule Membrane.Opus.Parser.ParserTest do test "self-delimiting input, multiple self-delimiting outputs" do inputs = @fixtures - |> Enum.map(fn fixture -> %Membrane.Buffer{payload: fixture.delimited, pts: fixture.pts } end) + |> Enum.map(fn fixture -> %Membrane.Buffer{payload: fixture.delimited, pts: fixture.pts} end) + spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) |> child(:parser, %Parser{input_delimitted?: true, generate_best_effort_timestamps: false}) From 16d53025a1ecad5eaf5e0ccfe5fc2c631345d3a5 Mon Sep 17 00:00:00 2001 From: bartkrak Date: Tue, 19 Dec 2023 08:48:09 +0100 Subject: [PATCH 07/39] parser modified backup --- lib/membrane_opus/parser.ex | 16 ++++++------- test/membrane_opus/encoder_test.exs | 1 - test/membrane_opus/parser_test.exs | 36 +++++++++-------------------- 3 files changed, 18 insertions(+), 35 deletions(-) diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index 1aa8a66..6729c33 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -45,7 +45,7 @@ defmodule Membrane.Opus.Parser do ], generate_best_effort_timestamps: [ spec: boolean(), - default: false, + default: true, description: """ generate_best_effort_timestamps - missing description """ @@ -80,9 +80,6 @@ defmodule Membrane.Opus.Parser do {delimitation_processor, self_delimiting?} = Delimitation.get_processor(state.delimitation, state.input_delimitted?) - IO.inspect(pts, label: "pts in") - IO.inspect(state.generate_best_effort_timestamps, label: "generate_best_effort_timestamps") - case maybe_parse( state.buffer <> data, if pts == nil && state.generate_best_effort_timestamps do @@ -99,7 +96,6 @@ defmodule Membrane.Opus.Parser do self_delimiting?: self_delimiting?, channels: channels } - packets_len = length(packets) packet_actions = @@ -113,8 +109,9 @@ defmodule Membrane.Opus.Parser do true -> [] end + IO.inspect({packet_actions, %{state | buffer: buffer}}, label: "OUT") + - {packet_actions, %{state | buffer: buffer}} :error -> {{:error, "An error occured in parsing"}, state} @@ -158,11 +155,12 @@ defmodule Membrane.Opus.Parser do {:ok, _mode, _bandwidth, frame_duration} <- Util.parse_configuration(configuration_number), {:ok, header_size, frame_lengths, padding_size} <- - FrameLengths.parse(frame_packing, data, input_delimitted?), + FrameLengths.parse(frame_packing, data, input_delimitted?), expected_packet_size <- header_size + Enum.sum(frame_lengths) + padding_size, {:ok, raw_packet, rest} <- rest_of_packet(data, expected_packet_size) do - duration = elapsed_time(frame_lengths, frame_duration) + duration = elapsed_time(frame_lengths, frame_duration) + # IO.inspect(duration, label: "duration") packet = %Buffer{ pts: pts, payload: processor.process(raw_packet, frame_lengths, header_size), @@ -171,7 +169,7 @@ defmodule Membrane.Opus.Parser do } } - IO.inspect(packet, label: "packet") + # IO.inspect(packet, label: "packet") maybe_parse( rest, diff --git a/test/membrane_opus/encoder_test.exs b/test/membrane_opus/encoder_test.exs index 5ed6a6c..f098e23 100644 --- a/test/membrane_opus/encoder_test.exs +++ b/test/membrane_opus/encoder_test.exs @@ -17,7 +17,6 @@ defmodule Membrane.Opus.Encoder.EncoderTest do |> Enum.zip(0..2) |> Enum.map(fn {payload, index} -> %Membrane.Buffer{payload: payload, pts: nil} - # %Membrane.Buffer{payload: payload, pts: nil} end) end diff --git a/test/membrane_opus/parser_test.exs b/test/membrane_opus/parser_test.exs index fdca02c..070a19a 100644 --- a/test/membrane_opus/parser_test.exs +++ b/test/membrane_opus/parser_test.exs @@ -88,14 +88,15 @@ defmodule Membrane.Opus.Parser.ParserTest do pts: (67.5 * 1_000_000) |> trunc() |> nanoseconds() } ] + test "non-self-delimiting input and output" do inputs = @fixtures - |> Enum.map(fn fixture -> fixture.normal end) + |> Enum.map(fn fixture -> %Membrane.Buffer{payload: fixture.delimited, pts: fixture.pts} end) spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) - |> child(:parser, Parser) + |> child(:parser, %Parser{generate_best_effort_timestamps: false}) |> child(:sink, Sink) ] @@ -107,11 +108,11 @@ defmodule Membrane.Opus.Parser.ParserTest do test "non-self-delimiting input, self-delimiting output" do inputs = @fixtures - |> Enum.map(fn fixture -> fixture.normal end) + |> Enum.map(fn fixture -> %Membrane.Buffer{payload: fixture.delimited, pts: fixture.pts} end) spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) - |> child(:parser, %Parser{delimitation: :delimit, generate_best_effort_timestamps: true}) + |> child(:parser, %Parser{delimitation: :delimit, generate_best_effort_timestamps: false}) |> child(:sink, Sink) ] @@ -123,11 +124,11 @@ defmodule Membrane.Opus.Parser.ParserTest do test "self-delimiting input and output" do inputs = @fixtures - |> Enum.map(fn fixture -> fixture.delimited end) + |> Enum.map(fn fixture -> %Membrane.Buffer{payload: fixture.delimited, pts: fixture.pts} end) spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) - |> child(:parser, %Parser{input_delimitted?: true, generate_best_effort_timestamps: true}) + |> child(:parser, %Parser{input_delimitted?: true, generate_best_effort_timestamps: false}) |> child(:sink, Sink) ] @@ -139,14 +140,14 @@ defmodule Membrane.Opus.Parser.ParserTest do test "self-delimiting input, non-self-delimiting output" do inputs = @fixtures - |> Enum.map(fn fixture -> fixture.delimited end) + |> Enum.map(fn fixture -> %Membrane.Buffer{payload: fixture.delimited, pts: fixture.pts} end) spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) |> child(:parser, %Parser{ delimitation: :undelimit, input_delimitted?: true, - generate_best_effort_timestamps: true + generate_best_effort_timestamps: false }) |> child(:sink, Sink) ] @@ -156,22 +157,6 @@ defmodule Membrane.Opus.Parser.ParserTest do do_test(pipeline, false) end - test "self-delimiting input, multiple self-delimiting outputs" do - inputs = - @fixtures - |> Enum.map(fn fixture -> %Membrane.Buffer{payload: fixture.delimited, pts: fixture.pts} end) - - spec = [ - child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) - |> child(:parser, %Parser{input_delimitted?: true, generate_best_effort_timestamps: false}) - |> child(:sink, Sink) - ] - - pipeline = Pipeline.start_link_supervised!(spec: spec) - - do_test(pipeline, true) - end - defp do_test(pipeline, self_delimiting?) do assert_start_of_stream(pipeline, :sink) @@ -182,7 +167,8 @@ defmodule Membrane.Opus.Parser.ParserTest do payload: if(self_delimiting?, do: fixture.delimited, else: fixture.normal), metadata: %{duration: fixture.duration} } - + # Process.sleep(1000) + # Process.info(self(), :messages) |> IO.inspect(limit: :infinity) assert_sink_buffer(pipeline, :sink, ^expected_buffer, 4000) end) From eca9e8338440fab1d8646aabd719c1d11f8fbafb Mon Sep 17 00:00:00 2001 From: bartkrak Date: Tue, 19 Dec 2023 09:16:54 +0100 Subject: [PATCH 08/39] looks good --- lib/membrane_opus/parser.ex | 96 ++++++++++-------------------- test/membrane_opus/parser_test.exs | 23 +++---- 2 files changed, 39 insertions(+), 80 deletions(-) diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index 6729c33..560b36d 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -45,7 +45,7 @@ defmodule Membrane.Opus.Parser do ], generate_best_effort_timestamps: [ spec: boolean(), - default: true, + default: false, description: """ generate_best_effort_timestamps - missing description """ @@ -63,6 +63,7 @@ defmodule Membrane.Opus.Parser do options |> Map.from_struct() |> Map.merge(%{ + pts: 0, buffer: <<>> }) @@ -79,23 +80,26 @@ defmodule Membrane.Opus.Parser do def handle_buffer(:input, %Buffer{payload: data, pts: pts}, ctx, state) do {delimitation_processor, self_delimiting?} = Delimitation.get_processor(state.delimitation, state.input_delimitted?) + IO.inspect(pts, label: "PTS IN") + IO.inspect(state, label: "STATE IN") case maybe_parse( state.buffer <> data, - if pts == nil && state.generate_best_effort_timestamps do - 0 + if state.generate_best_effort_timestamps do + pts else - pts + state.pts end, state.input_delimitted?, delimitation_processor, state.generate_best_effort_timestamps ) do - {:ok, buffer, packets, channels} -> + {:ok, buffer, pts, packets, channels} -> stream_format = %Opus{ self_delimiting?: self_delimiting?, channels: channels } + packets_len = length(packets) packet_actions = @@ -109,9 +113,7 @@ defmodule Membrane.Opus.Parser do true -> [] end - IO.inspect({packet_actions, %{state | buffer: buffer}}, label: "OUT") - - + IO.inspect({packet_actions, %{state | buffer: buffer, pts: pts}}, label: "OUT") :error -> {{:error, "An error occured in parsing"}, state} @@ -123,44 +125,26 @@ defmodule Membrane.Opus.Parser do pts :: Membrane.Time.t(), input_delimitted? :: boolean, processor :: Delimitation.processor_t(), - generate_best_effort_timestamps :: boolean, packets :: [Buffer.t()], channels :: 0..2 ) :: {:ok, remaining_buffer :: binary, pts :: Membrane.Time.t(), packets :: [Buffer.t()], - channels :: 0..2} + channels :: 0..2, generate_best_effort_timestamps :: boolean()} | :error - defp maybe_parse( - data, - pts, - input_delimitted?, - processor, - generate_best_effort_timestamps, - packets \\ [], - channels \\ 0 - ) - - defp maybe_parse( - data, - pts, - input_delimitted?, - processor, - generate_best_effort_timestamps, - packets, - channels - ) + defp maybe_parse(data, pts, input_delimitted?, processor, packets \\ [], channels \\ 0, generate_best_effort_timestamps) + + defp maybe_parse(data, pts, input_delimitted?, processor, packets, channels, generate_best_effort_timestamps) when byte_size(data) > 0 do with {:ok, configuration_number, stereo_flag, frame_packing} <- Util.parse_toc_byte(data), channels <- max(channels, Util.parse_channels(stereo_flag)), {:ok, _mode, _bandwidth, frame_duration} <- Util.parse_configuration(configuration_number), {:ok, header_size, frame_lengths, padding_size} <- - FrameLengths.parse(frame_packing, data, input_delimitted?), + FrameLengths.parse(frame_packing, data, input_delimitted?), expected_packet_size <- header_size + Enum.sum(frame_lengths) + padding_size, {:ok, raw_packet, rest} <- rest_of_packet(data, expected_packet_size) do - duration = elapsed_time(frame_lengths, frame_duration) - # IO.inspect(duration, label: "duration") + packet = %Buffer{ pts: pts, payload: processor.process(raw_packet, frame_lengths, header_size), @@ -169,54 +153,34 @@ defmodule Membrane.Opus.Parser do } } - # IO.inspect(packet, label: "packet") - maybe_parse( rest, - calculate_pts(pts, duration, generate_best_effort_timestamps), + if generate_best_effort_timestamps do + pts + else + if pts == nil do + nil + else + pts + duration + end + end, input_delimitted?, processor, - generate_best_effort_timestamps, [packet | packets], - channels + channels, + generate_best_effort_timestamps ) else {:error, :cont} -> - {:ok, data, packets |> Enum.reverse(), channels} + {:ok, data, pts, packets |> Enum.reverse(), channels} :error -> :error end end - defp maybe_parse( - data, - _pts, - _input_delimitted?, - _processor, - _generate_best_effort_timestamps, - packets, - channels - ) do - {:ok, data, packets |> Enum.reverse(), channels} - end - - defp calculate_pts(pts, duration, generate_best_effort_timestamps) do - if generate_best_effort_timestamps do - # generowac nawet jak na wejsciu nil, zaczynac od zera - if pts == nil do - 0 - else - pts + duration - end - else - # dzialac tak jak encoder, jak jest nil to przepisac na wyjscie - if pts == nil do - nil - else - pts + duration - end - end + defp maybe_parse(data, pts, _input_delimitted?, _processor, packets, channels, _generate_best_effort_timestamps) do + {:ok, data, pts, packets |> Enum.reverse(), channels} end @spec rest_of_packet(data :: binary, expected_packet_size :: pos_integer) :: diff --git a/test/membrane_opus/parser_test.exs b/test/membrane_opus/parser_test.exs index 070a19a..1eca460 100644 --- a/test/membrane_opus/parser_test.exs +++ b/test/membrane_opus/parser_test.exs @@ -92,11 +92,11 @@ defmodule Membrane.Opus.Parser.ParserTest do test "non-self-delimiting input and output" do inputs = @fixtures - |> Enum.map(fn fixture -> %Membrane.Buffer{payload: fixture.delimited, pts: fixture.pts} end) + |> Enum.map(fn fixture -> fixture.normal end) spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) - |> child(:parser, %Parser{generate_best_effort_timestamps: false}) + |> child(:parser, Parser) |> child(:sink, Sink) ] @@ -108,11 +108,11 @@ defmodule Membrane.Opus.Parser.ParserTest do test "non-self-delimiting input, self-delimiting output" do inputs = @fixtures - |> Enum.map(fn fixture -> %Membrane.Buffer{payload: fixture.delimited, pts: fixture.pts} end) + |> Enum.map(fn fixture -> fixture.normal end) spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) - |> child(:parser, %Parser{delimitation: :delimit, generate_best_effort_timestamps: false}) + |> child(:parser, %Parser{delimitation: :delimit}) |> child(:sink, Sink) ] @@ -124,11 +124,11 @@ defmodule Membrane.Opus.Parser.ParserTest do test "self-delimiting input and output" do inputs = @fixtures - |> Enum.map(fn fixture -> %Membrane.Buffer{payload: fixture.delimited, pts: fixture.pts} end) + |> Enum.map(fn fixture -> fixture.delimited end) spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) - |> child(:parser, %Parser{input_delimitted?: true, generate_best_effort_timestamps: false}) + |> child(:parser, %Parser{input_delimitted?: true}) |> child(:sink, Sink) ] @@ -140,15 +140,11 @@ defmodule Membrane.Opus.Parser.ParserTest do test "self-delimiting input, non-self-delimiting output" do inputs = @fixtures - |> Enum.map(fn fixture -> %Membrane.Buffer{payload: fixture.delimited, pts: fixture.pts} end) + |> Enum.map(fn fixture -> fixture.delimited end) spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) - |> child(:parser, %Parser{ - delimitation: :undelimit, - input_delimitted?: true, - generate_best_effort_timestamps: false - }) + |> child(:parser, %Parser{delimitation: :undelimit, input_delimitted?: true}) |> child(:sink, Sink) ] @@ -167,8 +163,7 @@ defmodule Membrane.Opus.Parser.ParserTest do payload: if(self_delimiting?, do: fixture.delimited, else: fixture.normal), metadata: %{duration: fixture.duration} } - # Process.sleep(1000) - # Process.info(self(), :messages) |> IO.inspect(limit: :infinity) + assert_sink_buffer(pipeline, :sink, ^expected_buffer, 4000) end) From 26bb5fe7ae0821b97cc94be2249729b62b66b245 Mon Sep 17 00:00:00 2001 From: bartkrak Date: Tue, 19 Dec 2023 09:28:13 +0100 Subject: [PATCH 09/39] before merge --- lib/membrane_opus/parser.ex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index 560b36d..9cebdb3 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -45,7 +45,7 @@ defmodule Membrane.Opus.Parser do ], generate_best_effort_timestamps: [ spec: boolean(), - default: false, + default: true, description: """ generate_best_effort_timestamps - missing description """ @@ -152,18 +152,18 @@ defmodule Membrane.Opus.Parser do duration: duration } } - + IO.inspect(pts, label: "PTS MAYBE PARSE") maybe_parse( rest, if generate_best_effort_timestamps do pts - else + else if pts == nil do nil else pts + duration end - end, + end, input_delimitted?, processor, [packet | packets], From 2c6a94ea20a0729415632f8b786c9e351df2bc39 Mon Sep 17 00:00:00 2001 From: bartkrak Date: Tue, 19 Dec 2023 10:05:10 +0100 Subject: [PATCH 10/39] ready for review --- lib/membrane_opus/encoder.ex | 1 - lib/membrane_opus/parser.ex | 45 +++++++++++++++++++++++++++--------- 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/lib/membrane_opus/encoder.ex b/lib/membrane_opus/encoder.ex index 652c040..bd6230f 100644 --- a/lib/membrane_opus/encoder.ex +++ b/lib/membrane_opus/encoder.ex @@ -151,7 +151,6 @@ defmodule Membrane.Opus.Encoder do {:ok, {encoded_buffers, rest}, new_state} -> # something was encoded - IO.inspect(encoded_buffers, label: "encoded_buffers") {[buffer: {:output, encoded_buffers}], %{state | queue: rest, pts: new_state.pts}} end end diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index 9cebdb3..a3ebba2 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -45,7 +45,7 @@ defmodule Membrane.Opus.Parser do ], generate_best_effort_timestamps: [ spec: boolean(), - default: true, + default: false, description: """ generate_best_effort_timestamps - missing description """ @@ -80,15 +80,13 @@ defmodule Membrane.Opus.Parser do def handle_buffer(:input, %Buffer{payload: data, pts: pts}, ctx, state) do {delimitation_processor, self_delimiting?} = Delimitation.get_processor(state.delimitation, state.input_delimitted?) - IO.inspect(pts, label: "PTS IN") - IO.inspect(state, label: "STATE IN") case maybe_parse( state.buffer <> data, if state.generate_best_effort_timestamps do - pts + pts else - state.pts + state.pts end, state.input_delimitted?, delimitation_processor, @@ -113,7 +111,8 @@ defmodule Membrane.Opus.Parser do true -> [] end - IO.inspect({packet_actions, %{state | buffer: buffer, pts: pts}}, label: "OUT") + + {packet_actions, %{state | buffer: buffer, pts: pts}} :error -> {{:error, "An error occured in parsing"}, state} @@ -131,9 +130,25 @@ defmodule Membrane.Opus.Parser do {:ok, remaining_buffer :: binary, pts :: Membrane.Time.t(), packets :: [Buffer.t()], channels :: 0..2, generate_best_effort_timestamps :: boolean()} | :error - defp maybe_parse(data, pts, input_delimitted?, processor, packets \\ [], channels \\ 0, generate_best_effort_timestamps) - - defp maybe_parse(data, pts, input_delimitted?, processor, packets, channels, generate_best_effort_timestamps) + defp maybe_parse( + data, + pts, + input_delimitted?, + processor, + packets \\ [], + channels \\ 0, + generate_best_effort_timestamps + ) + + defp maybe_parse( + data, + pts, + input_delimitted?, + processor, + packets, + channels, + generate_best_effort_timestamps + ) when byte_size(data) > 0 do with {:ok, configuration_number, stereo_flag, frame_packing} <- Util.parse_toc_byte(data), channels <- max(channels, Util.parse_channels(stereo_flag)), @@ -152,7 +167,7 @@ defmodule Membrane.Opus.Parser do duration: duration } } - IO.inspect(pts, label: "PTS MAYBE PARSE") + maybe_parse( rest, if generate_best_effort_timestamps do @@ -179,7 +194,15 @@ defmodule Membrane.Opus.Parser do end end - defp maybe_parse(data, pts, _input_delimitted?, _processor, packets, channels, _generate_best_effort_timestamps) do + defp maybe_parse( + data, + pts, + _input_delimitted?, + _processor, + packets, + channels, + _generate_best_effort_timestamps + ) do {:ok, data, pts, packets |> Enum.reverse(), channels} end From 8f988be37c6a2b685fa49cedad483fffef69ce94 Mon Sep 17 00:00:00 2001 From: bartkrak Date: Tue, 19 Dec 2023 10:12:30 +0100 Subject: [PATCH 11/39] encoder test unused var fix --- test/membrane_opus/encoder_test.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/membrane_opus/encoder_test.exs b/test/membrane_opus/encoder_test.exs index f098e23..2b84a12 100644 --- a/test/membrane_opus/encoder_test.exs +++ b/test/membrane_opus/encoder_test.exs @@ -15,7 +15,7 @@ defmodule Membrane.Opus.Encoder.EncoderTest do File.read!(@input_path) |> String.split() |> Enum.zip(0..2) - |> Enum.map(fn {payload, index} -> + |> Enum.map(fn {payload} -> %Membrane.Buffer{payload: payload, pts: nil} end) end From f9bbd367997fddb0626e316a7989d407d58ce4ad Mon Sep 17 00:00:00 2001 From: bartkrak Date: Tue, 19 Dec 2023 10:16:34 +0100 Subject: [PATCH 12/39] another quick fix --- test/membrane_opus/encoder_test.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/membrane_opus/encoder_test.exs b/test/membrane_opus/encoder_test.exs index 2b84a12..7acab75 100644 --- a/test/membrane_opus/encoder_test.exs +++ b/test/membrane_opus/encoder_test.exs @@ -15,7 +15,7 @@ defmodule Membrane.Opus.Encoder.EncoderTest do File.read!(@input_path) |> String.split() |> Enum.zip(0..2) - |> Enum.map(fn {payload} -> + |> Enum.map(fn {payload, _index} -> %Membrane.Buffer{payload: payload, pts: nil} end) end From 80c9cfad082536cd8be857b119ba93c45b79bcb4 Mon Sep 17 00:00:00 2001 From: bartkrak Date: Wed, 20 Dec 2023 12:19:46 +0100 Subject: [PATCH 13/39] updated parser tests --- lib/membrane_opus/encoder.ex | 4 -- lib/membrane_opus/parser.ex | 2 +- test/membrane_opus/parser_test.exs | 80 ++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 5 deletions(-) diff --git a/lib/membrane_opus/encoder.ex b/lib/membrane_opus/encoder.ex index bd6230f..ec49009 100644 --- a/lib/membrane_opus/encoder.ex +++ b/lib/membrane_opus/encoder.ex @@ -134,8 +134,6 @@ defmodule Membrane.Opus.Encoder do @impl true def handle_buffer(:input, %Buffer{payload: data, pts: pts}, _ctx, state) do - # IO.inspect(state.pts, label: "handle_buffer state.pts") - # IO.inspect(pts, label: "handle_buffer pts") pepare_state = fn state, pts -> if state.pts == nil do %{state | pts: pts} @@ -214,7 +212,6 @@ defmodule Membrane.Opus.Encoder do defp encode_buffer(raw_buffer, state, target_byte_size, encoded_frames) when byte_size(raw_buffer) >= target_byte_size do # Encode a single frame because buffer contains at least one frame - # IO.puts("encode_buffer") <> = raw_buffer {:ok, raw_encoded} = Native.encode_packet(state.native, raw_frame, frame_size(state)) @@ -236,7 +233,6 @@ defmodule Membrane.Opus.Encoder do end defp update_state_pts(state, raw_frame) do - # IO.inspect(state.pts, label: "state.pts") if state.pts == nil do state else diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index a3ebba2..6df3790 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -112,7 +112,7 @@ defmodule Membrane.Opus.Parser do [] end - {packet_actions, %{state | buffer: buffer, pts: pts}} + IO.inspect({packet_actions, %{state | buffer: buffer, pts: pts}}) :error -> {{:error, "An error occured in parsing"}, state} diff --git a/test/membrane_opus/parser_test.exs b/test/membrane_opus/parser_test.exs index 1eca460..0a016e4 100644 --- a/test/membrane_opus/parser_test.exs +++ b/test/membrane_opus/parser_test.exs @@ -153,6 +153,86 @@ defmodule Membrane.Opus.Parser.ParserTest do do_test(pipeline, false) end + test "non-self-delimiting input and output, generate_best_effort_timestamps" do + inputs = + @fixtures + |> Enum.map(fn fixture -> %Buffer{ + pts: fixture.pts, + payload: fixture.normal, + metadata: %{duration: fixture.duration} + } end) + IO.inspect(inputs, label: "INPUTS") + spec = [ + child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) + |> child(:parser, %Parser{generate_best_effort_timestamps: true}) + |> child(:sink, Sink) + ] + + pipeline = Pipeline.start_link_supervised!(spec: spec) + + do_test(pipeline, false) + end + + test "non-self-delimiting input, self-delimiting output, generate_best_effort_timestamps" do + inputs = + @fixtures + |> Enum.map(fn fixture -> %Buffer{ + pts: fixture.pts, + payload: fixture.normal, + metadata: %{duration: fixture.duration} + } end) + + spec = [ + child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) + |> child(:parser, %Parser{delimitation: :delimit, generate_best_effort_timestamps: true}) + |> child(:sink, Sink) + ] + + pipeline = Pipeline.start_link_supervised!(spec: spec) + + do_test(pipeline, true) + end + + test "self-delimiting input and output, generate_best_effort_timestamps" do + inputs = + @fixtures + |> Enum.map(fn fixture -> %Buffer{ + pts: fixture.pts, + payload: fixture.delimited, + metadata: %{duration: fixture.duration} + } end) + + spec = [ + child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) + |> child(:parser, %Parser{input_delimitted?: true, generate_best_effort_timestamps: true}) + |> child(:sink, Sink) + ] + + pipeline = Pipeline.start_link_supervised!(spec: spec) + + do_test(pipeline, true) + end + + test "self-delimiting input, non-self-delimiting output, generate_best_effort_timestamps" do + inputs = + @fixtures + |> Enum.map(fn fixture -> %Buffer{ + pts: fixture.pts, + payload: fixture.delimited, + metadata: %{duration: fixture.duration} + } end) + + spec = [ + child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) + |> child(:parser, %Parser{delimitation: :undelimit, input_delimitted?: true, generate_best_effort_timestamps: true}) + |> child(:sink, Sink) + ] + + pipeline = Pipeline.start_link_supervised!(spec: spec) + + do_test(pipeline, false) + end + defp do_test(pipeline, self_delimiting?) do assert_start_of_stream(pipeline, :sink) From 8fd695eaab648bd54a63cc7f2a0b8d3f86b1f555 Mon Sep 17 00:00:00 2001 From: bartkrak Date: Wed, 20 Dec 2023 14:01:52 +0100 Subject: [PATCH 14/39] formatting fix --- lib/membrane_opus/parser.ex | 2 +- test/membrane_opus/parser_test.exs | 56 ++++++++++++++++++------------ 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index 6df3790..a3ebba2 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -112,7 +112,7 @@ defmodule Membrane.Opus.Parser do [] end - IO.inspect({packet_actions, %{state | buffer: buffer, pts: pts}}) + {packet_actions, %{state | buffer: buffer, pts: pts}} :error -> {{:error, "An error occured in parsing"}, state} diff --git a/test/membrane_opus/parser_test.exs b/test/membrane_opus/parser_test.exs index 0a016e4..ac9bae5 100644 --- a/test/membrane_opus/parser_test.exs +++ b/test/membrane_opus/parser_test.exs @@ -156,12 +156,14 @@ defmodule Membrane.Opus.Parser.ParserTest do test "non-self-delimiting input and output, generate_best_effort_timestamps" do inputs = @fixtures - |> Enum.map(fn fixture -> %Buffer{ - pts: fixture.pts, - payload: fixture.normal, - metadata: %{duration: fixture.duration} - } end) - IO.inspect(inputs, label: "INPUTS") + |> Enum.map(fn fixture -> + %Buffer{ + pts: fixture.pts, + payload: fixture.normal, + metadata: %{duration: fixture.duration} + } + end) + spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) |> child(:parser, %Parser{generate_best_effort_timestamps: true}) @@ -176,11 +178,13 @@ defmodule Membrane.Opus.Parser.ParserTest do test "non-self-delimiting input, self-delimiting output, generate_best_effort_timestamps" do inputs = @fixtures - |> Enum.map(fn fixture -> %Buffer{ - pts: fixture.pts, - payload: fixture.normal, - metadata: %{duration: fixture.duration} - } end) + |> Enum.map(fn fixture -> + %Buffer{ + pts: fixture.pts, + payload: fixture.normal, + metadata: %{duration: fixture.duration} + } + end) spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) @@ -196,11 +200,13 @@ defmodule Membrane.Opus.Parser.ParserTest do test "self-delimiting input and output, generate_best_effort_timestamps" do inputs = @fixtures - |> Enum.map(fn fixture -> %Buffer{ - pts: fixture.pts, - payload: fixture.delimited, - metadata: %{duration: fixture.duration} - } end) + |> Enum.map(fn fixture -> + %Buffer{ + pts: fixture.pts, + payload: fixture.delimited, + metadata: %{duration: fixture.duration} + } + end) spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) @@ -216,15 +222,21 @@ defmodule Membrane.Opus.Parser.ParserTest do test "self-delimiting input, non-self-delimiting output, generate_best_effort_timestamps" do inputs = @fixtures - |> Enum.map(fn fixture -> %Buffer{ - pts: fixture.pts, - payload: fixture.delimited, - metadata: %{duration: fixture.duration} - } end) + |> Enum.map(fn fixture -> + %Buffer{ + pts: fixture.pts, + payload: fixture.delimited, + metadata: %{duration: fixture.duration} + } + end) spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) - |> child(:parser, %Parser{delimitation: :undelimit, input_delimitted?: true, generate_best_effort_timestamps: true}) + |> child(:parser, %Parser{ + delimitation: :undelimit, + input_delimitted?: true, + generate_best_effort_timestamps: true + }) |> child(:sink, Sink) ] From 79e550333af484664bfbd248d45d2ce60e02883e Mon Sep 17 00:00:00 2001 From: bartkrak Date: Tue, 2 Jan 2024 16:24:05 +0100 Subject: [PATCH 15/39] paser review fixes, parser tests --- .vscode/settings.json | 3 -- lib/membrane_opus/parser.ex | 40 +++++++++++----------- test/membrane_opus/encoder_test.exs | 16 ++------- test/membrane_opus/parser_test.exs | 52 ++++++++++++++++++++--------- 4 files changed, 60 insertions(+), 51 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index fc4c15b..e69de29 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +0,0 @@ -{ - "C_Cpp.errorSquiggles": "enabled" -} \ No newline at end of file diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index a3ebba2..1565697 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -43,11 +43,13 @@ defmodule Membrane.Opus.Parser do ignore upstream stream_format information on self-delimitation. """ ], - generate_best_effort_timestamps: [ + generate_best_effort_timestamps?: [ spec: boolean(), default: false, description: """ - generate_best_effort_timestamps - missing description + If this is set to true parser will try to generate timestamps + starting from 0 and increasing them by frame duration, + otherwise it will pass pts from input to output, even if it's nil. """ ] @@ -80,17 +82,18 @@ defmodule Membrane.Opus.Parser do def handle_buffer(:input, %Buffer{payload: data, pts: pts}, ctx, state) do {delimitation_processor, self_delimiting?} = Delimitation.get_processor(state.delimitation, state.input_delimitted?) - + IO.inspect(pts, label: "input pts") case maybe_parse( state.buffer <> data, - if state.generate_best_effort_timestamps do - pts - else - state.pts + cond do + state.generate_best_effort_timestamps? -> + state.pts + true -> + pts end, state.input_delimitted?, delimitation_processor, - state.generate_best_effort_timestamps + state.generate_best_effort_timestamps? ) do {:ok, buffer, pts, packets, channels} -> stream_format = %Opus{ @@ -112,7 +115,7 @@ defmodule Membrane.Opus.Parser do [] end - {packet_actions, %{state | buffer: buffer, pts: pts}} + IO.inspect({packet_actions, %{state | buffer: buffer, pts: pts}}, label: "OUTPUT") :error -> {{:error, "An error occured in parsing"}, state} @@ -128,7 +131,7 @@ defmodule Membrane.Opus.Parser do channels :: 0..2 ) :: {:ok, remaining_buffer :: binary, pts :: Membrane.Time.t(), packets :: [Buffer.t()], - channels :: 0..2, generate_best_effort_timestamps :: boolean()} + channels :: 0..2, generate_best_effort_timestamps? :: boolean()} | :error defp maybe_parse( data, @@ -137,7 +140,7 @@ defmodule Membrane.Opus.Parser do processor, packets \\ [], channels \\ 0, - generate_best_effort_timestamps + generate_best_effort_timestamps? ) defp maybe_parse( @@ -147,7 +150,7 @@ defmodule Membrane.Opus.Parser do processor, packets, channels, - generate_best_effort_timestamps + generate_best_effort_timestamps? ) when byte_size(data) > 0 do with {:ok, configuration_number, stereo_flag, frame_packing} <- Util.parse_toc_byte(data), @@ -170,20 +173,17 @@ defmodule Membrane.Opus.Parser do maybe_parse( rest, - if generate_best_effort_timestamps do - pts - else - if pts == nil do + cond do + pts == nil -> nil - else + true -> pts + duration - end end, input_delimitted?, processor, [packet | packets], channels, - generate_best_effort_timestamps + generate_best_effort_timestamps? ) else {:error, :cont} -> @@ -201,7 +201,7 @@ defmodule Membrane.Opus.Parser do _processor, packets, channels, - _generate_best_effort_timestamps + _generate_best_effort_timestamps? ) do {:ok, data, pts, packets |> Enum.reverse(), channels} end diff --git a/test/membrane_opus/encoder_test.exs b/test/membrane_opus/encoder_test.exs index 7acab75..dc96d09 100644 --- a/test/membrane_opus/encoder_test.exs +++ b/test/membrane_opus/encoder_test.exs @@ -11,15 +11,6 @@ defmodule Membrane.Opus.Encoder.EncoderTest do @input_path "test/fixtures/raw_packets" @reference_path "test/fixtures/encoder_output_reference" - defp raw_packets() do - File.read!(@input_path) - |> String.split() - |> Enum.zip(0..2) - |> Enum.map(fn {payload, _index} -> - %Membrane.Buffer{payload: payload, pts: nil} - end) - end - defp setup_pipeline(output_path) do on_exit(fn -> File.rm(output_path) end) @@ -60,10 +51,9 @@ defmodule Membrane.Opus.Encoder.EncoderTest do @tag :a test "encoder works with stream format received on :input pad" do spec = [ - # child(:source, %Membrane.File.Source{ - # location: @input_path - # }) - child(:source, %Membrane.Testing.Source{output: raw_packets()}) + child(:source, %Membrane.File.Source{ + location: @input_path + }) |> child(:parser, %Membrane.RawAudioParser{ stream_format: %Membrane.RawAudio{channels: 2, sample_format: :s16le, sample_rate: 48_000} }) diff --git a/test/membrane_opus/parser_test.exs b/test/membrane_opus/parser_test.exs index ac9bae5..ac325f8 100644 --- a/test/membrane_opus/parser_test.exs +++ b/test/membrane_opus/parser_test.exs @@ -92,7 +92,13 @@ defmodule Membrane.Opus.Parser.ParserTest do test "non-self-delimiting input and output" do inputs = @fixtures - |> Enum.map(fn fixture -> fixture.normal end) + |> Enum.map(fn fixture -> + %Buffer{ + pts: fixture.pts, + payload: fixture.normal, + metadata: %{duration: fixture.duration} + } + end) spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) @@ -108,7 +114,13 @@ defmodule Membrane.Opus.Parser.ParserTest do test "non-self-delimiting input, self-delimiting output" do inputs = @fixtures - |> Enum.map(fn fixture -> fixture.normal end) + |> Enum.map(fn fixture -> + %Buffer{ + pts: fixture.pts, + payload: fixture.normal, + metadata: %{duration: fixture.duration} + } + end) spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) @@ -124,7 +136,13 @@ defmodule Membrane.Opus.Parser.ParserTest do test "self-delimiting input and output" do inputs = @fixtures - |> Enum.map(fn fixture -> fixture.delimited end) + |> Enum.map(fn fixture -> + %Buffer{ + pts: fixture.pts, + payload: fixture.delimited, + metadata: %{duration: fixture.duration} + } + end) spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) @@ -140,7 +158,13 @@ defmodule Membrane.Opus.Parser.ParserTest do test "self-delimiting input, non-self-delimiting output" do inputs = @fixtures - |> Enum.map(fn fixture -> fixture.delimited end) + |> Enum.map(fn fixture -> + %Buffer{ + pts: fixture.pts, + payload: fixture.delimited, + metadata: %{duration: fixture.duration} + } + end) spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) @@ -149,11 +173,10 @@ defmodule Membrane.Opus.Parser.ParserTest do ] pipeline = Pipeline.start_link_supervised!(spec: spec) - do_test(pipeline, false) end - test "non-self-delimiting input and output, generate_best_effort_timestamps" do + test "non-self-delimiting input and output, generate_best_effort_timestamps?" do inputs = @fixtures |> Enum.map(fn fixture -> @@ -164,18 +187,17 @@ defmodule Membrane.Opus.Parser.ParserTest do } end) - spec = [ + spec = child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) - |> child(:parser, %Parser{generate_best_effort_timestamps: true}) + |> child(:parser, %Parser{generate_best_effort_timestamps?: true}) |> child(:sink, Sink) - ] pipeline = Pipeline.start_link_supervised!(spec: spec) do_test(pipeline, false) end - test "non-self-delimiting input, self-delimiting output, generate_best_effort_timestamps" do + test "non-self-delimiting input, self-delimiting output, generate_best_effort_timestamps?" do inputs = @fixtures |> Enum.map(fn fixture -> @@ -188,7 +210,7 @@ defmodule Membrane.Opus.Parser.ParserTest do spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) - |> child(:parser, %Parser{delimitation: :delimit, generate_best_effort_timestamps: true}) + |> child(:parser, %Parser{delimitation: :delimit, generate_best_effort_timestamps?: true}) |> child(:sink, Sink) ] @@ -197,7 +219,7 @@ defmodule Membrane.Opus.Parser.ParserTest do do_test(pipeline, true) end - test "self-delimiting input and output, generate_best_effort_timestamps" do + test "self-delimiting input and output, generate_best_effort_timestamps?" do inputs = @fixtures |> Enum.map(fn fixture -> @@ -210,7 +232,7 @@ defmodule Membrane.Opus.Parser.ParserTest do spec = [ child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) - |> child(:parser, %Parser{input_delimitted?: true, generate_best_effort_timestamps: true}) + |> child(:parser, %Parser{input_delimitted?: true, generate_best_effort_timestamps?: true}) |> child(:sink, Sink) ] @@ -219,7 +241,7 @@ defmodule Membrane.Opus.Parser.ParserTest do do_test(pipeline, true) end - test "self-delimiting input, non-self-delimiting output, generate_best_effort_timestamps" do + test "self-delimiting input, non-self-delimiting output, generate_best_effort_timestamps?" do inputs = @fixtures |> Enum.map(fn fixture -> @@ -235,7 +257,7 @@ defmodule Membrane.Opus.Parser.ParserTest do |> child(:parser, %Parser{ delimitation: :undelimit, input_delimitted?: true, - generate_best_effort_timestamps: true + generate_best_effort_timestamps?: true }) |> child(:sink, Sink) ] From 60f7e470244c302fa39d53a066a5136d5e523fda Mon Sep 17 00:00:00 2001 From: bartkrak Date: Tue, 2 Jan 2024 16:54:28 +0100 Subject: [PATCH 16/39] encoder review requested fixes --- lib/membrane_opus/encoder.ex | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/lib/membrane_opus/encoder.ex b/lib/membrane_opus/encoder.ex index ec49009..1b0ee72 100644 --- a/lib/membrane_opus/encoder.ex +++ b/lib/membrane_opus/encoder.ex @@ -133,23 +133,23 @@ defmodule Membrane.Opus.Encoder do end @impl true + @spec handle_buffer(:input, Membrane.Buffer.t(), any(), %{ + :input_stream_format => Membrane.RawAudio.t(), + :pts => any(), + :queue => binary(), + optional(any()) => any() + }) :: + {[{:buffer, {any(), any()}}], + %{:pts => any(), :queue => bitstring(), optional(any()) => any()}} def handle_buffer(:input, %Buffer{payload: data, pts: pts}, _ctx, state) do - pepare_state = fn state, pts -> - if state.pts == nil do - %{state | pts: pts} - else - state - end - end - - case encode_buffer(state.queue <> data, pepare_state.(state, pts), frame_size_in_bytes(state)) do - {:ok, {[], rest}, new_state} -> + case encode_buffer(state.queue <> data, %{state | pts: pts}, frame_size_in_bytes(state)) do + {:ok, [], state} -> # nothing was encoded - {[], %{state | queue: rest, pts: new_state.pts}} + {[], state} - {:ok, {encoded_buffers, rest}, new_state} -> + {:ok, encoded_buffers, state} -> # something was encoded - {[buffer: {:output, encoded_buffers}], %{state | queue: rest, pts: new_state.pts}} + {[buffer: {:output, encoded_buffers}], state} end end @@ -217,11 +217,10 @@ defmodule Membrane.Opus.Encoder do # maybe keep encoding if there are more frames out_buffer = [%Buffer{payload: raw_encoded, pts: state.pts} | encoded_frames] - new_state = update_state_pts(state, raw_frame) encode_buffer( rest, - new_state, + update_state_pts(state, raw_frame), target_byte_size, out_buffer ) @@ -229,7 +228,7 @@ defmodule Membrane.Opus.Encoder do defp encode_buffer(raw_buffer, state, _target_byte_size, encoded_frames) do # Invariant for encode_buffer - return what we have encoded - {:ok, {encoded_frames |> Enum.reverse(), raw_buffer}, state} + {:ok, encoded_frames |> Enum.reverse(), %{state | queue: raw_buffer}} end defp update_state_pts(state, raw_frame) do From 59ff90a626403770abe37eee27a80d1342ab432e Mon Sep 17 00:00:00 2001 From: bartkrak Date: Tue, 2 Jan 2024 20:06:46 +0100 Subject: [PATCH 17/39] encoder pts logic changed, encoder tests --- lib/membrane_opus/encoder.ex | 13 ++++++++++++- lib/membrane_opus/parser.ex | 22 ++++++++++------------ test/membrane_opus/encoder_test.exs | 23 +++++++++++++++++++---- 3 files changed, 41 insertions(+), 17 deletions(-) diff --git a/lib/membrane_opus/encoder.ex b/lib/membrane_opus/encoder.ex index 1b0ee72..5726735 100644 --- a/lib/membrane_opus/encoder.ex +++ b/lib/membrane_opus/encoder.ex @@ -142,7 +142,18 @@ defmodule Membrane.Opus.Encoder do {[{:buffer, {any(), any()}}], %{:pts => any(), :queue => bitstring(), optional(any()) => any()}} def handle_buffer(:input, %Buffer{payload: data, pts: pts}, _ctx, state) do - case encode_buffer(state.queue <> data, %{state | pts: pts}, frame_size_in_bytes(state)) do + prepared_state = + if state.pts == nil do + %{state | pts: pts} + else + state + end + + case encode_buffer( + state.queue <> data, + prepared_state, + frame_size_in_bytes(state) + ) do {:ok, [], state} -> # nothing was encoded {[], state} diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index 1565697..d434c36 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -82,14 +82,13 @@ defmodule Membrane.Opus.Parser do def handle_buffer(:input, %Buffer{payload: data, pts: pts}, ctx, state) do {delimitation_processor, self_delimiting?} = Delimitation.get_processor(state.delimitation, state.input_delimitted?) - IO.inspect(pts, label: "input pts") + case maybe_parse( state.buffer <> data, - cond do - state.generate_best_effort_timestamps? -> - state.pts - true -> - pts + if state.generate_best_effort_timestamps? do + state.pts + else + pts end, state.input_delimitted?, delimitation_processor, @@ -115,7 +114,7 @@ defmodule Membrane.Opus.Parser do [] end - IO.inspect({packet_actions, %{state | buffer: buffer, pts: pts}}, label: "OUTPUT") + {packet_actions, %{state | buffer: buffer, pts: pts}} :error -> {{:error, "An error occured in parsing"}, state} @@ -173,11 +172,10 @@ defmodule Membrane.Opus.Parser do maybe_parse( rest, - cond do - pts == nil -> - nil - true -> - pts + duration + if pts == nil do + nil + else + pts + duration end, input_delimitted?, processor, diff --git a/test/membrane_opus/encoder_test.exs b/test/membrane_opus/encoder_test.exs index dc96d09..c6ea21d 100644 --- a/test/membrane_opus/encoder_test.exs +++ b/test/membrane_opus/encoder_test.exs @@ -11,6 +11,24 @@ defmodule Membrane.Opus.Encoder.EncoderTest do @input_path "test/fixtures/raw_packets" @reference_path "test/fixtures/encoder_output_reference" + defp raw_packets(with_pts?) do + File.read!(@input_path) + |> String.split() + |> Enum.zip(0..2) + |> Enum.map(fn {payload, index} -> + # this number is actual duration of buffers in @input_path + %Membrane.Buffer{ + payload: payload, + pts: + if with_pts? do + index * 20_000_000 + else + nil + end + } + end) + end + defp setup_pipeline(output_path) do on_exit(fn -> File.rm(output_path) end) @@ -48,12 +66,9 @@ defmodule Membrane.Opus.Encoder.EncoderTest do Membrane.Pipeline.terminate(pipeline_pid) end - @tag :a test "encoder works with stream format received on :input pad" do spec = [ - child(:source, %Membrane.File.Source{ - location: @input_path - }) + child(:source, %Membrane.Testing.Source{output: raw_packets(false)}) |> child(:parser, %Membrane.RawAudioParser{ stream_format: %Membrane.RawAudio{channels: 2, sample_format: :s16le, sample_rate: 48_000} }) From ad83232c20c39a32b7ef96185f2e10c9b7a8c0aa Mon Sep 17 00:00:00 2001 From: bartkrak Date: Mon, 8 Jan 2024 07:16:54 +0100 Subject: [PATCH 18/39] parser encoder new pts alg --- lib/membrane_opus/encoder.ex | 40 +++++++++++++-------------- lib/membrane_opus/parser.ex | 42 +++++++++++++++-------------- test/membrane_opus/encoder_test.exs | 14 +++------- 3 files changed, 45 insertions(+), 51 deletions(-) diff --git a/lib/membrane_opus/encoder.ex b/lib/membrane_opus/encoder.ex index 5726735..ae23ebb 100644 --- a/lib/membrane_opus/encoder.ex +++ b/lib/membrane_opus/encoder.ex @@ -58,7 +58,7 @@ defmodule Membrane.Opus.Encoder do options |> Map.from_struct() |> Map.merge(%{ - pts: nil, + pts_current: nil, native: nil, queue: <<>> }) @@ -133,21 +133,18 @@ defmodule Membrane.Opus.Encoder do end @impl true - @spec handle_buffer(:input, Membrane.Buffer.t(), any(), %{ - :input_stream_format => Membrane.RawAudio.t(), - :pts => any(), - :queue => binary(), - optional(any()) => any() - }) :: - {[{:buffer, {any(), any()}}], - %{:pts => any(), :queue => bitstring(), optional(any()) => any()}} def handle_buffer(:input, %Buffer{payload: data, pts: pts}, _ctx, state) do - prepared_state = - if state.pts == nil do - %{state | pts: pts} - else + # jesli state.pts_current ma jakas wartosc i queue nie jest puste to trzeba sprawdzic czy input pts == state.current_pts + prepared_state = cond do + state.queue == <<>> -> + %{state | pts_current: pts} + state.pts_current != pts -> + raise """ + PTS values are not continuous + """ + true -> state - end + end case encode_buffer( state.queue <> data, @@ -160,7 +157,8 @@ defmodule Membrane.Opus.Encoder do {:ok, encoded_buffers, state} -> # something was encoded - {[buffer: {:output, encoded_buffers}], state} + IO.inspect(pts, label: "input pts") + IO.inspect({[buffer: {:output, encoded_buffers}], state}) end end @@ -227,8 +225,7 @@ defmodule Membrane.Opus.Encoder do {:ok, raw_encoded} = Native.encode_packet(state.native, raw_frame, frame_size(state)) # maybe keep encoding if there are more frames - out_buffer = [%Buffer{payload: raw_encoded, pts: state.pts} | encoded_frames] - + out_buffer = [%Buffer{payload: raw_encoded, pts: state.pts_current} | encoded_frames] encode_buffer( rest, update_state_pts(state, raw_frame), @@ -243,15 +240,16 @@ defmodule Membrane.Opus.Encoder do end defp update_state_pts(state, raw_frame) do - if state.pts == nil do - state + new_pts = if state.pts_current == nil do + nil else duration = raw_frame |> byte_size() |> RawAudio.bytes_to_time(state.input_stream_format) - - %{state | pts: state.pts + duration} + state.pts_current + duration end + + %{state | pts_current: new_pts} end end diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index d434c36..b6b3ed4 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -65,7 +65,7 @@ defmodule Membrane.Opus.Parser do options |> Map.from_struct() |> Map.merge(%{ - pts: 0, + pts_current: nil, buffer: <<>> }) @@ -82,19 +82,25 @@ defmodule Membrane.Opus.Parser do def handle_buffer(:input, %Buffer{payload: data, pts: pts}, ctx, state) do {delimitation_processor, self_delimiting?} = Delimitation.get_processor(state.delimitation, state.input_delimitted?) - + prepared_state = cond do + state.generate_best_effort_timestamps? and state.pts_current == nil -> + %{state | pts_current: 0} + !state.generate_best_effort_timestamps? and state.buffer == <<>> -> + %{state | pts_current: pts} + !state.generate_best_effort_timestamps? and state.pts_current != pts -> + raise """ + PTS values are not continuous + """ + true -> + state + end case maybe_parse( state.buffer <> data, - if state.generate_best_effort_timestamps? do - state.pts - else - pts - end, + prepared_state.pts_current, state.input_delimitted?, - delimitation_processor, - state.generate_best_effort_timestamps? + delimitation_processor ) do - {:ok, buffer, pts, packets, channels} -> + {:ok, buffer, pts_out, packets, channels} -> stream_format = %Opus{ self_delimiting?: self_delimiting?, channels: channels @@ -114,7 +120,7 @@ defmodule Membrane.Opus.Parser do [] end - {packet_actions, %{state | buffer: buffer, pts: pts}} + IO.inspect({packet_actions, %{state | buffer: buffer, pts_current: pts_out}}, label: "output") :error -> {{:error, "An error occured in parsing"}, state} @@ -130,7 +136,7 @@ defmodule Membrane.Opus.Parser do channels :: 0..2 ) :: {:ok, remaining_buffer :: binary, pts :: Membrane.Time.t(), packets :: [Buffer.t()], - channels :: 0..2, generate_best_effort_timestamps? :: boolean()} + channels :: 0..2} | :error defp maybe_parse( data, @@ -138,8 +144,7 @@ defmodule Membrane.Opus.Parser do input_delimitted?, processor, packets \\ [], - channels \\ 0, - generate_best_effort_timestamps? + channels \\ 0 ) defp maybe_parse( @@ -148,8 +153,7 @@ defmodule Membrane.Opus.Parser do input_delimitted?, processor, packets, - channels, - generate_best_effort_timestamps? + channels ) when byte_size(data) > 0 do with {:ok, configuration_number, stereo_flag, frame_packing} <- Util.parse_toc_byte(data), @@ -180,8 +184,7 @@ defmodule Membrane.Opus.Parser do input_delimitted?, processor, [packet | packets], - channels, - generate_best_effort_timestamps? + channels ) else {:error, :cont} -> @@ -198,8 +201,7 @@ defmodule Membrane.Opus.Parser do _input_delimitted?, _processor, packets, - channels, - _generate_best_effort_timestamps? + channels ) do {:ok, data, pts, packets |> Enum.reverse(), channels} end diff --git a/test/membrane_opus/encoder_test.exs b/test/membrane_opus/encoder_test.exs index c6ea21d..e57ecf1 100644 --- a/test/membrane_opus/encoder_test.exs +++ b/test/membrane_opus/encoder_test.exs @@ -11,20 +11,14 @@ defmodule Membrane.Opus.Encoder.EncoderTest do @input_path "test/fixtures/raw_packets" @reference_path "test/fixtures/encoder_output_reference" - defp raw_packets(with_pts?) do + defp raw_packets() do File.read!(@input_path) |> String.split() - |> Enum.zip(0..2) + |> Stream.with_index() |> Enum.map(fn {payload, index} -> - # this number is actual duration of buffers in @input_path %Membrane.Buffer{ payload: payload, - pts: - if with_pts? do - index * 20_000_000 - else - nil - end + pts: nil } end) end @@ -68,7 +62,7 @@ defmodule Membrane.Opus.Encoder.EncoderTest do test "encoder works with stream format received on :input pad" do spec = [ - child(:source, %Membrane.Testing.Source{output: raw_packets(false)}) + child(:source, %Membrane.Testing.Source{output: raw_packets()}) |> child(:parser, %Membrane.RawAudioParser{ stream_format: %Membrane.RawAudio{channels: 2, sample_format: :s16le, sample_rate: 48_000} }) From 5fa65341a379649f22654527972e038f433298bf Mon Sep 17 00:00:00 2001 From: bartkrak Date: Mon, 8 Jan 2024 07:30:50 +0100 Subject: [PATCH 19/39] parser refractor --- lib/membrane_opus/parser.ex | 64 ++++++++++++++----------------------- 1 file changed, 24 insertions(+), 40 deletions(-) diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index b6b3ed4..08968ed 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -66,7 +66,7 @@ defmodule Membrane.Opus.Parser do |> Map.from_struct() |> Map.merge(%{ pts_current: nil, - buffer: <<>> + queue: <<>> }) {[], state} @@ -82,10 +82,11 @@ defmodule Membrane.Opus.Parser do def handle_buffer(:input, %Buffer{payload: data, pts: pts}, ctx, state) do {delimitation_processor, self_delimiting?} = Delimitation.get_processor(state.delimitation, state.input_delimitted?) + prepared_state = cond do state.generate_best_effort_timestamps? and state.pts_current == nil -> %{state | pts_current: 0} - !state.generate_best_effort_timestamps? and state.buffer == <<>> -> + !state.generate_best_effort_timestamps? and state.queue == <<>> -> %{state | pts_current: pts} !state.generate_best_effort_timestamps? and state.pts_current != pts -> raise """ @@ -95,12 +96,11 @@ defmodule Membrane.Opus.Parser do state end case maybe_parse( - state.buffer <> data, - prepared_state.pts_current, - state.input_delimitted?, - delimitation_processor + state.queue <> data, + delimitation_processor, + prepared_state ) do - {:ok, buffer, pts_out, packets, channels} -> + {:ok, queue, packets, channels, state} -> stream_format = %Opus{ self_delimiting?: self_delimiting?, channels: channels @@ -120,40 +120,27 @@ defmodule Membrane.Opus.Parser do [] end - IO.inspect({packet_actions, %{state | buffer: buffer, pts_current: pts_out}}, label: "output") + {packet_actions, %{state | queue: queue}} :error -> {{:error, "An error occured in parsing"}, state} end end - @spec maybe_parse( - data :: binary, - pts :: Membrane.Time.t(), - input_delimitted? :: boolean, - processor :: Delimitation.processor_t(), - packets :: [Buffer.t()], - channels :: 0..2 - ) :: - {:ok, remaining_buffer :: binary, pts :: Membrane.Time.t(), packets :: [Buffer.t()], - channels :: 0..2} - | :error defp maybe_parse( data, - pts, - input_delimitted?, processor, packets \\ [], - channels \\ 0 + channels \\ 0, + state ) defp maybe_parse( data, - pts, - input_delimitted?, processor, packets, - channels + channels, + state ) when byte_size(data) > 0 do with {:ok, configuration_number, stereo_flag, frame_packing} <- Util.parse_toc_byte(data), @@ -161,34 +148,32 @@ defmodule Membrane.Opus.Parser do {:ok, _mode, _bandwidth, frame_duration} <- Util.parse_configuration(configuration_number), {:ok, header_size, frame_lengths, padding_size} <- - FrameLengths.parse(frame_packing, data, input_delimitted?), + FrameLengths.parse(frame_packing, data, state.input_delimitted?), expected_packet_size <- header_size + Enum.sum(frame_lengths) + padding_size, {:ok, raw_packet, rest} <- rest_of_packet(data, expected_packet_size) do duration = elapsed_time(frame_lengths, frame_duration) packet = %Buffer{ - pts: pts, + pts: state.pts_current, payload: processor.process(raw_packet, frame_lengths, header_size), metadata: %{ duration: duration } } - maybe_parse( rest, - if pts == nil do - nil - else - pts + duration - end, - input_delimitted?, processor, [packet | packets], - channels + channels, + if state.pts_current == nil do + state + else + %{state | pts_current: state.pts_current + duration} + end ) else {:error, :cont} -> - {:ok, data, pts, packets |> Enum.reverse(), channels} + {:ok, data, packets |> Enum.reverse(), channels, state} :error -> :error @@ -197,13 +182,12 @@ defmodule Membrane.Opus.Parser do defp maybe_parse( data, - pts, - _input_delimitted?, _processor, packets, - channels + channels, + state ) do - {:ok, data, pts, packets |> Enum.reverse(), channels} + {:ok, data, packets |> Enum.reverse(), channels, state} end @spec rest_of_packet(data :: binary, expected_packet_size :: pos_integer) :: From 35cdb594ab6f6b53f3f4ae1cc33c6a8593638eeb Mon Sep 17 00:00:00 2001 From: bartkrak Date: Mon, 8 Jan 2024 07:33:50 +0100 Subject: [PATCH 20/39] formatting fix --- lib/membrane_opus/encoder.ex | 47 ++++++++++++++++++++---------------- lib/membrane_opus/parser.ex | 8 +++++- 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/lib/membrane_opus/encoder.ex b/lib/membrane_opus/encoder.ex index ae23ebb..b599ca0 100644 --- a/lib/membrane_opus/encoder.ex +++ b/lib/membrane_opus/encoder.ex @@ -135,16 +135,19 @@ defmodule Membrane.Opus.Encoder do @impl true def handle_buffer(:input, %Buffer{payload: data, pts: pts}, _ctx, state) do # jesli state.pts_current ma jakas wartosc i queue nie jest puste to trzeba sprawdzic czy input pts == state.current_pts - prepared_state = cond do - state.queue == <<>> -> - %{state | pts_current: pts} - state.pts_current != pts -> - raise """ - PTS values are not continuous - """ - true -> - state - end + prepared_state = + cond do + state.queue == <<>> -> + %{state | pts_current: pts} + + state.pts_current != pts -> + raise """ + PTS values are not continuous + """ + + true -> + state + end case encode_buffer( state.queue <> data, @@ -157,8 +160,7 @@ defmodule Membrane.Opus.Encoder do {:ok, encoded_buffers, state} -> # something was encoded - IO.inspect(pts, label: "input pts") - IO.inspect({[buffer: {:output, encoded_buffers}], state}) + {[buffer: {:output, encoded_buffers}], state} end end @@ -226,6 +228,7 @@ defmodule Membrane.Opus.Encoder do # maybe keep encoding if there are more frames out_buffer = [%Buffer{payload: raw_encoded, pts: state.pts_current} | encoded_frames] + encode_buffer( rest, update_state_pts(state, raw_frame), @@ -240,15 +243,17 @@ defmodule Membrane.Opus.Encoder do end defp update_state_pts(state, raw_frame) do - new_pts = if state.pts_current == nil do - nil - else - duration = - raw_frame - |> byte_size() - |> RawAudio.bytes_to_time(state.input_stream_format) - state.pts_current + duration - end + new_pts = + if state.pts_current == nil do + nil + else + duration = + raw_frame + |> byte_size() + |> RawAudio.bytes_to_time(state.input_stream_format) + + state.pts_current + duration + end %{state | pts_current: new_pts} end diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index 08968ed..878605a 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -83,18 +83,23 @@ defmodule Membrane.Opus.Parser do {delimitation_processor, self_delimiting?} = Delimitation.get_processor(state.delimitation, state.input_delimitted?) - prepared_state = cond do + prepared_state = + cond do state.generate_best_effort_timestamps? and state.pts_current == nil -> %{state | pts_current: 0} + !state.generate_best_effort_timestamps? and state.queue == <<>> -> %{state | pts_current: pts} + !state.generate_best_effort_timestamps? and state.pts_current != pts -> raise """ PTS values are not continuous """ + true -> state end + case maybe_parse( state.queue <> data, delimitation_processor, @@ -160,6 +165,7 @@ defmodule Membrane.Opus.Parser do duration: duration } } + maybe_parse( rest, processor, From 98ac2659dbae961514d3ae806816e474c7bd44ca Mon Sep 17 00:00:00 2001 From: bartkrak Date: Mon, 8 Jan 2024 07:36:04 +0100 Subject: [PATCH 21/39] another formatting miss --- lib/membrane_opus/encoder.ex | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/membrane_opus/encoder.ex b/lib/membrane_opus/encoder.ex index b599ca0..c8ccba0 100644 --- a/lib/membrane_opus/encoder.ex +++ b/lib/membrane_opus/encoder.ex @@ -134,7 +134,6 @@ defmodule Membrane.Opus.Encoder do @impl true def handle_buffer(:input, %Buffer{payload: data, pts: pts}, _ctx, state) do - # jesli state.pts_current ma jakas wartosc i queue nie jest puste to trzeba sprawdzic czy input pts == state.current_pts prepared_state = cond do state.queue == <<>> -> From 830c580a1c9ea8782b345694894a955acd7fac5b Mon Sep 17 00:00:00 2001 From: bartkrak Date: Mon, 8 Jan 2024 07:41:11 +0100 Subject: [PATCH 22/39] code readability --- lib/membrane_opus/parser.ex | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index 878605a..b2c770a 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -78,32 +78,33 @@ defmodule Membrane.Opus.Parser do {[], state} end - @impl true - def handle_buffer(:input, %Buffer{payload: data, pts: pts}, ctx, state) do - {delimitation_processor, self_delimiting?} = - Delimitation.get_processor(state.delimitation, state.input_delimitted?) + defp prepare_state(state, pts) do + cond do + state.generate_best_effort_timestamps? and state.pts_current == nil -> + %{state | pts_current: 0} - prepared_state = - cond do - state.generate_best_effort_timestamps? and state.pts_current == nil -> - %{state | pts_current: 0} + !state.generate_best_effort_timestamps? and state.queue == <<>> -> + %{state | pts_current: pts} - !state.generate_best_effort_timestamps? and state.queue == <<>> -> - %{state | pts_current: pts} + !state.generate_best_effort_timestamps? and state.pts_current != pts -> + raise """ + PTS values are not continuous + """ - !state.generate_best_effort_timestamps? and state.pts_current != pts -> - raise """ - PTS values are not continuous - """ + true -> + state + end + end - true -> - state - end + @impl true + def handle_buffer(:input, %Buffer{payload: data, pts: pts}, ctx, state) do + {delimitation_processor, self_delimiting?} = + Delimitation.get_processor(state.delimitation, state.input_delimitted?) case maybe_parse( state.queue <> data, delimitation_processor, - prepared_state + prepare_state(state, pts) ) do {:ok, queue, packets, channels, state} -> stream_format = %Opus{ From 9c7735f6255867f68692032c8901059a5c343794 Mon Sep 17 00:00:00 2001 From: bartkrak Date: Tue, 9 Jan 2024 03:26:29 +0100 Subject: [PATCH 23/39] review requested changes, cleanup --- lib/membrane_opus/encoder.ex | 21 ++---- lib/membrane_opus/parser.ex | 31 ++++---- test/fixtures/raw_packets_long | 2 - test/membrane_opus/encoder_test.exs | 16 +---- test/membrane_opus/parser_test.exs | 105 +++++----------------------- 5 files changed, 46 insertions(+), 129 deletions(-) delete mode 100644 test/fixtures/raw_packets_long diff --git a/lib/membrane_opus/encoder.ex b/lib/membrane_opus/encoder.ex index c8ccba0..1442c60 100644 --- a/lib/membrane_opus/encoder.ex +++ b/lib/membrane_opus/encoder.ex @@ -230,7 +230,7 @@ defmodule Membrane.Opus.Encoder do encode_buffer( rest, - update_state_pts(state, raw_frame), + bump_current_pts(state, raw_frame), target_byte_size, out_buffer ) @@ -241,19 +241,12 @@ defmodule Membrane.Opus.Encoder do {:ok, encoded_frames |> Enum.reverse(), %{state | queue: raw_buffer}} end - defp update_state_pts(state, raw_frame) do - new_pts = - if state.pts_current == nil do - nil - else - duration = - raw_frame - |> byte_size() - |> RawAudio.bytes_to_time(state.input_stream_format) - - state.pts_current + duration - end + defp bump_current_pts(%{pts_current: nil} = state, _raw_frame), do: state - %{state | pts_current: new_pts} + defp bump_current_pts(state, raw_frame) do + duration = raw_frame + |> byte_size() + |> RawAudio.bytes_to_time(state.input_stream_format) + Map.update!(state, :pts_current, & &1 + duration) end end diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index b2c770a..c4c2e6b 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -78,15 +78,22 @@ defmodule Membrane.Opus.Parser do {[], state} end - defp prepare_state(state, pts) do + defp set_current_pts(%{generate_best_effort_timestamps?: true} = state, _input_pts) do cond do - state.generate_best_effort_timestamps? and state.pts_current == nil -> + state.pts_current == nil -> %{state | pts_current: 0} - !state.generate_best_effort_timestamps? and state.queue == <<>> -> - %{state | pts_current: pts} + true -> + state + end + end - !state.generate_best_effort_timestamps? and state.pts_current != pts -> + defp set_current_pts(%{generate_best_effort_timestamps?: false} = state, input_pts) do + cond do + state.queue == <<>> -> + %{state | pts_current: input_pts} + + state.pts_current != input_pts -> raise """ PTS values are not continuous """ @@ -104,7 +111,7 @@ defmodule Membrane.Opus.Parser do case maybe_parse( state.queue <> data, delimitation_processor, - prepare_state(state, pts) + set_current_pts(state, pts) ) do {:ok, queue, packets, channels, state} -> stream_format = %Opus{ @@ -166,17 +173,17 @@ defmodule Membrane.Opus.Parser do duration: duration } } - + updated_state = if state.pts_current == nil do + state + else + %{state | pts_current: state.pts_current + duration} + end maybe_parse( rest, processor, [packet | packets], channels, - if state.pts_current == nil do - state - else - %{state | pts_current: state.pts_current + duration} - end + updated_state ) else {:error, :cont} -> diff --git a/test/fixtures/raw_packets_long b/test/fixtures/raw_packets_long deleted file mode 100644 index 076bd89..0000000 --- a/test/fixtures/raw_packets_long +++ /dev/null @@ -1,2 +0,0 @@ -000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFF00000000000001000000FEFFFFFFF7FFFDFFF4FFFCFFF5FFFCFFF7FFFCFFF7FFFCFFF6FFFCFFF5FFFCFFF5FFFCFFF6FFFDFFF6FFFDFFF5FFFDFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFDFFF5FFFDFFF5FFFCFF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0000FDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFF0000FDFF0000FDFF0000FDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFF0000FEFF0000FEFFFFFFFDFFFFFFFCFF0000FDFF0000FEFF0000FDFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFF0000 -000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFF00000000000001000000FEFFFFFFF7FFFDFFF4FFFCFFF5FFFCFFF7FFFCFFF7FFFCFFF6FFFCFFF5FFFCFFF5FFFCFFF6FFFDFFF6FFFDFFF5FFFDFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFDFFF5FFFDFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF5FFFCFFF6FFFCFFF7FFFDFFF7FFFDFFF6FFFCFFF5FFFCFFF5FFFCFFF5FFFCFFF6FFFCFFF7FFFDFFF6FFFDFFF5FFFCFFF6FFFCFFF6FFFCFFF6F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FFDFF0000FEFF0000FEFFFFFFFDFFFFFFFCFF0000FDFF0000FEFF0000FDFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFDFFFFFFFDFF0000 diff --git a/test/membrane_opus/encoder_test.exs b/test/membrane_opus/encoder_test.exs index e57ecf1..75261e4 100644 --- a/test/membrane_opus/encoder_test.exs +++ b/test/membrane_opus/encoder_test.exs @@ -11,18 +11,6 @@ defmodule Membrane.Opus.Encoder.EncoderTest do @input_path "test/fixtures/raw_packets" @reference_path "test/fixtures/encoder_output_reference" - defp raw_packets() do - File.read!(@input_path) - |> String.split() - |> Stream.with_index() - |> Enum.map(fn {payload, index} -> - %Membrane.Buffer{ - payload: payload, - pts: nil - } - end) - end - defp setup_pipeline(output_path) do on_exit(fn -> File.rm(output_path) end) @@ -62,7 +50,9 @@ defmodule Membrane.Opus.Encoder.EncoderTest do test "encoder works with stream format received on :input pad" do spec = [ - child(:source, %Membrane.Testing.Source{output: raw_packets()}) + child(:source, %Membrane.File.Source{ + location: @input_path + }) |> child(:parser, %Membrane.RawAudioParser{ stream_format: %Membrane.RawAudio{channels: 2, sample_format: :s16le, sample_rate: 48_000} }) diff --git a/test/membrane_opus/parser_test.exs b/test/membrane_opus/parser_test.exs index ac325f8..4df6924 100644 --- a/test/membrane_opus/parser_test.exs +++ b/test/membrane_opus/parser_test.exs @@ -89,19 +89,18 @@ defmodule Membrane.Opus.Parser.ParserTest do } ] - test "non-self-delimiting input and output" do - inputs = - @fixtures - |> Enum.map(fn fixture -> - %Buffer{ - pts: fixture.pts, - payload: fixture.normal, - metadata: %{duration: fixture.duration} - } - end) + defp buffer_from_fixture(fixtures, self_delimited? \\ false) do + Enum.map(fixtures, fn fixture -> + %Buffer{ + pts: fixture.pts, + payload: if self_delimited? do fixture.delimited else fixture.normal end, + } + end) + end + test "non-self-delimiting input and output" do spec = [ - child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) + child(:source, %Source{output: buffer_from_fixture(@fixtures), stream_format: %RemoteStream{type: :bytestream}}) |> child(:parser, Parser) |> child(:sink, Sink) ] @@ -112,18 +111,8 @@ defmodule Membrane.Opus.Parser.ParserTest do end test "non-self-delimiting input, self-delimiting output" do - inputs = - @fixtures - |> Enum.map(fn fixture -> - %Buffer{ - pts: fixture.pts, - payload: fixture.normal, - metadata: %{duration: fixture.duration} - } - end) - spec = [ - child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) + child(:source, %Source{output: buffer_from_fixture(@fixtures), stream_format: %RemoteStream{type: :bytestream}}) |> child(:parser, %Parser{delimitation: :delimit}) |> child(:sink, Sink) ] @@ -134,18 +123,8 @@ defmodule Membrane.Opus.Parser.ParserTest do end test "self-delimiting input and output" do - inputs = - @fixtures - |> Enum.map(fn fixture -> - %Buffer{ - pts: fixture.pts, - payload: fixture.delimited, - metadata: %{duration: fixture.duration} - } - end) - spec = [ - child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) + child(:source, %Source{output: buffer_from_fixture(@fixtures, true), stream_format: %RemoteStream{type: :bytestream}}) |> child(:parser, %Parser{input_delimitted?: true}) |> child(:sink, Sink) ] @@ -156,18 +135,8 @@ defmodule Membrane.Opus.Parser.ParserTest do end test "self-delimiting input, non-self-delimiting output" do - inputs = - @fixtures - |> Enum.map(fn fixture -> - %Buffer{ - pts: fixture.pts, - payload: fixture.delimited, - metadata: %{duration: fixture.duration} - } - end) - spec = [ - child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) + child(:source, %Source{output: buffer_from_fixture(@fixtures, true), stream_format: %RemoteStream{type: :bytestream}}) |> child(:parser, %Parser{delimitation: :undelimit, input_delimitted?: true}) |> child(:sink, Sink) ] @@ -177,18 +146,8 @@ defmodule Membrane.Opus.Parser.ParserTest do end test "non-self-delimiting input and output, generate_best_effort_timestamps?" do - inputs = - @fixtures - |> Enum.map(fn fixture -> - %Buffer{ - pts: fixture.pts, - payload: fixture.normal, - metadata: %{duration: fixture.duration} - } - end) - spec = - child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) + child(:source, %Source{output: buffer_from_fixture(@fixtures), stream_format: %RemoteStream{type: :bytestream}}) |> child(:parser, %Parser{generate_best_effort_timestamps?: true}) |> child(:sink, Sink) @@ -198,18 +157,8 @@ defmodule Membrane.Opus.Parser.ParserTest do end test "non-self-delimiting input, self-delimiting output, generate_best_effort_timestamps?" do - inputs = - @fixtures - |> Enum.map(fn fixture -> - %Buffer{ - pts: fixture.pts, - payload: fixture.normal, - metadata: %{duration: fixture.duration} - } - end) - spec = [ - child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) + child(:source, %Source{output: buffer_from_fixture(@fixtures), stream_format: %RemoteStream{type: :bytestream}}) |> child(:parser, %Parser{delimitation: :delimit, generate_best_effort_timestamps?: true}) |> child(:sink, Sink) ] @@ -220,18 +169,8 @@ defmodule Membrane.Opus.Parser.ParserTest do end test "self-delimiting input and output, generate_best_effort_timestamps?" do - inputs = - @fixtures - |> Enum.map(fn fixture -> - %Buffer{ - pts: fixture.pts, - payload: fixture.delimited, - metadata: %{duration: fixture.duration} - } - end) - spec = [ - child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) + child(:source, %Source{output: buffer_from_fixture(@fixtures, true), stream_format: %RemoteStream{type: :bytestream}}) |> child(:parser, %Parser{input_delimitted?: true, generate_best_effort_timestamps?: true}) |> child(:sink, Sink) ] @@ -242,18 +181,8 @@ defmodule Membrane.Opus.Parser.ParserTest do end test "self-delimiting input, non-self-delimiting output, generate_best_effort_timestamps?" do - inputs = - @fixtures - |> Enum.map(fn fixture -> - %Buffer{ - pts: fixture.pts, - payload: fixture.delimited, - metadata: %{duration: fixture.duration} - } - end) - spec = [ - child(:source, %Source{output: inputs, stream_format: %RemoteStream{type: :bytestream}}) + child(:source, %Source{output: buffer_from_fixture(@fixtures, true), stream_format: %RemoteStream{type: :bytestream}}) |> child(:parser, %Parser{ delimitation: :undelimit, input_delimitted?: true, From 63b5e20bcb6e90fc9e5ade7c89f6353bf09f8b5c Mon Sep 17 00:00:00 2001 From: bartkrak Date: Wed, 10 Jan 2024 00:31:12 +0100 Subject: [PATCH 24/39] format --- lib/membrane_opus/encoder.ex | 6 ++-- lib/membrane_opus/parser.ex | 13 +++++---- test/membrane_opus/parser_test.exs | 47 ++++++++++++++++++++++++------ 3 files changed, 50 insertions(+), 16 deletions(-) diff --git a/lib/membrane_opus/encoder.ex b/lib/membrane_opus/encoder.ex index 1442c60..763f955 100644 --- a/lib/membrane_opus/encoder.ex +++ b/lib/membrane_opus/encoder.ex @@ -244,9 +244,11 @@ defmodule Membrane.Opus.Encoder do defp bump_current_pts(%{pts_current: nil} = state, _raw_frame), do: state defp bump_current_pts(state, raw_frame) do - duration = raw_frame + duration = + raw_frame |> byte_size() |> RawAudio.bytes_to_time(state.input_stream_format) - Map.update!(state, :pts_current, & &1 + duration) + + Map.update!(state, :pts_current, &(&1 + duration)) end end diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index c4c2e6b..fb44736 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -173,11 +173,14 @@ defmodule Membrane.Opus.Parser do duration: duration } } - updated_state = if state.pts_current == nil do - state - else - %{state | pts_current: state.pts_current + duration} - end + + updated_state = + if state.pts_current == nil do + state + else + %{state | pts_current: state.pts_current + duration} + end + maybe_parse( rest, processor, diff --git a/test/membrane_opus/parser_test.exs b/test/membrane_opus/parser_test.exs index 4df6924..d7975dd 100644 --- a/test/membrane_opus/parser_test.exs +++ b/test/membrane_opus/parser_test.exs @@ -93,14 +93,22 @@ defmodule Membrane.Opus.Parser.ParserTest do Enum.map(fixtures, fn fixture -> %Buffer{ pts: fixture.pts, - payload: if self_delimited? do fixture.delimited else fixture.normal end, + payload: + if self_delimited? do + fixture.delimited + else + fixture.normal + end } end) end test "non-self-delimiting input and output" do spec = [ - child(:source, %Source{output: buffer_from_fixture(@fixtures), stream_format: %RemoteStream{type: :bytestream}}) + child(:source, %Source{ + output: buffer_from_fixture(@fixtures), + stream_format: %RemoteStream{type: :bytestream} + }) |> child(:parser, Parser) |> child(:sink, Sink) ] @@ -112,7 +120,10 @@ defmodule Membrane.Opus.Parser.ParserTest do test "non-self-delimiting input, self-delimiting output" do spec = [ - child(:source, %Source{output: buffer_from_fixture(@fixtures), stream_format: %RemoteStream{type: :bytestream}}) + child(:source, %Source{ + output: buffer_from_fixture(@fixtures), + stream_format: %RemoteStream{type: :bytestream} + }) |> child(:parser, %Parser{delimitation: :delimit}) |> child(:sink, Sink) ] @@ -124,7 +135,10 @@ defmodule Membrane.Opus.Parser.ParserTest do test "self-delimiting input and output" do spec = [ - child(:source, %Source{output: buffer_from_fixture(@fixtures, true), stream_format: %RemoteStream{type: :bytestream}}) + child(:source, %Source{ + output: buffer_from_fixture(@fixtures, true), + stream_format: %RemoteStream{type: :bytestream} + }) |> child(:parser, %Parser{input_delimitted?: true}) |> child(:sink, Sink) ] @@ -136,7 +150,10 @@ defmodule Membrane.Opus.Parser.ParserTest do test "self-delimiting input, non-self-delimiting output" do spec = [ - child(:source, %Source{output: buffer_from_fixture(@fixtures, true), stream_format: %RemoteStream{type: :bytestream}}) + child(:source, %Source{ + output: buffer_from_fixture(@fixtures, true), + stream_format: %RemoteStream{type: :bytestream} + }) |> child(:parser, %Parser{delimitation: :undelimit, input_delimitted?: true}) |> child(:sink, Sink) ] @@ -147,7 +164,10 @@ defmodule Membrane.Opus.Parser.ParserTest do test "non-self-delimiting input and output, generate_best_effort_timestamps?" do spec = - child(:source, %Source{output: buffer_from_fixture(@fixtures), stream_format: %RemoteStream{type: :bytestream}}) + child(:source, %Source{ + output: buffer_from_fixture(@fixtures), + stream_format: %RemoteStream{type: :bytestream} + }) |> child(:parser, %Parser{generate_best_effort_timestamps?: true}) |> child(:sink, Sink) @@ -158,7 +178,10 @@ defmodule Membrane.Opus.Parser.ParserTest do test "non-self-delimiting input, self-delimiting output, generate_best_effort_timestamps?" do spec = [ - child(:source, %Source{output: buffer_from_fixture(@fixtures), stream_format: %RemoteStream{type: :bytestream}}) + child(:source, %Source{ + output: buffer_from_fixture(@fixtures), + stream_format: %RemoteStream{type: :bytestream} + }) |> child(:parser, %Parser{delimitation: :delimit, generate_best_effort_timestamps?: true}) |> child(:sink, Sink) ] @@ -170,7 +193,10 @@ defmodule Membrane.Opus.Parser.ParserTest do test "self-delimiting input and output, generate_best_effort_timestamps?" do spec = [ - child(:source, %Source{output: buffer_from_fixture(@fixtures, true), stream_format: %RemoteStream{type: :bytestream}}) + child(:source, %Source{ + output: buffer_from_fixture(@fixtures, true), + stream_format: %RemoteStream{type: :bytestream} + }) |> child(:parser, %Parser{input_delimitted?: true, generate_best_effort_timestamps?: true}) |> child(:sink, Sink) ] @@ -182,7 +208,10 @@ defmodule Membrane.Opus.Parser.ParserTest do test "self-delimiting input, non-self-delimiting output, generate_best_effort_timestamps?" do spec = [ - child(:source, %Source{output: buffer_from_fixture(@fixtures, true), stream_format: %RemoteStream{type: :bytestream}}) + child(:source, %Source{ + output: buffer_from_fixture(@fixtures, true), + stream_format: %RemoteStream{type: :bytestream} + }) |> child(:parser, %Parser{ delimitation: :undelimit, input_delimitted?: true, From 0d9a68698e2800e6fd9a20006df968789a425353 Mon Sep 17 00:00:00 2001 From: bartkrak Date: Wed, 10 Jan 2024 00:35:27 +0100 Subject: [PATCH 25/39] refractor --- lib/membrane_opus/parser.ex | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index fb44736..3e1e415 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -79,12 +79,10 @@ defmodule Membrane.Opus.Parser do end defp set_current_pts(%{generate_best_effort_timestamps?: true} = state, _input_pts) do - cond do - state.pts_current == nil -> - %{state | pts_current: 0} - - true -> - state + if state.pts_current == nil do + %{state | pts_current: 0} + else + state end end From 473d201814b09c236899d962824de068f20725e6 Mon Sep 17 00:00:00 2001 From: bartkrak Date: Thu, 11 Jan 2024 05:30:03 +0100 Subject: [PATCH 26/39] check pts of first full frame fix --- lib/membrane_opus/encoder.ex | 35 +++++++++++++++++++++---------- lib/membrane_opus/parser.ex | 40 ++++++++++++++++++++++++------------ 2 files changed, 51 insertions(+), 24 deletions(-) diff --git a/lib/membrane_opus/encoder.ex b/lib/membrane_opus/encoder.ex index 763f955..9ef7289 100644 --- a/lib/membrane_opus/encoder.ex +++ b/lib/membrane_opus/encoder.ex @@ -133,19 +133,19 @@ defmodule Membrane.Opus.Encoder do end @impl true - def handle_buffer(:input, %Buffer{payload: data, pts: pts}, _ctx, state) do + def handle_buffer(:input, %Buffer{payload: data, pts: input_pts}, _ctx, state) do prepared_state = - cond do - state.queue == <<>> -> - %{state | pts_current: pts} - - state.pts_current != pts -> - raise """ - PTS values are not continuous - """ + if state.queue == <<>> do + %{state | pts_current: input_pts} + else + state + end - true -> - state + check_pts_integrity_flag = + if state.queue != <<>> do + true + else + false end case encode_buffer( @@ -159,10 +159,23 @@ defmodule Membrane.Opus.Encoder do {:ok, encoded_buffers, state} -> # something was encoded + check_pts_integrity(check_pts_integrity_flag, encoded_buffers, input_pts) {[buffer: {:output, encoded_buffers}], state} end end + defp check_pts_integrity(flag, encoded_buffers, input_pts) do + if flag and length(encoded_buffers) > 0 do + first_output_frame_pts = Enum.at(encoded_buffers, 0) + + if first_output_frame_pts.pts != input_pts do + raise """ + PTS values are not continuous + """ + end + end + end + @impl true def handle_end_of_stream(:input, _ctx, state) do actions = [end_of_stream: :output] diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index 3e1e415..d6cfff0 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -87,31 +87,33 @@ defmodule Membrane.Opus.Parser do end defp set_current_pts(%{generate_best_effort_timestamps?: false} = state, input_pts) do - cond do - state.queue == <<>> -> - %{state | pts_current: input_pts} - - state.pts_current != input_pts -> - raise """ - PTS values are not continuous - """ - - true -> - state + if state.queue == <<>> do + %{state | pts_current: input_pts} + else + state end end @impl true - def handle_buffer(:input, %Buffer{payload: data, pts: pts}, ctx, state) do + def handle_buffer(:input, %Buffer{payload: data, pts: input_pts}, ctx, state) do {delimitation_processor, self_delimiting?} = Delimitation.get_processor(state.delimitation, state.input_delimitted?) + check_pts_integrity_flag = + if state.queue != <<>> and !state.generate_best_effort_timestamps? do + true + else + false + end + case maybe_parse( state.queue <> data, delimitation_processor, - set_current_pts(state, pts) + set_current_pts(state, input_pts) ) do {:ok, queue, packets, channels, state} -> + check_pts_integrity(check_pts_integrity_flag, packets, input_pts) + stream_format = %Opus{ self_delimiting?: self_delimiting?, channels: channels @@ -138,6 +140,18 @@ defmodule Membrane.Opus.Parser do end end + defp check_pts_integrity(flag, encoded_buffers, input_pts) do + if flag and length(encoded_buffers) > 0 do + first_output_frame_pts = Enum.at(encoded_buffers, 0) + + if first_output_frame_pts.pts != input_pts do + raise """ + PTS values are not continuous + """ + end + end + end + defp maybe_parse( data, processor, From 3541bf00770537256e575b136db7abb0fb6d3009 Mon Sep 17 00:00:00 2001 From: bartkrak Date: Thu, 11 Jan 2024 05:55:39 +0100 Subject: [PATCH 27/39] pattern matching rework --- lib/membrane_opus/encoder.ex | 19 +++++++++---------- lib/membrane_opus/parser.ex | 19 +++++++++---------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/lib/membrane_opus/encoder.ex b/lib/membrane_opus/encoder.ex index 9ef7289..2187dec 100644 --- a/lib/membrane_opus/encoder.ex +++ b/lib/membrane_opus/encoder.ex @@ -159,23 +159,22 @@ defmodule Membrane.Opus.Encoder do {:ok, encoded_buffers, state} -> # something was encoded - check_pts_integrity(check_pts_integrity_flag, encoded_buffers, input_pts) + check_pts_integrity(check_pts_integrity_flag, List.first(encoded_buffers), input_pts) {[buffer: {:output, encoded_buffers}], state} end end - defp check_pts_integrity(flag, encoded_buffers, input_pts) do - if flag and length(encoded_buffers) > 0 do - first_output_frame_pts = Enum.at(encoded_buffers, 0) - - if first_output_frame_pts.pts != input_pts do - raise """ - PTS values are not continuous - """ - end + defp check_pts_integrity(true = _flag, %Buffer{pts: pts}, input_pts) do + if pts != input_pts do + raise """ + PTS values are not continuous + """ end end + defp check_pts_integrity(false = _flag, %Buffer{pts: _pts}, _input_pts) do + end + @impl true def handle_end_of_stream(:input, _ctx, state) do actions = [end_of_stream: :output] diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index d6cfff0..d5b3d79 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -112,7 +112,7 @@ defmodule Membrane.Opus.Parser do set_current_pts(state, input_pts) ) do {:ok, queue, packets, channels, state} -> - check_pts_integrity(check_pts_integrity_flag, packets, input_pts) + check_pts_integrity(check_pts_integrity_flag, List.first(packets), input_pts) stream_format = %Opus{ self_delimiting?: self_delimiting?, @@ -140,18 +140,17 @@ defmodule Membrane.Opus.Parser do end end - defp check_pts_integrity(flag, encoded_buffers, input_pts) do - if flag and length(encoded_buffers) > 0 do - first_output_frame_pts = Enum.at(encoded_buffers, 0) - - if first_output_frame_pts.pts != input_pts do - raise """ - PTS values are not continuous - """ - end + defp check_pts_integrity(true = _flag, %Buffer{pts: pts}, input_pts) do + if pts != input_pts do + raise """ + PTS values are not continuous + """ end end + defp check_pts_integrity(false = _flag, %Buffer{pts: _pts}, _input_pts) do + end + defp maybe_parse( data, processor, From 7808af4cdd89efb05e7ef03b40ce6e4720c385dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Chali=C5=84ski?= Date: Mon, 15 Jan 2024 01:13:24 +0100 Subject: [PATCH 28/39] set_current_pts refractor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Feliks Pobiedziński <38541925+FelonEkonom@users.noreply.github.com> --- lib/membrane_opus/parser.ex | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index d5b3d79..a869128 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -76,23 +76,15 @@ defmodule Membrane.Opus.Parser do def handle_stream_format(:input, _stream_format, _ctx, state) do # ignore stream_formats, they will be sent in handle_buffer {[], state} + defp set_current_pts(%{generate_best_effort_timestamps?: true, pts_current: nil} = state, _input_pts) do + %{state | pts_current: 0} end - defp set_current_pts(%{generate_best_effort_timestamps?: true} = state, _input_pts) do - if state.pts_current == nil do - %{state | pts_current: 0} - else - state - end + defp set_current_pts(%{generate_best_effort_timestamps?: false, queue: <<>>} = state, input_pts) do + %{state | pts_current: input_pts} end - defp set_current_pts(%{generate_best_effort_timestamps?: false} = state, input_pts) do - if state.queue == <<>> do - %{state | pts_current: input_pts} - else - state - end - end + defp set_current_pts(state, _input_pts), do: state @impl true def handle_buffer(:input, %Buffer{payload: data, pts: input_pts}, ctx, state) do From 003678fbd3294f0456208f783ecb0eae91909449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Chali=C5=84ski?= Date: Mon, 15 Jan 2024 01:14:38 +0100 Subject: [PATCH 29/39] check_pts_integrity refractor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Feliks Pobiedziński <38541925+FelonEkonom@users.noreply.github.com> --- lib/membrane_opus/parser.ex | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index a869128..9a75c57 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -91,12 +91,7 @@ defmodule Membrane.Opus.Parser do {delimitation_processor, self_delimiting?} = Delimitation.get_processor(state.delimitation, state.input_delimitted?) - check_pts_integrity_flag = - if state.queue != <<>> and !state.generate_best_effort_timestamps? do - true - else - false - end +check_pts_integrity? = state.queue != <<>> and not state.generate_best_effort_timestamps? case maybe_parse( state.queue <> data, From d7640df9247752041e92abb8aa3f21993f952c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Chali=C5=84ski?= Date: Mon, 15 Jan 2024 01:18:01 +0100 Subject: [PATCH 30/39] Update lib/membrane_opus/parser.ex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Feliks Pobiedziński <38541925+FelonEkonom@users.noreply.github.com> --- lib/membrane_opus/parser.ex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index 9a75c57..91e1905 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -99,7 +99,9 @@ check_pts_integrity? = state.queue != <<>> and not state.generate_best_effort_ti set_current_pts(state, input_pts) ) do {:ok, queue, packets, channels, state} -> - check_pts_integrity(check_pts_integrity_flag, List.first(packets), input_pts) +if check_pts_integrity? and length(packets) >= 2 and Enum.at(packets, 1).pts != input_pts do + raise "PTS values are not continuous" +end stream_format = %Opus{ self_delimiting?: self_delimiting?, From 863fd82347d11e548f2444e19fa9f021dfc921ec Mon Sep 17 00:00:00 2001 From: bartkrak Date: Mon, 15 Jan 2024 01:30:55 +0100 Subject: [PATCH 31/39] refractor once again --- lib/membrane_opus/encoder.ex | 10 ++++----- lib/membrane_opus/parser.ex | 35 ++++++++++-------------------- test/membrane_opus/parser_test.exs | 18 +++++++-------- 3 files changed, 26 insertions(+), 37 deletions(-) diff --git a/lib/membrane_opus/encoder.ex b/lib/membrane_opus/encoder.ex index 2187dec..ee37071 100644 --- a/lib/membrane_opus/encoder.ex +++ b/lib/membrane_opus/encoder.ex @@ -58,7 +58,7 @@ defmodule Membrane.Opus.Encoder do options |> Map.from_struct() |> Map.merge(%{ - pts_current: nil, + current_pts: nil, native: nil, queue: <<>> }) @@ -136,7 +136,7 @@ defmodule Membrane.Opus.Encoder do def handle_buffer(:input, %Buffer{payload: data, pts: input_pts}, _ctx, state) do prepared_state = if state.queue == <<>> do - %{state | pts_current: input_pts} + %{state | current_pts: input_pts} else state end @@ -238,7 +238,7 @@ defmodule Membrane.Opus.Encoder do {:ok, raw_encoded} = Native.encode_packet(state.native, raw_frame, frame_size(state)) # maybe keep encoding if there are more frames - out_buffer = [%Buffer{payload: raw_encoded, pts: state.pts_current} | encoded_frames] + out_buffer = [%Buffer{payload: raw_encoded, pts: state.current_pts} | encoded_frames] encode_buffer( rest, @@ -253,7 +253,7 @@ defmodule Membrane.Opus.Encoder do {:ok, encoded_frames |> Enum.reverse(), %{state | queue: raw_buffer}} end - defp bump_current_pts(%{pts_current: nil} = state, _raw_frame), do: state + defp bump_current_pts(%{current_pts: nil} = state, _raw_frame), do: state defp bump_current_pts(state, raw_frame) do duration = @@ -261,6 +261,6 @@ defmodule Membrane.Opus.Encoder do |> byte_size() |> RawAudio.bytes_to_time(state.input_stream_format) - Map.update!(state, :pts_current, &(&1 + duration)) + Map.update!(state, :current_pts, &(&1 + duration)) end end diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index 91e1905..4c97141 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -65,7 +65,7 @@ defmodule Membrane.Opus.Parser do options |> Map.from_struct() |> Map.merge(%{ - pts_current: nil, + current_pts: nil, queue: <<>> }) @@ -76,12 +76,12 @@ defmodule Membrane.Opus.Parser do def handle_stream_format(:input, _stream_format, _ctx, state) do # ignore stream_formats, they will be sent in handle_buffer {[], state} - defp set_current_pts(%{generate_best_effort_timestamps?: true, pts_current: nil} = state, _input_pts) do - %{state | pts_current: 0} + defp set_current_pts(%{generate_best_effort_timestamps?: true, current_pts: nil} = state, _input_pts) do + %{state | current_pts: 0} end defp set_current_pts(%{generate_best_effort_timestamps?: false, queue: <<>>} = state, input_pts) do - %{state | pts_current: input_pts} + %{state | current_pts: input_pts} end defp set_current_pts(state, _input_pts), do: state @@ -99,9 +99,9 @@ check_pts_integrity? = state.queue != <<>> and not state.generate_best_effort_ti set_current_pts(state, input_pts) ) do {:ok, queue, packets, channels, state} -> -if check_pts_integrity? and length(packets) >= 2 and Enum.at(packets, 1).pts != input_pts do - raise "PTS values are not continuous" -end + if check_pts_integrity? and length(packets) >= 2 and Enum.at(packets, 1).pts != input_pts do + raise "PTS values are not continuous" + end stream_format = %Opus{ self_delimiting?: self_delimiting?, @@ -129,17 +129,6 @@ end end end - defp check_pts_integrity(true = _flag, %Buffer{pts: pts}, input_pts) do - if pts != input_pts do - raise """ - PTS values are not continuous - """ - end - end - - defp check_pts_integrity(false = _flag, %Buffer{pts: _pts}, _input_pts) do - end - defp maybe_parse( data, processor, @@ -167,18 +156,18 @@ end duration = elapsed_time(frame_lengths, frame_duration) packet = %Buffer{ - pts: state.pts_current, + pts: state.current_pts, payload: processor.process(raw_packet, frame_lengths, header_size), metadata: %{ duration: duration } } - updated_state = - if state.pts_current == nil do + state = + if state.current_pts == nil do state else - %{state | pts_current: state.pts_current + duration} + %{state | current_pts: state.current_pts + duration} end maybe_parse( @@ -186,7 +175,7 @@ end processor, [packet | packets], channels, - updated_state + state ) else {:error, :cont} -> diff --git a/test/membrane_opus/parser_test.exs b/test/membrane_opus/parser_test.exs index d7975dd..424f181 100644 --- a/test/membrane_opus/parser_test.exs +++ b/test/membrane_opus/parser_test.exs @@ -89,7 +89,7 @@ defmodule Membrane.Opus.Parser.ParserTest do } ] - defp buffer_from_fixture(fixtures, self_delimited? \\ false) do + defp buffers_from_fixtures(fixtures, self_delimited? \\ false) do Enum.map(fixtures, fn fixture -> %Buffer{ pts: fixture.pts, @@ -106,7 +106,7 @@ defmodule Membrane.Opus.Parser.ParserTest do test "non-self-delimiting input and output" do spec = [ child(:source, %Source{ - output: buffer_from_fixture(@fixtures), + output: buffers_from_fixtures(@fixtures), stream_format: %RemoteStream{type: :bytestream} }) |> child(:parser, Parser) @@ -121,7 +121,7 @@ defmodule Membrane.Opus.Parser.ParserTest do test "non-self-delimiting input, self-delimiting output" do spec = [ child(:source, %Source{ - output: buffer_from_fixture(@fixtures), + output: buffers_from_fixtures(@fixtures), stream_format: %RemoteStream{type: :bytestream} }) |> child(:parser, %Parser{delimitation: :delimit}) @@ -136,7 +136,7 @@ defmodule Membrane.Opus.Parser.ParserTest do test "self-delimiting input and output" do spec = [ child(:source, %Source{ - output: buffer_from_fixture(@fixtures, true), + output: buffers_from_fixtures(@fixtures, true), stream_format: %RemoteStream{type: :bytestream} }) |> child(:parser, %Parser{input_delimitted?: true}) @@ -151,7 +151,7 @@ defmodule Membrane.Opus.Parser.ParserTest do test "self-delimiting input, non-self-delimiting output" do spec = [ child(:source, %Source{ - output: buffer_from_fixture(@fixtures, true), + output: buffers_from_fixtures(@fixtures, true), stream_format: %RemoteStream{type: :bytestream} }) |> child(:parser, %Parser{delimitation: :undelimit, input_delimitted?: true}) @@ -165,7 +165,7 @@ defmodule Membrane.Opus.Parser.ParserTest do test "non-self-delimiting input and output, generate_best_effort_timestamps?" do spec = child(:source, %Source{ - output: buffer_from_fixture(@fixtures), + output: buffers_from_fixtures(@fixtures), stream_format: %RemoteStream{type: :bytestream} }) |> child(:parser, %Parser{generate_best_effort_timestamps?: true}) @@ -179,7 +179,7 @@ defmodule Membrane.Opus.Parser.ParserTest do test "non-self-delimiting input, self-delimiting output, generate_best_effort_timestamps?" do spec = [ child(:source, %Source{ - output: buffer_from_fixture(@fixtures), + output: buffers_from_fixtures(@fixtures), stream_format: %RemoteStream{type: :bytestream} }) |> child(:parser, %Parser{delimitation: :delimit, generate_best_effort_timestamps?: true}) @@ -194,7 +194,7 @@ defmodule Membrane.Opus.Parser.ParserTest do test "self-delimiting input and output, generate_best_effort_timestamps?" do spec = [ child(:source, %Source{ - output: buffer_from_fixture(@fixtures, true), + output: buffers_from_fixtures(@fixtures, true), stream_format: %RemoteStream{type: :bytestream} }) |> child(:parser, %Parser{input_delimitted?: true, generate_best_effort_timestamps?: true}) @@ -209,7 +209,7 @@ defmodule Membrane.Opus.Parser.ParserTest do test "self-delimiting input, non-self-delimiting output, generate_best_effort_timestamps?" do spec = [ child(:source, %Source{ - output: buffer_from_fixture(@fixtures, true), + output: buffers_from_fixtures(@fixtures, true), stream_format: %RemoteStream{type: :bytestream} }) |> child(:parser, %Parser{ From 8275ff8bd8b6536ac51c8ca176bbf406a1efb04a Mon Sep 17 00:00:00 2001 From: bartkrak Date: Mon, 15 Jan 2024 01:43:01 +0100 Subject: [PATCH 32/39] parser tests fix --- lib/membrane_opus/parser.ex | 9 +++++++-- test/membrane_opus/parser_test.exs | 21 +++++++++++++++------ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index 4c97141..ecb4c37 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -76,7 +76,12 @@ defmodule Membrane.Opus.Parser do def handle_stream_format(:input, _stream_format, _ctx, state) do # ignore stream_formats, they will be sent in handle_buffer {[], state} - defp set_current_pts(%{generate_best_effort_timestamps?: true, current_pts: nil} = state, _input_pts) do + end + + defp set_current_pts( + %{generate_best_effort_timestamps?: true, current_pts: nil} = state, + _input_pts + ) do %{state | current_pts: 0} end @@ -91,7 +96,7 @@ defmodule Membrane.Opus.Parser do {delimitation_processor, self_delimiting?} = Delimitation.get_processor(state.delimitation, state.input_delimitted?) -check_pts_integrity? = state.queue != <<>> and not state.generate_best_effort_timestamps? + check_pts_integrity? = state.queue != <<>> and not state.generate_best_effort_timestamps? case maybe_parse( state.queue <> data, diff --git a/test/membrane_opus/parser_test.exs b/test/membrane_opus/parser_test.exs index 424f181..f09f5af 100644 --- a/test/membrane_opus/parser_test.exs +++ b/test/membrane_opus/parser_test.exs @@ -89,10 +89,19 @@ defmodule Membrane.Opus.Parser.ParserTest do } ] - defp buffers_from_fixtures(fixtures, self_delimited? \\ false) do + defp buffers_from_fixtures( + fixtures, + self_delimited? \\ false, + generate_best_effort_timestamps? \\ false + ) do Enum.map(fixtures, fn fixture -> %Buffer{ - pts: fixture.pts, + pts: + if generate_best_effort_timestamps? do + nil + else + fixture.pts + end, payload: if self_delimited? do fixture.delimited @@ -165,7 +174,7 @@ defmodule Membrane.Opus.Parser.ParserTest do test "non-self-delimiting input and output, generate_best_effort_timestamps?" do spec = child(:source, %Source{ - output: buffers_from_fixtures(@fixtures), + output: buffers_from_fixtures(@fixtures, false, true), stream_format: %RemoteStream{type: :bytestream} }) |> child(:parser, %Parser{generate_best_effort_timestamps?: true}) @@ -179,7 +188,7 @@ defmodule Membrane.Opus.Parser.ParserTest do test "non-self-delimiting input, self-delimiting output, generate_best_effort_timestamps?" do spec = [ child(:source, %Source{ - output: buffers_from_fixtures(@fixtures), + output: buffers_from_fixtures(@fixtures, false, true), stream_format: %RemoteStream{type: :bytestream} }) |> child(:parser, %Parser{delimitation: :delimit, generate_best_effort_timestamps?: true}) @@ -194,7 +203,7 @@ defmodule Membrane.Opus.Parser.ParserTest do test "self-delimiting input and output, generate_best_effort_timestamps?" do spec = [ child(:source, %Source{ - output: buffers_from_fixtures(@fixtures, true), + output: buffers_from_fixtures(@fixtures, true, true), stream_format: %RemoteStream{type: :bytestream} }) |> child(:parser, %Parser{input_delimitted?: true, generate_best_effort_timestamps?: true}) @@ -209,7 +218,7 @@ defmodule Membrane.Opus.Parser.ParserTest do test "self-delimiting input, non-self-delimiting output, generate_best_effort_timestamps?" do spec = [ child(:source, %Source{ - output: buffers_from_fixtures(@fixtures, true), + output: buffers_from_fixtures(@fixtures, true, true), stream_format: %RemoteStream{type: :bytestream} }) |> child(:parser, %Parser{ From 7f60ce1fb8433c205723c77e7327adc4550a9236 Mon Sep 17 00:00:00 2001 From: bartkrak Date: Mon, 15 Jan 2024 13:12:39 +0100 Subject: [PATCH 33/39] check_pts_integrity complexity fix --- lib/membrane_opus/parser.ex | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index ecb4c37..444895a 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -104,9 +104,7 @@ defmodule Membrane.Opus.Parser do set_current_pts(state, input_pts) ) do {:ok, queue, packets, channels, state} -> - if check_pts_integrity? and length(packets) >= 2 and Enum.at(packets, 1).pts != input_pts do - raise "PTS values are not continuous" - end + check_pts_integrity(check_pts_integrity?, packets, input_pts) stream_format = %Opus{ self_delimiting?: self_delimiting?, @@ -134,6 +132,16 @@ defmodule Membrane.Opus.Parser do end end + defp check_pts_integrity(true = _check_pts_integrity?, packets, input_pts) do + if length(packets) >= 2 and Enum.at(packets, 1).pts != input_pts do + raise "PTS values are not continuous" + end + end + + defp check_pts_integrity(_check_pts_integrity?, _packets, _input_pts) do + :ok + end + defp maybe_parse( data, processor, From b71b6cc1a708bc0792e90e40dbe8c41ca365f7b0 Mon Sep 17 00:00:00 2001 From: bartkrak Date: Mon, 15 Jan 2024 14:37:39 +0100 Subject: [PATCH 34/39] credo update, little refactor --- lib/membrane_opus/parser.ex | 66 ++++++++++++++++--------------------- mix.lock | 6 ++-- 2 files changed, 31 insertions(+), 41 deletions(-) diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index 444895a..6801df8 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -98,48 +98,38 @@ defmodule Membrane.Opus.Parser do check_pts_integrity? = state.queue != <<>> and not state.generate_best_effort_timestamps? - case maybe_parse( - state.queue <> data, - delimitation_processor, - set_current_pts(state, input_pts) - ) do - {:ok, queue, packets, channels, state} -> - check_pts_integrity(check_pts_integrity?, packets, input_pts) - - stream_format = %Opus{ - self_delimiting?: self_delimiting?, - channels: channels - } - - packets_len = length(packets) + {:ok, queue, packets, channels, state} = + maybe_parse( + state.queue <> data, + delimitation_processor, + set_current_pts(state, input_pts) + ) - packet_actions = - cond do - packets_len > 0 and stream_format != ctx.pads.output.stream_format -> - [stream_format: {:output, stream_format}, buffer: {:output, packets}] + if check_pts_integrity? and length(packets) >= 2 and + Enum.at(packets, 1).pts != input_pts do + raise "PTS values are not continuous" + end - packets_len > 0 -> - [buffer: {:output, packets}] + stream_format = %Opus{ + self_delimiting?: self_delimiting?, + channels: channels + } - true -> - [] - end + packets_len = length(packets) - {packet_actions, %{state | queue: queue}} + packet_actions = + cond do + packets_len > 0 and stream_format != ctx.pads.output.stream_format -> + [stream_format: {:output, stream_format}, buffer: {:output, packets}] - :error -> - {{:error, "An error occured in parsing"}, state} - end - end + packets_len > 0 -> + [buffer: {:output, packets}] - defp check_pts_integrity(true = _check_pts_integrity?, packets, input_pts) do - if length(packets) >= 2 and Enum.at(packets, 1).pts != input_pts do - raise "PTS values are not continuous" - end - end + true -> + [] + end - defp check_pts_integrity(_check_pts_integrity?, _packets, _input_pts) do - :ok + {packet_actions, %{state | queue: queue}} end defp maybe_parse( @@ -191,11 +181,11 @@ defmodule Membrane.Opus.Parser do state ) else + :error -> + raise "An error occured in parsing" + {:error, :cont} -> {:ok, data, packets |> Enum.reverse(), channels, state} - - :error -> - :error end end diff --git a/mix.lock b/mix.lock index 82e56bc..30ff21a 100644 --- a/mix.lock +++ b/mix.lock @@ -3,16 +3,16 @@ "bunch": {:hex, :bunch, "1.6.1", "5393d827a64d5f846092703441ea50e65bc09f37fd8e320878f13e63d410aec7", [:mix], [], "hexpm", "286cc3add551628b30605efbe2fca4e38cc1bea89bcd0a1a7226920b3364fe4a"}, "bunch_native": {:hex, :bunch_native, "0.5.0", "8ac1536789a597599c10b652e0b526d8833348c19e4739a0759a2bedfd924e63", [:mix], [{:bundlex, "~> 1.0", [hex: :bundlex, repo: "hexpm", optional: false]}], "hexpm", "24190c760e32b23b36edeb2dc4852515c7c5b3b8675b1a864e0715bdd1c8f80d"}, "bundlex": {:hex, :bundlex, "1.4.1", "60702b7f8e036a00c88bec69993329cc4aae32fe402804fe2e8db0c1e1396cd6", [:mix], [{:bunch, "~> 1.0", [hex: :bunch, repo: "hexpm", optional: false]}, {:elixir_uuid, "~> 1.2", [hex: :elixir_uuid, repo: "hexpm", optional: false]}, {:qex, "~> 0.5", [hex: :qex, repo: "hexpm", optional: false]}, {:req, "~> 0.4.0", [hex: :req, repo: "hexpm", optional: false]}, {:zarex, "~> 1.0", [hex: :zarex, repo: "hexpm", optional: false]}], "hexpm", "7511718b4b8063e457f3fa5166df177beff65c532db44631f41b496cfa2f48a3"}, - "bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"}, + "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, "castore": {:hex, :castore, "1.0.5", "9eeebb394cc9a0f3ae56b813459f990abb0a3dedee1be6b27fdb50301930502f", [:mix], [], "hexpm", "8d7c597c3e4a64c395980882d4bca3cebb8d74197c590dc272cfd3b6a6310578"}, "coerce": {:hex, :coerce, "1.0.1", "211c27386315dc2894ac11bc1f413a0e38505d808153367bd5c6e75a4003d096", [:mix], [], "hexpm", "b44a691700f7a1a15b4b7e2ff1fa30bebd669929ac8aa43cffe9e2f8bf051cf1"}, - "credo": {:hex, :credo, "1.7.1", "6e26bbcc9e22eefbff7e43188e69924e78818e2fe6282487d0703652bc20fd62", [:mix], [{:bunt, "~> 0.2.1", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "e9871c6095a4c0381c89b6aa98bc6260a8ba6addccf7f6a53da8849c748a58a2"}, + "credo": {:hex, :credo, "1.7.3", "05bb11eaf2f2b8db370ecaa6a6bda2ec49b2acd5e0418bc106b73b07128c0436", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "35ea675a094c934c22fb1dca3696f3c31f2728ae6ef5a53b5d648c11180a4535"}, "dialyxir": {:hex, :dialyxir, "1.4.2", "764a6e8e7a354f0ba95d58418178d486065ead1f69ad89782817c296d0d746a5", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "516603d8067b2fd585319e4b13d3674ad4f314a5902ba8130cd97dc902ce6bbd"}, "earmark_parser": {:hex, :earmark_parser, "1.4.39", "424642f8335b05bb9eb611aa1564c148a8ee35c9c8a8bba6e129d51a3e3c6769", [:mix], [], "hexpm", "06553a88d1f1846da9ef066b87b57c6f605552cfbe40d20bd8d59cc6bde41944"}, "elixir_uuid": {:hex, :elixir_uuid, "1.2.1", "dce506597acb7e6b0daeaff52ff6a9043f5919a4c3315abb4143f0b00378c097", [:mix], [], "hexpm", "f7eba2ea6c3555cea09706492716b0d87397b88946e6380898c2889d68585752"}, "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, "ex_doc": {:hex, :ex_doc, "0.31.0", "06eb1dfd787445d9cab9a45088405593dd3bb7fe99e097eaa71f37ba80c7a676", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.1", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "5350cafa6b7f77bdd107aa2199fe277acf29d739aba5aee7e865fc680c62a110"}, - "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, + "file_system": {:hex, :file_system, "1.0.0", "b689cc7dcee665f774de94b5a832e578bd7963c8e637ef940cd44327db7de2cd", [:mix], [], "hexpm", "6752092d66aec5a10e662aefeed8ddb9531d79db0bc145bb8c40325ca1d8536d"}, "finch": {:hex, :finch, "0.16.0", "40733f02c89f94a112518071c0a91fe86069560f5dbdb39f9150042f44dcfb1a", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.3", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.2.6 or ~> 1.0", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "f660174c4d519e5fec629016054d60edd822cdfe2b7270836739ac2f97735ec5"}, "hpax": {:hex, :hpax, "0.1.2", "09a75600d9d8bbd064cdd741f21fc06fc1f4cf3d0fcc335e5aa19be1a7235c84", [:mix], [], "hexpm", "2c87843d5a23f5f16748ebe77969880e29809580efdaccd615cd3bed628a8c13"}, "jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"}, From 41341d92fe5afe2a4d7259588451f0d17f13e1d6 Mon Sep 17 00:00:00 2001 From: bartkrak Date: Mon, 15 Jan 2024 18:21:08 +0100 Subject: [PATCH 35/39] encoder fix, gitignore --- .gitignore | 2 +- .vscode/settings.json | 0 lib/membrane_opus/encoder.ex | 39 ++++++++++++------------------------ 3 files changed, 14 insertions(+), 27 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index 324f6fa..602996f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ compile_commands.json .gdb_history bundlex.sh bundlex.bat - +.vscode/ # Dir generated by tmp_dir ExUnit tag /tmp/ diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index e69de29..0000000 diff --git a/lib/membrane_opus/encoder.ex b/lib/membrane_opus/encoder.ex index ee37071..1805a7f 100644 --- a/lib/membrane_opus/encoder.ex +++ b/lib/membrane_opus/encoder.ex @@ -132,25 +132,19 @@ defmodule Membrane.Opus.Encoder do """ end + defp set_current_pts(%{queue: <<>>} = state, input_pts) do + %{state | current_pts: input_pts} + end + + defp set_current_pts(state, _input_pts), do: state + @impl true def handle_buffer(:input, %Buffer{payload: data, pts: input_pts}, _ctx, state) do - prepared_state = - if state.queue == <<>> do - %{state | current_pts: input_pts} - else - state - end - - check_pts_integrity_flag = - if state.queue != <<>> do - true - else - false - end + check_pts_integrity? = state.queue != <<>> case encode_buffer( state.queue <> data, - prepared_state, + set_current_pts(state, input_pts), frame_size_in_bytes(state) ) do {:ok, [], state} -> @@ -159,22 +153,15 @@ defmodule Membrane.Opus.Encoder do {:ok, encoded_buffers, state} -> # something was encoded - check_pts_integrity(check_pts_integrity_flag, List.first(encoded_buffers), input_pts) - {[buffer: {:output, encoded_buffers}], state} - end - end + if check_pts_integrity? and length(encoded_buffers) >= 2 and + Enum.at(encoded_buffers, 1).pts != input_pts do + raise "PTS values are not continuous" + end - defp check_pts_integrity(true = _flag, %Buffer{pts: pts}, input_pts) do - if pts != input_pts do - raise """ - PTS values are not continuous - """ + {[buffer: {:output, encoded_buffers}], state} end end - defp check_pts_integrity(false = _flag, %Buffer{pts: _pts}, _input_pts) do - end - @impl true def handle_end_of_stream(:input, _ctx, state) do actions = [end_of_stream: :output] From 490939678c4b4d66d7131268b7a24a56b489a304 Mon Sep 17 00:00:00 2001 From: bartkrak Date: Wed, 17 Jan 2024 15:04:29 +0100 Subject: [PATCH 36/39] pts overlapping values fix --- lib/membrane_opus/encoder.ex | 4 ++-- lib/membrane_opus/parser.ex | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/membrane_opus/encoder.ex b/lib/membrane_opus/encoder.ex index 1805a7f..491baab 100644 --- a/lib/membrane_opus/encoder.ex +++ b/lib/membrane_opus/encoder.ex @@ -154,8 +154,8 @@ defmodule Membrane.Opus.Encoder do {:ok, encoded_buffers, state} -> # something was encoded if check_pts_integrity? and length(encoded_buffers) >= 2 and - Enum.at(encoded_buffers, 1).pts != input_pts do - raise "PTS values are not continuous" + Enum.at(encoded_buffers, 1).pts > input_pts do + raise "PTS values are overlapping" end {[buffer: {:output, encoded_buffers}], state} diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index 6801df8..fb0fdc1 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -106,8 +106,8 @@ defmodule Membrane.Opus.Parser do ) if check_pts_integrity? and length(packets) >= 2 and - Enum.at(packets, 1).pts != input_pts do - raise "PTS values are not continuous" + Enum.at(packets, 1).pts > input_pts do + raise "PTS values are overlapping" end stream_format = %Opus{ From 1ac385b8825e58af4a4dd6c5a5652d8318fa8e03 Mon Sep 17 00:00:00 2001 From: bartkrak Date: Wed, 17 Jan 2024 15:14:26 +0100 Subject: [PATCH 37/39] pts overlapping warning --- lib/membrane_opus/encoder.ex | 2 +- lib/membrane_opus/parser.ex | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/membrane_opus/encoder.ex b/lib/membrane_opus/encoder.ex index 491baab..6759b85 100644 --- a/lib/membrane_opus/encoder.ex +++ b/lib/membrane_opus/encoder.ex @@ -155,7 +155,7 @@ defmodule Membrane.Opus.Encoder do # something was encoded if check_pts_integrity? and length(encoded_buffers) >= 2 and Enum.at(encoded_buffers, 1).pts > input_pts do - raise "PTS values are overlapping" + Membrane.Logger.warning("PTS values are overlapping") end {[buffer: {:output, encoded_buffers}], state} diff --git a/lib/membrane_opus/parser.ex b/lib/membrane_opus/parser.ex index fb0fdc1..0f07c94 100644 --- a/lib/membrane_opus/parser.ex +++ b/lib/membrane_opus/parser.ex @@ -9,7 +9,7 @@ defmodule Membrane.Opus.Parser do """ use Membrane.Filter - + require Membrane.Logger alias __MODULE__.{Delimitation, FrameLengths} alias Membrane.{Buffer, Opus, RemoteStream} alias Membrane.Opus.Util @@ -107,7 +107,7 @@ defmodule Membrane.Opus.Parser do if check_pts_integrity? and length(packets) >= 2 and Enum.at(packets, 1).pts > input_pts do - raise "PTS values are overlapping" + Membrane.Logger.warning("PTS values are overlapping") end stream_format = %Opus{ From ad0abdc4d2d83589546e5b17d9a9fe211a59a710 Mon Sep 17 00:00:00 2001 From: bartkrak Date: Wed, 17 Jan 2024 17:02:37 +0100 Subject: [PATCH 38/39] code readability fix --- lib/membrane_opus/encoder.ex | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/membrane_opus/encoder.ex b/lib/membrane_opus/encoder.ex index 6759b85..88079aa 100644 --- a/lib/membrane_opus/encoder.ex +++ b/lib/membrane_opus/encoder.ex @@ -132,12 +132,6 @@ defmodule Membrane.Opus.Encoder do """ end - defp set_current_pts(%{queue: <<>>} = state, input_pts) do - %{state | current_pts: input_pts} - end - - defp set_current_pts(state, _input_pts), do: state - @impl true def handle_buffer(:input, %Buffer{payload: data, pts: input_pts}, _ctx, state) do check_pts_integrity? = state.queue != <<>> @@ -178,6 +172,12 @@ defmodule Membrane.Opus.Encoder do end end + defp set_current_pts(%{queue: <<>>} = state, input_pts) do + %{state | current_pts: input_pts} + end + + defp set_current_pts(state, _input_pts), do: state + defp mk_native!(state) do with {:ok, channels} <- validate_channels(state.input_stream_format.channels), {:ok, input_rate} <- validate_sample_rate(state.input_stream_format.sample_rate), From aa4cdca0a6137252684c55d00acee29ccce0759f Mon Sep 17 00:00:00 2001 From: bartkrak Date: Wed, 17 Jan 2024 17:06:22 +0100 Subject: [PATCH 39/39] version bump --- README.md | 2 +- mix.exs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 21cf166..af4780e 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.1"} + {:membrane_opus_plugin, "~> 0.19.2"} ] end ``` diff --git a/mix.exs b/mix.exs index 9b1ef3d..a1a80c5 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Membrane.Opus.Plugin.Mixfile do use Mix.Project - @version "0.19.1" + @version "0.19.2" @github_url "https://github.com/membraneframework/membrane_opus_plugin" def project do