Skip to content

record_windows: stop() fails with "Catastrophic failure" when the device delivered no audio #636

Closed

Description

@cristian-ptc

Package version

record 7.1.1, record_windows 2.3.0. The same code path is on main (2.4.0).

Environment

  • OS: Windows 10 and 11 (builds 19045, 22000, 26200, 26300)
  • Browser: not applicable

Describe the bug

If stop() runs before the capture device has delivered a single sample, it throws PlatformException(Record, null, Catastrophic failure, null) and isRecording() keeps returning true. We see this in production on more than 25 machines over the last two weeks, always on 5 second takes where the microphone delivered nothing at all.

RecordConfig(encoder: AudioEncoder.wav, device: <selected input>)

Stop() cancels a take that has no data, and Cancel() goes through EndRecording(), which calls IMFSinkWriter::Finalize before it discards the file. Finalize returns E_UNEXPECTED (0x8000FFFF) on a WAV sink writer that never got a sample, so Cancel() returns that error and skips the state update. In 2.2.3 the error was hidden because EndRecording() overwrote it with the result of MFShutdown().

To Reproduce

Steps to reproduce the behavior:

  1. Start a recording with the config above on an input device that delivers no audio.
  2. Call stop() before any sample arrives (we call it after 5 seconds).
  3. See PlatformException(Record, null, Catastrophic failure, null), and isRecording() still returns true.

To hit it every time without such a device, call Recorder::Start() and then Recorder::Stop() in the same dispatcher task, so no sample is processed in between. Stop() returns 0x8000FFFF.

Expected behavior

stop() returns null, the empty file is deleted, and the recorder is stopped.

Additional context

On main, EndRecording(true) still calls m_pSink->Finalize() before Discard(), so cancel() and stop() fail the same way there.

Activity

  1. added a commit that references this issue on Nov 3, 2026
    7e9783e
  2. added a commit that references this issue on Nov 12, 2026
    4888b2b
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions