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

Allow selecting synchronization strategy #5

Merged
merged 7 commits into from
Apr 23, 2024

Conversation

FelonEkonom
Copy link
Member

@FelonEkonom FelonEkonom commented Apr 18, 2024

@FelonEkonom FelonEkonom self-assigned this Apr 18, 2024
@FelonEkonom FelonEkonom force-pushed the synchronization-strategies branch from a4ae20a to be774a0 Compare April 18, 2024 14:56
@FelonEkonom FelonEkonom requested a review from varsill April 18, 2024 15:07
@FelonEkonom FelonEkonom changed the title Create API allowing select synchronization strategy Allow selecting synchronization strategy Apr 18, 2024
@FelonEkonom FelonEkonom requested a review from mat-hek April 19, 2024 14:34
@FelonEkonom FelonEkonom marked this pull request as ready for review April 19, 2024 14:34
lib/membrane/timestamp_queue.ex Show resolved Hide resolved
Comment on lines 332 to 343
{{:buffer, buffer}, nil} ->
priority =
case timestamp_queue.synchronization_strategy do
:synchronize_on_arrival ->
-timestamp_queue.current_queue_time

:explicit_offsets ->
offset = Map.get(timestamp_queue.registered_pads_offsets, pad_ref, 0)
offset - (buffer.dts || buffer.pts)
end

push_pad_on_heap(timestamp_queue, pad_ref, priority)
Copy link
Member

Choose a reason for hiding this comment

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

As we spoke, let's move that to push_buffer

Comment on lines 202 to 209
nil when timestamp_queue.synchronization_strategy == :synchronize_on_arrival ->
(buffer.dts || buffer.pts) - timestamp_queue.current_queue_time

nil when timestamp_queue.synchronization_strategy == :explicit_offsets ->
Map.get(timestamp_queue.registered_pads_offsets, pad_ref, 0)

valid_offset ->
valid_offset
Copy link
Member

Choose a reason for hiding this comment

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

let's handle the first buffer separately

@FelonEkonom FelonEkonom force-pushed the synchronization-strategies branch from 3053c4e to 6e10e05 Compare April 22, 2024 15:21
@FelonEkonom FelonEkonom requested a review from mat-hek April 22, 2024 15:21
@@ -38,7 +38,7 @@ defmodule Membrane.TimestampQueue.Mixfile do
defp deps do
[
{:membrane_core, "~> 1.0"},
{:heap, "~> 3.0"},
{:heap, "~> 2.0"},
Copy link
Member

Choose a reason for hiding this comment

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

why this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because 3.0 has weird licence

@FelonEkonom FelonEkonom requested a review from mat-hek April 23, 2024 09:18
@FelonEkonom FelonEkonom merged commit 1b0418f into master Apr 23, 2024
3 checks passed
@FelonEkonom FelonEkonom deleted the synchronization-strategies branch April 23, 2024 09:20
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