Skip to content

fix: Inaccurate duration on Android#483

Closed
Colton127 wants to merge 1 commit into
SimformSolutionsPvtLtd:mainfrom
Colton127:fix-#476
Closed

fix: Inaccurate duration on Android#483
Colton127 wants to merge 1 commit into
SimformSolutionsPvtLtd:mainfrom
Colton127:fix-#476

Conversation

@Colton127

Copy link
Copy Markdown

Description

Resolves an issue where the recorded duration reported is twice the real value on Android.

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

Closes #476

@lavigarg-simform

Copy link
Copy Markdown

Thanks for tracking this down and submitting a fix, @Colton127!

This PR and PR #494 address the same root bug — totalSamples counting bytes instead of samples, causing onCurrentDuration to report 2× the real elapsed time on Android.

We’re going to proceed with the other PR instead as the primary fix because it derives bytesPerSample from the actual audioFormat (handling 8-bit and float PCM, not just the common 16-bit case).

However, your PR contributed one important thing that will be carried forward into that PR:

  • The diagnosis of the totalSamples reset placement (stop()startRecording()), which also addresses the near-zero duration value emitted after stop.

Closing this in favour of #494. Thanks again for the contribution!

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.

RecorderController.onCurrentDuration is twice the real value

2 participants