-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 12 commits
f8cd75a
ab6bfe3
07506b3
64507df
a6f0661
146958b
b04c68d
b22097e
801e689
d7f2fb0
863fe1f
c915932
66ad78a
c90d08d
7360753
23b11d9
7fe1931
0abc8d3
cd870dd
c396c7e
889637b
365a045
5da95f4
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 | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -123,10 +123,13 @@ fn studio_checks(meta: &RecordingMeta, studio: &StudioRecordingMeta) -> Vec<File | |||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| match studio { | ||||||||||||||||||||||||||||||||
| StudioRecordingMeta::SingleSegment { segment } => { | ||||||||||||||||||||||||||||||||
| checks.push(required_check( | ||||||||||||||||||||||||||||||||
| "displayVideo", | ||||||||||||||||||||||||||||||||
| meta.path(&segment.display.path), | ||||||||||||||||||||||||||||||||
| )); | ||||||||||||||||||||||||||||||||
| if !meta.audio_only { | ||||||||||||||||||||||||||||||||
| let path = segment | ||||||||||||||||||||||||||||||||
| .display | ||||||||||||||||||||||||||||||||
| .as_ref() | ||||||||||||||||||||||||||||||||
| .map_or_else(PathBuf::new, |d| meta.path(&d.path)); | ||||||||||||||||||||||||||||||||
| checks.push(required_check("displayVideo", path)); | ||||||||||||||||||||||||||||||||
|
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. Using
Suggested change
(Same pattern for the multi-segment loop below.) |
||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| if let Some(camera) = &segment.camera { | ||||||||||||||||||||||||||||||||
| checks.push(required_check("camera", meta.path(&camera.path))); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
@@ -139,10 +142,13 @@ fn studio_checks(meta: &RecordingMeta, studio: &StudioRecordingMeta) -> Vec<File | |||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| StudioRecordingMeta::MultipleSegments { inner } => { | ||||||||||||||||||||||||||||||||
| for segment in &inner.segments { | ||||||||||||||||||||||||||||||||
| checks.push(required_check( | ||||||||||||||||||||||||||||||||
| "displayVideo", | ||||||||||||||||||||||||||||||||
| meta.path(&segment.display.path), | ||||||||||||||||||||||||||||||||
| )); | ||||||||||||||||||||||||||||||||
| if !meta.audio_only { | ||||||||||||||||||||||||||||||||
| let path = segment | ||||||||||||||||||||||||||||||||
| .display | ||||||||||||||||||||||||||||||||
| .as_ref() | ||||||||||||||||||||||||||||||||
| .map_or_else(PathBuf::new, |d| meta.path(&d.path)); | ||||||||||||||||||||||||||||||||
| checks.push(required_check("displayVideo", path)); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| if let Some(camera) = &segment.camera { | ||||||||||||||||||||||||||||||||
| checks.push(required_check("camera", meta.path(&camera.path))); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -889,6 +889,7 @@ fn persist_instant_recording_meta( | |||||
| sharing: None, | ||||||
| inner: RecordingMetaInner::Instant(meta), | ||||||
| upload: None, | ||||||
| audio_only: false, | ||||||
|
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.
Suggested change
|
||||||
| } | ||||||
| .save_for_project() | ||||||
| .map_err(|e| format!("Failed to save instant recording meta: {e}"))?; | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -118,7 +118,11 @@ async fn load_recording( | |||||||||||||||
| if project.timeline.is_none() { | ||||||||||||||||
| let timeline_segments = match meta.as_ref() { | ||||||||||||||||
| StudioRecordingMeta::SingleSegment { segment } => { | ||||||||||||||||
| let display_path = recording_meta.path(&segment.display.path); | ||||||||||||||||
| let display_path = segment | ||||||||||||||||
| .display | ||||||||||||||||
| .as_ref() | ||||||||||||||||
| .map(|d| recording_meta.path(&d.path)) | ||||||||||||||||
| .unwrap_or_default(); | ||||||||||||||||
|
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.
Suggested change
|
||||||||||||||||
| let duration = match Video::new(&display_path, 0.0) { | ||||||||||||||||
| Ok(video) => video.duration, | ||||||||||||||||
| Err(_) => 5.0, | ||||||||||||||||
|
|
@@ -135,7 +139,11 @@ async fn load_recording( | |||||||||||||||
| .iter() | ||||||||||||||||
| .enumerate() | ||||||||||||||||
| .filter_map(|(i, segment)| { | ||||||||||||||||
| let display_path = recording_meta.path(&segment.display.path); | ||||||||||||||||
| let display_path = segment | ||||||||||||||||
| .display | ||||||||||||||||
| .as_ref() | ||||||||||||||||
| .map(|d| recording_meta.path(&d.path)) | ||||||||||||||||
| .unwrap_or_default(); | ||||||||||||||||
| let duration = match Video::new(&display_path, 0.0) { | ||||||||||||||||
| Ok(video) => video.duration, | ||||||||||||||||
| Err(_) => 5.0, | ||||||||||||||||
|
|
||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2236,6 +2236,7 @@ enum CurrentRecordingTarget { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bounds: LogicalBounds, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Camera, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Audio, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[derive(Serialize, Type)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -2288,6 +2289,7 @@ async fn get_current_recording( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bounds: *bounds, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ScreenCaptureTarget::CameraOnly => CurrentRecordingTarget::Camera, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ScreenCaptureTarget::AudioOnly => CurrentRecordingTarget::Audio, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Ok(JsonValue::new(&Some(CurrentRecording { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -2916,12 +2918,27 @@ async fn get_video_metadata(path: PathBuf) -> Result<VideoRecordingMetadata, Str | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| match &**meta { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| StudioRecordingMeta::SingleSegment { segment } => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| vec![recording_meta.path(&segment.display.path)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| vec![ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| recording_meta.path( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| &segment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .display | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .as_ref() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .map(|d| d.path.clone()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .unwrap_or_default(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| StudioRecordingMeta::MultipleSegments { inner } => inner | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .segments | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .iter() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .map(|s| recording_meta.path(&s.display.path)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .map(|s| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| recording_meta.path( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| &s.display | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .as_ref() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .map(|d| d.path.clone()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .unwrap_or_default(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .collect(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
3171
to
3194
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. This
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
PathBuf::new()here is a bit risky: an empty path often resolves to.soexists()can returntrueand accidentally mark a non-audio-only project as valid even whendisplaymetadata is missing.Maybe prefer branching on the option and forcing
exists: falsewhendisplayisNone: