Skip to content

Commit

Permalink
Merge pull request #53 from membraneframework/v0.18
Browse files Browse the repository at this point in the history
V0.18
  • Loading branch information
bartkrak authored Jan 23, 2024
2 parents 42bcb80 + 67fafd3 commit 7d272df
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The package can be installed by adding `membrane_aac_fdk_plugin` to your list of
```elixir
def deps do
[
{:membrane_aac_fdk_plugin, "~> 0.18.4"}
{:membrane_aac_fdk_plugin, "~> 0.18.5"}
]
end
```
Expand Down
26 changes: 22 additions & 4 deletions lib/membrane_aac_fdk_plugin/encoder.ex
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ defmodule Membrane.AAC.FDK.Encoder do
encapsulation: :ADTS
}

{[stream_format: {:output, out_format}], %{state | native: native}}
{[stream_format: {:output, out_format}],
Map.merge(state, %{
native: native,
input_stream_format: format
})}
end

@impl true
Expand All @@ -157,9 +161,8 @@ defmodule Membrane.AAC.FDK.Encoder do
{encoded_buffers, bytes_used, state} when bytes_used > 0 ->
<<_handled::binary-size(bytes_used), rest::binary>> = to_encode

if check_pts_integrity? and length(encoded_buffers) >= 2 and
Enum.at(encoded_buffers, 1).pts > input_pts do
Membrane.Logger.warning("PTS values are overlapping")
if check_pts_integrity? do
validate_pts_integrity(encoded_buffers, input_pts)
end

{[buffer: {:output, encoded_buffers}], %{state | queue: rest}}
Expand Down Expand Up @@ -270,4 +273,19 @@ defmodule Membrane.AAC.FDK.Encoder do
defp validate_bitrate_mode!(bitrate_mode) do
raise "Invalid bitrate_mode: #{inspect(bitrate_mode)}"
end

defp validate_pts_integrity(packets, input_pts) do
cond do
length(packets) < 2 or Enum.at(packets, 1).pts == input_pts ->
:ok

Enum.at(packets, 1).pts > input_pts ->
Membrane.Logger.warning("PTS values are overlapping")
:ok

Enum.at(packets, 1).pts < input_pts ->
Membrane.Logger.warning("PTS values are not continous")
:ok
end
end
end
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Membrane.AAC.FDK.Plugin.MixProject do
use Mix.Project

@version "0.18.4"
@version "0.18.5"
@github_url "https://github.com/membraneframework/membrane_aac_fdk_plugin"

def project do
Expand Down

0 comments on commit 7d272df

Please sign in to comment.