Skip to content

Commit 909e49a

Browse files
committed
fix: move timer right before pipeline is started
This is so errors could be presented as early as delay countdown.
1 parent 0494986 commit 909e49a

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

Diff for: src/recording.rs

+14-13
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ impl Recording {
196196
settings.set_screencast_restore_token(&restore_token.unwrap_or_default());
197197

198198
let file_path = new_recording_path(&settings.saving_location(), profile.file_extension());
199+
imp.file.set(gio::File::for_path(&file_path)).unwrap();
200+
199201
let mut pipeline_builder = PipelineBuilder::new(
200202
&file_path,
201203
settings.framerate(),
@@ -210,18 +212,6 @@ impl Recording {
210212
pipeline_builder.select_area_data(data);
211213
}
212214

213-
// setup timer
214-
let timer = Timer::new(
215-
settings.record_delay(),
216-
clone!(@weak self as obj => move |secs_left| {
217-
obj.set_state(RecordingState::Delayed {
218-
secs_left
219-
});
220-
}),
221-
);
222-
imp.timer.replace(Some(Timer::clone(&timer)));
223-
timer.await?;
224-
225215
// setup audio sources
226216
if profile_supports_audio {
227217
let application = Application::get();
@@ -258,7 +248,18 @@ impl Recording {
258248
// This is enabled by setting `GST_DEBUG_DUMP_DOT_DIR` to a directory (e.g. `GST_DEBUG_DUMP_DOT_DIR=.`).
259249
pipeline.debug_to_dot_file_with_ts(gst::DebugGraphDetails::VERBOSE, "kooha-pipeline");
260250

261-
imp.file.set(gio::File::for_path(file_path)).unwrap();
251+
// setup timer
252+
let timer = Timer::new(
253+
settings.record_delay(),
254+
clone!(@weak self as obj => move |secs_left| {
255+
obj.set_state(RecordingState::Delayed {
256+
secs_left
257+
});
258+
}),
259+
);
260+
imp.timer.replace(Some(Timer::clone(&timer)));
261+
timer.await?;
262+
262263
let bus_watch_guard = pipeline
263264
.bus()
264265
.unwrap()

0 commit comments

Comments
 (0)