Skip to content
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

Fix: added sample rate conversion for recording voice messages #2188

Merged
merged 1 commit into from
Nov 29, 2023

Conversation

nimau
Copy link
Contributor

@nimau nimau commented Nov 29, 2023

This PR fixes #2184

This crash was due to a sample rate (44100) that doesn't seem to be supported by opus_encoder_create.

The default sample rate has changed between iPhone X and iPhone 11. Since iPhone 11, the default sample rate when recording is 48000 (it was 44100).

The fix is to use AVAudioConverter to convert the audio buffer to the correct sample rate (48000).

Recording and sending a voice message now works correctly:

  • on iOS with a default recording sample rate of 44100
  • on iOS with a default recording sample rate of 48000

@nimau nimau requested a review from a team as a code owner November 29, 2023 14:20
@nimau nimau requested review from stefanceriu and removed request for a team November 29, 2023 14:20
Copy link

Warnings
⚠️ Some of the commits are missing ticket numbers. Please consider squashing all commits that don't have a tracking number.

Generated by 🚫 Danger Swift against f76b3a5

Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@stefanceriu stefanceriu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lgtm but more importantly it works great! 👏

@nimau nimau enabled auto-merge (squash) November 29, 2023 15:09
@nimau nimau merged commit fcaed76 into develop Nov 29, 2023
5 checks passed
@nimau nimau deleted the nicolas/fix-ogg-encoding-crash branch November 29, 2023 15:20
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.

Crash when recording voice messages
2 participants