-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(recording): add AudioOnly capture target and recording pipeline … #1881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
f8cd75a
ab6bfe3
07506b3
64507df
a6f0661
146958b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1232,7 +1232,10 @@ pub async fn start_recording( | |
| } | ||
|
|
||
| let mut inputs = inputs; | ||
| if matches!(inputs.capture_target, ScreenCaptureTarget::CameraOnly) { | ||
| if matches!( | ||
| inputs.capture_target, | ||
| ScreenCaptureTarget::CameraOnly | ScreenCaptureTarget::AudioOnly | ||
| ) { | ||
| inputs.capture_system_audio = false; | ||
|
|
||
| { | ||
|
|
@@ -1403,6 +1406,7 @@ pub async fn start_recording( | |
| }, | ||
| sharing: None, | ||
| upload: None, | ||
| audio_only: matches!(inputs.capture_target, ScreenCaptureTarget::AudioOnly), | ||
| }; | ||
|
|
||
| meta.save_for_project() | ||
|
|
@@ -1510,7 +1514,7 @@ pub async fn start_recording( | |
|
|
||
| #[cfg(target_os = "macos")] | ||
| let mut shareable_content = match inputs.capture_target { | ||
| ScreenCaptureTarget::CameraOnly => None, | ||
| ScreenCaptureTarget::CameraOnly | ScreenCaptureTarget::AudioOnly => None, | ||
| _ => Some(acquire_shareable_content_for_target(&inputs.capture_target).await?), | ||
| }; | ||
|
|
||
|
|
@@ -2487,7 +2491,7 @@ pub async fn take_screenshot( | |
| }; | ||
|
|
||
| let segment = cap_project::SingleSegment { | ||
| display: video_meta, | ||
| display: Some(video_meta), | ||
| camera: None, | ||
| audio: None, | ||
| cursor: None, | ||
|
|
@@ -2502,6 +2506,7 @@ pub async fn take_screenshot( | |
| cap_project::StudioRecordingMeta::SingleSegment { segment }, | ||
| )), | ||
| upload: None, | ||
| audio_only: false, | ||
| }; | ||
|
|
||
| meta.save_for_project() | ||
|
|
@@ -2826,10 +2831,10 @@ async fn handle_recording_finish( | |
|
|
||
| let display_output_path = match &updated_studio_meta { | ||
| StudioRecordingMeta::SingleSegment { segment } => { | ||
| segment.display.path.to_path(&recording_dir) | ||
| segment.display.as_ref().map(|d| d.path.clone()).unwrap_or_default().to_path(&recording_dir) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor footgun with the |
||
| } | ||
| StudioRecordingMeta::MultipleSegments { inner, .. } => { | ||
| inner.segments[0].display.path.to_path(&recording_dir) | ||
| inner.segments[0].display.as_ref().map(|d| d.path.clone()).unwrap_or_default().to_path(&recording_dir) | ||
| } | ||
| }; | ||
|
|
||
|
|
@@ -3070,10 +3075,10 @@ async fn finalize_studio_recording( | |
|
|
||
| let display_output_path = match &updated_studio_meta { | ||
| StudioRecordingMeta::SingleSegment { segment } => { | ||
| segment.display.path.to_path(&recording_dir) | ||
| segment.display.as_ref().map(|d| d.path.clone()).unwrap_or_default().to_path(&recording_dir) | ||
| } | ||
| StudioRecordingMeta::MultipleSegments { inner, .. } => { | ||
| inner.segments[0].display.path.to_path(&recording_dir) | ||
| inner.segments[0].display.as_ref().map(|d| d.path.clone()).unwrap_or_default().to_path(&recording_dir) | ||
| } | ||
| }; | ||
|
|
||
|
|
@@ -3201,6 +3206,7 @@ pub fn generate_zoom_segments_from_clicks( | |
| sharing: None, | ||
| inner: RecordingMetaInner::Studio(Box::new(recording.meta.clone())), | ||
| upload: None, | ||
| audio_only: false, | ||
| }; | ||
|
|
||
| generate_zoom_segments_for_project(&recording_meta, recordings) | ||
|
|
@@ -3399,7 +3405,9 @@ pub fn needs_fragment_remux(recording_dir: &Path, meta: &StudioRecordingMeta) -> | |
| }; | ||
|
|
||
| for segment in &inner.segments { | ||
| let display_path = segment.display.path.to_path(recording_dir); | ||
| let Some(display_path) = segment.display.as_ref().map(|d| d.path.to_path(recording_dir)) else { | ||
| continue; | ||
| }; | ||
| if display_path.is_dir() { | ||
| return true; | ||
| } | ||
|
ManthanNimodiya marked this conversation as resolved.
|
||
|
|
@@ -3452,7 +3460,7 @@ pub fn remux_fragmented_recording_with_trigger( | |
| inner | ||
| .segments | ||
| .iter() | ||
| .filter_map(|seg| seg.display.start_time) | ||
| .filter_map(|seg| seg.display.as_ref().and_then(|d| d.start_time)) | ||
| .fold(0.0_f64, |acc, v| acc.max(v)), | ||
| ), | ||
| StudioRecordingMeta::SingleSegment { .. } => None, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
unwrap_or_default()here means a missingdisplayfalls back toproject_pathand you’ll try to read a directory as a video. I think this should stay an explicit error (like thefull_timeline_for_source_segmentspath).