Skip to content

Conversation

@joshmux
Copy link

@joshmux joshmux commented Nov 7, 2025

Summary

Fixes an issue in the Go bindings where calling NextSegment() after multiple Process() invocations returns no new segments. This prevented incremental or streaming-style processing from functioning correctly.

Details

When the Go wrapper calls Process() more than once, the internal context segment counter (context.n) is not reset or updated properly. As a result:

  • NextSegment() stops yielding new segments after the first Process() call.
  • Incremental processing workflows (e.g., feeding audio in chunks) silently fail.
  • The behavior diverges from expectations set by the underlying C++ implementation.

This PR resets context.n at the start of each Process() call, ensuring that segment iteration works correctly across multiple processing passes.

Impact

  • Enables proper streaming and incremental recognition in the Go bindings.
  • Prevents confusing silent failures where no segments are returned.
  • Improves consistency and correctness relative to whisper.cpp core behavior.

Backward Compatibility

This change is internal to the Go bindings and does not modify the public API.
Existing code using a single Process()NextSegment() workflow will behave exactly as before.

@joshmux joshmux changed the title Allow for NextSegment to be called for multiple Process calls Allow NextSegment() to be called across multiple Process() calls in the Go binding Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant