Skip to content

Commit

Permalink
fix disable audio avoid running record_audio completely
Browse files Browse the repository at this point in the history
  • Loading branch information
louis030195 committed Sep 5, 2024
1 parent 7499ef3 commit 8c94ec2
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions screenpipe-server/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,26 @@ pub async fn start_continuous_recording(
})
};

let audio_handle = tokio::spawn(async move {
record_audio(
db_manager_audio,
output_path_audio,
audio_chunk_duration,
whisper_sender,
whisper_receiver,
audio_devices_control,
friend_wearable_uid,
audio_transcription_engine,
)
.await
});
let audio_handle = if !audio_disabled {
tokio::spawn(async move {
record_audio(
db_manager_audio,
output_path_audio,
audio_chunk_duration,
whisper_sender,
whisper_receiver,
audio_devices_control,
friend_wearable_uid,
audio_transcription_engine,
)
.await
})
} else {
tokio::spawn(async move {
tokio::time::sleep(Duration::from_secs(60)).await;
Ok(())
})
};

// Wait for both tasks to complete
let (video_result, audio_result) = tokio::join!(video_handle, audio_handle);
Expand Down

0 comments on commit 8c94ec2

Please sign in to comment.