Skip to content

Windows microphone capture to openable .m4a segments (audio capture seam) #52

Description

@shaik-zeeshan

What to build

The foundational tracer bullet for Windows audio capture: record the microphone end-to-end into openable, rotating .m4a segments, decoupled from screen capture.

This slice establishes the shared audio seam that the system-audio and inactivity slices build on:

  • Introduce a platform-neutral AudioCaptureSession trait (rotate→finalization, stop, is_live, take_stop_error), mirroring ScreenCaptureSession. The Recording Lifecycle holds active_microphone_session and active_system_audio_session as Box<dyn AudioCaptureSession>. macOS microphone keeps its concrete type for now; the trait's finalization type must reconcile with the existing macOS finalization consumed by microphone output finalization.
  • WASAPI default-device microphone input → AAC .m4a via Media Foundation (AAC encoder + MPEG-4/M4A sink in the writers crate). Mirrors the macOS separate-audio layout — zero schema churn.
  • Reuse the existing SegmentPlanner layout verbatim: <save_root>/YYYY/MM/DD/audio/<session_id>-segment-####.m4a, microphone via a mic_session-prefixed id. Populate SourceSessions.microphone source-session metadata (currently never populated on Windows).
  • Segment rotation on the 5-minute Capture Segment Duration boundary, driven by the existing source-independent wall-clock CaptureClock + SegmentSchedule — no new timing source. Add the Windows microphone rotate arm to the rotation tick.
  • Audio-only restructure: the rotation tick must not hard-require a screen planner/session. The "no screen planner ⇒ fail session" guard and the screen-capture-stopped failure check become conditional on whether screen is an active source (a no-op for macOS, which always has a screen planner when audio is active). No per-segment screen workspace dir is created for audio-only sessions.
  • Finalization validation: define "openable .m4a" as "Media Foundation Source Reader opens it and MF_PD_DURATION > 0", reusing the existing injectable has_positive_duration validator seam (un-gate the structural helpers to also build on Windows; only the MF probe leaf is new). Matches the macOS audio contract.
  • Commit produced Audio Segments, but do not enqueue audio processing jobs on Windows yet (capture-and-store now; a future audio-decode slice will backfill them). Non-goal: audio decode-to-PCM.
  • Flip supported_sources.microphone on for Windows so the source becomes user-selectable.

The Windows user pause/resume control stays hidden until the inactivity slice fixes resume (see slice 3c).

Non-goals (explicitly out): audio decode-to-PCM for transcription/speaker/speech-activity, frame-index sidecars, exact/scrub previews, microphone device-change handling (slice 1b), permission UX (slice 1c), VAD/activity emission (slice 1d).

Acceptance criteria

  • AudioCaptureSession trait exists; runtime holds microphone (and system-audio) sessions as Box<dyn AudioCaptureSession>; macOS finalization reconciled
  • Microphone-only recording on Windows produces openable .m4a segments under the shared audio/ dir with mic_session-prefixed ids
  • SourceSessions.microphone metadata is populated on Windows
  • Segments rotate on the 5-minute boundary using the existing CaptureClock/SegmentSchedule; no screen session is required
  • Audio-only sessions no longer fail for lack of a screen planner; macOS behavior is unchanged
  • .m4a finalization validated via MF Source Reader positive-duration probe through the existing injectable validator seam
  • Audio Segments are committed but no audio processing jobs are enqueued on Windows
  • supported_sources.microphone is true on Windows and reveals the mic source in the UI
  • Windows user pause/resume control is hidden (until slice 3c)

Blocked by

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    afk-readyScoped and ready for an autonomous (AFK) agent to implementenhancementNew feature or requestneeds-smoke-testRequires manual on-device verification before merge (not CI-verifiable)windowsWindows platform support

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions