Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pure Elixir G.711 implementation #1

Merged
merged 5 commits into from
Jan 2, 2024
Merged

Pure Elixir G.711 implementation #1

merged 5 commits into from
Jan 2, 2024

Conversation

sgfn
Copy link
Member

@sgfn sgfn commented Dec 27, 2023

No description provided.

examples/decode_example.exs Outdated Show resolved Hide resolved
examples/encode_example.exs Outdated Show resolved Hide resolved
lib/membrane_g711/decoder.ex Outdated Show resolved Hide resolved
lib/membrane_g711/lut_builder.ex Outdated Show resolved Hide resolved
lib/membrane_g711/lut_builder.ex Outdated Show resolved Hide resolved
lib/membrane_g711/lut_builder.ex Outdated Show resolved Hide resolved
lib/membrane_g711/lut_builder.ex Outdated Show resolved Hide resolved
test/decoder_test.exs Show resolved Hide resolved
test/encoder_test.exs Show resolved Hide resolved
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these tests look pretty the same. Maybe we could think about using the table-driven pattern here (it is mostly used in Golang)? (Some resources about table-driven tests 1, 2.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dunno if that's what you had in mind, but I've done something to alleviate the code duplication

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought more of things like this:

  test_cases = [
    {"adds timestamps",@stream_format, %Parser{overwrite_pts?: true}, 0}
    {"adds timestamps with offset",@stream_format, %Parser{overwrite_pts?: true, pts_offset: 10}, 10},
    {"can have `RemoteStream` as input",%RemoteStream{}, %Parser{stream_format: @stream_format}, 0},
  ]

  for {test_name, source_stream_format,parser, offset} <- test_cases do 
    test "parser #{test_name}" do 
      ...
    end
  end

But I think that for start this is good enough.

@sgfn sgfn requested a review from Rados13 December 28, 2023 14:21
lib/membrane_g711/encoder.ex Show resolved Hide resolved
lib/membrane_g711/encoder.ex Outdated Show resolved Hide resolved
lib/membrane_g711/lut_builder.ex Outdated Show resolved Hide resolved
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought more of things like this:

  test_cases = [
    {"adds timestamps",@stream_format, %Parser{overwrite_pts?: true}, 0}
    {"adds timestamps with offset",@stream_format, %Parser{overwrite_pts?: true, pts_offset: 10}, 10},
    {"can have `RemoteStream` as input",%RemoteStream{}, %Parser{stream_format: @stream_format}, 0},
  ]

  for {test_name, source_stream_format,parser, offset} <- test_cases do 
    test "parser #{test_name}" do 
      ...
    end
  end

But I think that for start this is good enough.

@sgfn sgfn requested a review from Rados13 December 29, 2023 13:12
@sgfn sgfn merged commit 394a170 into main Jan 2, 2024
4 checks passed
@sgfn sgfn deleted the sgfn/initial branch January 2, 2024 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants