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

Remove redundant pts integrity check. Bump to v0.20.4 #65

Merged
merged 3 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.20.3"}
{:membrane_opus_plugin, "~> 0.20.4"}
]
end
```
Expand Down
30 changes: 10 additions & 20 deletions lib/membrane_opus/encoder.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ defmodule Membrane.Opus.Encoder do
require Membrane.Logger

alias __MODULE__.Native
alias Membrane.Opus.Util
alias Membrane.{Buffer, Opus, RawAudio, Time}

@allowed_channels [1, 2]
Expand Down Expand Up @@ -133,25 +132,16 @@ defmodule Membrane.Opus.Encoder do

@impl true
def handle_buffer(:input, %Buffer{payload: data, pts: input_pts}, _ctx, state) do
check_pts_integrity? = state.queue != <<>>

case encode_buffer(
state.queue <> data,
set_current_pts(state, input_pts),
frame_size_in_bytes(state)
) do
{:ok, [], state} ->
# nothing was encoded
{[], state}

{:ok, encoded_buffers, state} ->
# something was encoded
if check_pts_integrity? do
Util.validate_pts_integrity(encoded_buffers, input_pts)
end

{[buffer: {:output, encoded_buffers}], state}
end
{:ok, encoded_buffers, state} =
encode_buffer(
state.queue <> data,
set_current_pts(state, input_pts),
frame_size_in_bytes(state)
)

actions = Enum.map(encoded_buffers, &{:buffer, {:output, &1}})

{actions, state}
end

@impl true
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Membrane.Opus.Plugin.Mixfile do
use Mix.Project

@version "0.20.3"
@version "0.20.4"
@github_url "https://github.com/membraneframework/membrane_opus_plugin"

def project do
Expand Down