Skip to content

Commit 9f96e42

Browse files
committed
Add workaround to 0. crossfade duration.
1 parent d520764 commit 9f96e42

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

CHANGES.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# 2.2.5 (unreleased)
2+
3+
Fixed:
4+
5+
- Handle invalid crossfade duration of `0.` seconds.
6+
7+
---
8+
19
# 2.2.4 (2024-02-04)
210

311
New:

dune-project

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
(homepage "https://github.com/savonet/liquidsoap")
1010
(bug_reports "https://github.com/savonet/liquidsoap/issues")
1111

12-
(version 2.2.4)
12+
(version 2.2.5)
1313
(generate_opam_files true)
1414
(executables_implicit_empty_intf true)
1515

src/core/operators/cross.ml

+8-4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class cross val_source ~duration_getter ~override_duration ~persist_override
4444
* Going with the same choice as above for now. *)
4545
method self_sync = s#self_sync
4646
val mutable cross_length = 0
47+
val mutable rejected_cross_length = None
4748
val mutable duration_getter = original_duration_getter
4849
method cross_duration = duration_getter ()
4950

@@ -52,12 +53,15 @@ class cross val_source ~duration_getter ~override_duration ~persist_override
5253
let main_new_cross_length = Frame.main_of_seconds new_cross_length in
5354

5455
if main_new_cross_length <> cross_length then
55-
if new_cross_length < 0. then
56-
self#log#important
57-
"Cannot set crossfade duration to negative value %f!"
58-
new_cross_length
56+
if new_cross_length <= 0. then (
57+
if rejected_cross_length <> Some new_cross_length then (
58+
self#log#critical "Invalid cross duration: %.2f <= 0.!"
59+
new_cross_length;
60+
rejected_cross_length <- Some new_cross_length);
61+
cross_length <- Lazy.force Frame.size)
5962
else (
6063
self#log#info "Setting crossfade duration to %.2fs" new_cross_length;
64+
rejected_cross_length <- None;
6165
cross_length <- main_new_cross_length)
6266

6367
initializer self#set_cross_length

0 commit comments

Comments
 (0)