Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

refactor(recording): use async muxer setup in pipeline tests

Richie McIlroyc0a631c9e780
diff --git a/crates/recording/src/output_pipeline/core.rs b/crates/recording/src/output_pipeline/core.rs
index b79b3685f..db8c5aea5 100644
--- a/crates/recording/src/output_pipeline/core.rs
+++ b/crates/recording/src/output_pipeline/core.rs
@@ -2452,23 +2452,21 @@ mod tests {
impl Muxer for FailingVideoMuxer {
type Config = FailingVideoMuxerConfig;
- fn setup(
+ async fn setup(
config: Self::Config,
_output_path: PathBuf,
_video_config: Option<VideoInfo>,
_audio_config: Option<AudioInfo>,
_pause_flag: Arc<AtomicBool>,
_tasks: &mut TaskPool,
- ) -> impl Future<Output = anyhow::Result<Self>> + Send
+ ) -> anyhow::Result<Self>
where
Self: Sized,
{
- async move {
- Ok(Self {
- fail_after_frame: config.fail_after_frame,
- sent_frames: 0,
- })
- }
+ Ok(Self {
+ fail_after_frame: config.fail_after_frame,
+ sent_frames: 0,
+ })
}
fn finish(&mut self, _timestamp: Duration) -> anyhow::Result<anyhow::Result<()>> {
@@ -2515,23 +2513,21 @@ mod tests {
impl Muxer for FailingAudioMuxer {
type Config = FailingAudioMuxerConfig;
- fn setup(
+ async fn setup(
config: Self::Config,
_output_path: PathBuf,
_video_config: Option<VideoInfo>,
_audio_config: Option<AudioInfo>,
_pause_flag: Arc<AtomicBool>,
_tasks: &mut TaskPool,
- ) -> impl Future<Output = anyhow::Result<Self>> + Send
+ ) -> anyhow::Result<Self>
where
Self: Sized,
{
- async move {
- Ok(Self {
- fail_after_frame: config.fail_after_frame,
- sent_frames: 0,
- })
- }
+ Ok(Self {
+ fail_after_frame: config.fail_after_frame,
+ sent_frames: 0,
+ })
}
fn finish(&mut self, _timestamp: Duration) -> anyhow::Result<anyhow::Result<()>> {
diff --git a/crates/recording/src/output_pipeline/macos.rs b/crates/recording/src/output_pipeline/macos.rs
index a020cd8c5..5c8911ed3 100644
--- a/crates/recording/src/output_pipeline/macos.rs
+++ b/crates/recording/src/output_pipeline/macos.rs
@@ -1068,11 +1068,13 @@ mod tests {
#[test]
fn instant_mode_buffer_is_larger_than_normal() {
+ let instant = DEFAULT_MP4_MUXER_BUFFER_SIZE_INSTANT;
+ let normal = DEFAULT_MP4_MUXER_BUFFER_SIZE;
assert!(
- DEFAULT_MP4_MUXER_BUFFER_SIZE_INSTANT > DEFAULT_MP4_MUXER_BUFFER_SIZE,
+ instant > normal,
"Instant mode buffer ({}) should be larger than normal mode buffer ({})",
- DEFAULT_MP4_MUXER_BUFFER_SIZE_INSTANT,
- DEFAULT_MP4_MUXER_BUFFER_SIZE
+ instant,
+ normal
);
}