Skip to content

Commit

Permalink
Release v0.14.0 (#60)
Browse files Browse the repository at this point in the history
* bump to 0.14.0

* update readme

* Fix deps

* Bump dependency to stream plugin

* Fix credo nesting warning

---------

Co-authored-by: Jakub Perżyło <[email protected]>
  • Loading branch information
FelonEkonom and Qizot authored Jun 27, 2023
1 parent 1181a25 commit f1efa5a
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 48 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The package can be installed by adding `membrane_rtmp_plugin` to your list of de
```elixir
def deps do
[
{:membrane_rtmp_plugin, "~> 0.13.2"}
{:membrane_rtmp_plugin, "~> 0.14.0"}
]
end
```
Expand Down
35 changes: 19 additions & 16 deletions lib/membrane_rtmp_plugin/rtmp/source/message_parser.ex
Original file line number Diff line number Diff line change
Expand Up @@ -141,22 +141,8 @@ defmodule Membrane.RTMP.MessageParser do

defp read_frame(packet, previous_headers, chunk_size) do
case Header.deserialize(packet, previous_headers) do
{%Header{body_size: body_size} = header, rest} ->
chunked_body_size =
if body_size > chunk_size do
# if a message's body is greater than the chunk size then
# after every chunk_size's bytes there is a 0x03 one byte header that
# needs to be stripped and is not counted into the body_size
headers_to_strip = div(body_size - 1, chunk_size)

# if the initial header contains a extended timestamp then
# every following chunk will contain the timestamp
timestamps_to_strip = if header.extended_timestamp?, do: headers_to_strip * 4, else: 0

body_size + headers_to_strip + timestamps_to_strip
else
body_size
end
{%Header{} = header, rest} ->
chunked_body_size = calculate_chunked_body_size(header, chunk_size)

case rest do
<<body::binary-size(chunked_body_size), rest::binary>> ->
Expand All @@ -175,6 +161,23 @@ defmodule Membrane.RTMP.MessageParser do
end
end

defp calculate_chunked_body_size(%Header{body_size: body_size} = header, chunk_size) do
if body_size > chunk_size do
# if a message's body is greater than the chunk size then
# after every chunk_size's bytes there is a 0x03 one byte header that
# needs to be stripped and is not counted into the body_size
headers_to_strip = div(body_size - 1, chunk_size)

# if the initial header contains a extended timestamp then
# every following chunk will contain the timestamp
timestamps_to_strip = if header.extended_timestamp?, do: headers_to_strip * 4, else: 0

body_size + headers_to_strip + timestamps_to_strip
else
body_size
end
end

# message's size can exceed the defined chunk size
# in this case the message gets divided into
# a sequence of smaller packets separated by the a header type 3 byte
Expand Down
18 changes: 9 additions & 9 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Membrane.RTMP.Mixfile do
use Mix.Project

@version "0.13.2"
@version "0.14.0"
@github_url "https://github.com/membraneframework/membrane_rtmp_plugin"

def project do
Expand Down Expand Up @@ -38,17 +38,17 @@ defmodule Membrane.RTMP.Mixfile do

defp deps do
[
{:membrane_core, "~> 0.11.2"},
{:membrane_core, "~> 0.12.3"},
{:unifex, "~> 1.1.0"},
{:membrane_h264_ffmpeg_plugin, "~> 0.25.4"},
{:membrane_aac_plugin, "~> 0.13.0"},
{:membrane_mp4_plugin, "~> 0.23.0"},
{:membrane_flv_plugin, "~> 0.5.0"},
{:membrane_file_plugin, "~> 0.13.2"},
{:membrane_h264_ffmpeg_plugin, "~> 0.27.0"},
{:membrane_aac_plugin, "~> 0.15.0"},
{:membrane_mp4_plugin, "~> 0.24.1"},
{:membrane_flv_plugin, "~> 0.7.0"},
{:membrane_file_plugin, "~> 0.14.0"},
# testing
{:membrane_hackney_plugin, "~> 0.9.0", only: :test},
{:membrane_hackney_plugin, "~> 0.10.0", only: :test},
{:ffmpex, "~> 0.10.0", only: :test},
{:membrane_stream_plugin, "~> 0.2.0", only: :test},
{:membrane_stream_plugin, "~> 0.3.1", only: :test},
# development
{:ex_doc, "~> 0.28", only: :dev, runtime: false},
{:dialyxir, "~> 1.1", only: :dev, runtime: false},
Expand Down
Loading

0 comments on commit f1efa5a

Please sign in to comment.