Skip to content

Commit

Permalink
Fix first sync
Browse files Browse the repository at this point in the history
  • Loading branch information
philipgiuliani committed Oct 1, 2024
1 parent a391a1a commit c62e67b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions lib/membrane/hls/sink_bin.ex
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,9 @@ defmodule Membrane.HLS.SinkBin do
end

def handle_info(:sync, _ctx, state) do
Membrane.Logger.debug("Packager: syncing playlists up to #{state.live_state.next_sync_point}")
Membrane.Logger.debug(
"Packager: syncing playlists up to #{state.live_state.next_sync_point}s"
)

Agent.update(state.packager_pid, fn p ->
Packager.sync(p, state.live_state.next_sync_point)
Expand Down Expand Up @@ -299,7 +301,7 @@ defmodule Membrane.HLS.SinkBin do
state =
state
|> update_in([:live_state, :next_sync_point], fn x ->
x + state.opts.target_segment_duration
x + Membrane.Time.as_seconds(state.opts.target_segment_duration, :round)
end)
|> update_in([:live_state, :next_deadline], fn x ->
x + Membrane.Time.as_milliseconds(state.opts.target_segment_duration, :round)
Expand All @@ -314,7 +316,10 @@ defmodule Membrane.HLS.SinkBin do
next_sync_point =
Agent.get(
state.packager_pid,
&Packager.next_sync_point(&1, state.opts.target_segment_duration)
&Packager.next_sync_point(
&1,
Membrane.Time.as_seconds(state.opts.target_segment_duration, :round)
)
)

{:live, safety_delay} = state.opts.mode
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"bunch": {:hex, :bunch, "1.6.1", "5393d827a64d5f846092703441ea50e65bc09f37fd8e320878f13e63d410aec7", [:mix], [], "hexpm", "286cc3add551628b30605efbe2fca4e38cc1bea89bcd0a1a7226920b3364fe4a"},
"coerce": {:hex, :coerce, "1.0.1", "211c27386315dc2894ac11bc1f413a0e38505d808153367bd5c6e75a4003d096", [:mix], [], "hexpm", "b44a691700f7a1a15b4b7e2ff1fa30bebd669929ac8aa43cffe9e2f8bf051cf1"},
"heap": {:hex, :heap, "2.0.2", "d98cb178286cfeb5edbcf17785e2d20af73ca57b5a2cf4af584118afbcf917eb", [:mix], [], "hexpm", "ba9ea2fe99eb4bcbd9a8a28eaf71cbcac449ca1d8e71731596aace9028c9d429"},
"kim_hls": {:git, "https://github.com/kim-company/kim_hls.git", "1c02786b742e561426d89eff5684f616666fdc59", []},
"kim_hls": {:git, "https://github.com/kim-company/kim_hls.git", "a33c2f2e1d6480b75ebd8ba1b15e20cf7ff3f55c", []},
"kim_q": {:hex, :kim_q, "1.0.0", "17cfc45e9f7e65485f0f31bbf09893d6ff35cc2fbefc39aed146a3c29740584e", [:mix], [{:qex, "~> 0.5", [hex: :qex, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.1", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7a8ee76a2c2e774c34345df3c7a234a8effeedc3f3aea845feb7c09030097278"},
"kim_subtitle": {:git, "https://github.com/kim-company/kim_subtitle.git", "8239e1bcea938167829a6b8bd2a9678c63c7bdd4", []},
"logger_backends": {:hex, :logger_backends, "1.0.0", "09c4fad6202e08cb0fbd37f328282f16539aca380f512523ce9472b28edc6bdf", [:mix], [], "hexpm", "1faceb3e7ec3ef66a8f5746c5afd020e63996df6fd4eb8cdb789e5665ae6c9ce"},
Expand Down

0 comments on commit c62e67b

Please sign in to comment.