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

Use pts in Membrane.Buffer instead of timestamp in metadata #10

Merged
merged 1 commit into from
May 16, 2022
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 lib/deserializer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ defmodule Membrane.Element.IVF.Deserializer do
Headers.parse_ivf_frame_header(payload),
<<frame::binary-size(size_of_frame), rest::binary()>> <- rest do
timestamp = timestamp * (timebase * Time.second())
{:ok, %Buffer{metadata: %{timestamp: timestamp}, payload: frame}, rest}
{:ok, %Buffer{pts: timestamp, payload: frame}, rest}
else
_error -> {:error_too_short, payload}
end
Expand Down
2 changes: 1 addition & 1 deletion lib/serializer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ defmodule Membrane.Element.IVF.Serializer do

@impl true
def handle_process(:input, buffer, ctx, state) do
%Buffer{payload: frame, metadata: %{timestamp: timestamp}} = buffer
%Buffer{payload: frame, pts: timestamp} = buffer

ivf_frame =
IVF.Headers.create_ivf_frame_header(byte_size(frame), timestamp, state.timebase) <>
Expand Down
Binary file modified test/fixtures/capture.dump
Binary file not shown.
4 changes: 2 additions & 2 deletions test/serializer_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ defmodule Membrane.Element.IVF.SerializerTest do
correctly calculates timestamp in frame header.
"""
test "appends headers correctly" do
buffer_1 = %Buffer{payload: @frame, metadata: %{timestamp: 0}}
buffer_2 = %Buffer{payload: @frame, metadata: %{timestamp: 100_000_000 <|> 3}}
buffer_1 = %Buffer{payload: @frame, pts: 0}
buffer_2 = %Buffer{payload: @frame, pts: 100_000_000 <|> 3}
Copy link
Member

Choose a reason for hiding this comment

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

we no longer accept ratio as the timestamp

Copy link
Member Author

Choose a reason for hiding this comment

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

I have created issue for this - MV-71


{:ok, pipeline} =
[
Expand Down