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 choppy audio sounds when opus is used with HomeKit as a consumer #843

Closed
wants to merge 4 commits into from

Conversation

civita
Copy link
Contributor

@civita civita commented Dec 24, 2023

HomeKit cameras have choppy sounds (#667) in Wi-Fi and no sound in cellular network. This is due to incorrect timestamp increment and mismatched frame sizes.

It looks like iOS devices only request either 20ms (Wi-Fi) or 60ms (Cellular) opus frame sizes, and because I don't know how to dynamically modify ffmpeg args after SelectedStreamConfig is retrieved from iOS devices, merging three 20ms frames into one rtp packet is implemented to deal with mismatched frame sizes. For the timestamp increment, it will be frame size(provided by client) * sampling rate(16k with opus/16000). It looks like default opus also works.

I put these in pkg/srtp and I'm not a golang expert. Please let me know if there's better approaches.

@civita civita changed the title Fix choppy audio sounds when opus is used and HomeKit as a consumer Fix choppy audio sounds when opus is used with HomeKit as a consumer Dec 24, 2023
@AlexxIT AlexxIT self-assigned this Dec 25, 2023
AlexxIT added a commit that referenced this pull request Dec 27, 2023
@AlexxIT AlexxIT added this to the v1.8.5 milestone Dec 28, 2023
AlexxIT added a commit that referenced this pull request Dec 30, 2023
@AlexxIT
Copy link
Owner

AlexxIT commented Jan 1, 2024

https://github.com/AlexxIT/go2rtc/releases/tag/v1.8.5

Thank you! Your support has been very helpful. Rewrote your code a lot, so I can't merge this. Please do some more PR to get on the list of contributors :)

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.

None yet

2 participants