From 95e97c467a82063591d8d0ed72fad774077c792d Mon Sep 17 00:00:00 2001 From: jb-alvarado Date: Wed, 31 Jan 2024 18:36:34 +0100 Subject: [PATCH] change init with seek value, fix #511, #507 --- ffplayout-engine/src/input/playlist.rs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/ffplayout-engine/src/input/playlist.rs b/ffplayout-engine/src/input/playlist.rs index efaaf8a4..ca07ede5 100644 --- a/ffplayout-engine/src/input/playlist.rs +++ b/ffplayout-engine/src/input/playlist.rs @@ -308,7 +308,8 @@ impl CurrentProgram { drop(nodes); node_clone.seek = time_sec - - (node_clone.begin.unwrap() - *self.playout_stat.time_shift.lock().unwrap()); + - (node_clone.begin.unwrap() - *self.playout_stat.time_shift.lock().unwrap()) + + node_clone.seek; self.current_node = handle_list_init( &self.config, @@ -662,11 +663,14 @@ pub fn gen_source( // separate if condition, because of node.add_probe() in last condition if node.probe.is_some() { - if node.seek > 0.0 { - node.seek = node.seek - 1.0; - } else { - node.out = node.out + 1.0; + if node.out - node.seek < 1.0 { + if node.seek > 1.0 { + node.seek = node.seek - 1.0; + } else { + node.out = node.out + 1.0; + } } + if node .source .rsplit_once('.') @@ -769,7 +773,12 @@ pub fn gen_source( node.add_filter(config, &playout_stat.chain); - trace!("return gen_source: {}", node.source); + trace!( + "return gen_source: {}, seek: {}, out: {}", + node.source, + node.seek, + node.out + ); node }