From 84f8fb8c0d0dbe52e6e449ae66c887804764c6e3 Mon Sep 17 00:00:00 2001 From: Wojciech Kozyra Date: Mon, 8 Apr 2024 12:55:47 +0200 Subject: [PATCH] Fix offline processing (+ send DELIVERED event before queue start) (#498) --- compositor_pipeline/src/queue/audio_queue.rs | 8 ++++---- compositor_pipeline/src/queue/video_queue.rs | 8 ++++---- src/config.rs | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/compositor_pipeline/src/queue/audio_queue.rs b/compositor_pipeline/src/queue/audio_queue.rs index 25a112254..bab6e7f44 100644 --- a/compositor_pipeline/src/queue/audio_queue.rs +++ b/compositor_pipeline/src/queue/audio_queue.rs @@ -278,13 +278,13 @@ impl AudioQueueInput { /// Drops samples that won't be used for processing. This function should only be called before /// queue start. fn drop_old_samples_before_start(&mut self) { - if self.offset.is_some() { - // if offset is defined never drop frames before start. + let Some(start_input_stream) = self.input_start_time() else { + // before first frame, so nothing to do return; }; - let Some(start_input_stream) = self.input_start_time() else { - // before first frame, so nothing to do + if self.offset.is_some() { + // if offset is defined never drop frames before start. return; }; diff --git a/compositor_pipeline/src/queue/video_queue.rs b/compositor_pipeline/src/queue/video_queue.rs index e4e7c0fbc..059eaafc5 100644 --- a/compositor_pipeline/src/queue/video_queue.rs +++ b/compositor_pipeline/src/queue/video_queue.rs @@ -285,13 +285,13 @@ impl VideoQueueInput { /// Drops frames that won't be used for processing. This function should only be called before /// queue start. fn drop_old_frames_before_start(&mut self) { - if self.offset.is_some() { - // if offset is defined never drop frames before start. + let Some(start_input_stream) = self.input_start_time() else { + // before first frame, so nothing to do return; }; - let Some(start_input_stream) = self.input_start_time() else { - // before first frame, so nothing to do + if self.offset.is_some() { + // if offset is defined never drop frames before start. return; }; diff --git a/src/config.rs b/src/config.rs index 60ab2985a..74102bb5e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -149,13 +149,13 @@ fn try_read_config() -> Result { let ahead_of_time_processing: bool = match env::var("LIVE_COMPOSITOR_AHEAD_OF_TIME_PROCESSING_ENABLE") { Ok(enable) => bool_env_from_str(&enable).unwrap_or(offline_processing), - Err(_) => false, + Err(_) => offline_processing, }; let never_drop_output_frames: bool = match env::var("LIVE_COMPOSITOR_NEVER_DROP_OUTPUT_FRAMES") { Ok(enable) => bool_env_from_str(&enable).unwrap_or(offline_processing), - Err(_) => false, + Err(_) => offline_processing, }; let run_late_scheduled_events = match env::var("LIVE_COMPOSITOR_RUN_LATE_SCHEDULED_EVENTS") {