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

Various updates to the decoding pipeline #3

Merged
merged 7 commits into from
Jan 13, 2024

Conversation

carlst99
Copy link
Contributor

This PR targets a few things that were preventing successful audio decoding:

  • VoiceLinkConnection.cs now ignores RTP header extensions.
  • Pass the frame size into OpusNativeMethods#Decode, rather than using the number of frames in the buffer.
  • Refactor OpusDecoder.cs and OpusNativeMethods.Decoder.cs to store/return a pointer to the created decoder state, rather than trying to use a pointer to the struct that was originally returned, which was not referring to the created state object.
  • Account for Opus using 16-bit PCM units when allocating the PCM buffer.
  • Limit the decrypted audio buffer to the length of the data, rather than the entirety of the rented buffer. Unsure if this actually has an effect on decoding but I think it's a safer practice regardless.
  • Minor changes to error logging.

Hopefully this is useful, let me know of any issues 😄.

@OoLunar
Copy link
Owner

OoLunar commented Jan 13, 2024

Hopefully this is useful

I think you just saved the project

Copy link
Owner

@OoLunar OoLunar left a comment

Choose a reason for hiding this comment

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

Generally looks good to me. Thank you so much for contributing!

@OoLunar OoLunar self-assigned this Jan 13, 2024
@OoLunar OoLunar added documentation Improvements or additions to documentation enhancement New feature or request labels Jan 13, 2024
@OoLunar OoLunar merged commit 0a31e09 into OoLunar:master Jan 13, 2024
1 check failed
OoLunar pushed a commit that referenced this pull request May 24, 2024
* Hold decoder state pointer internally to resolve passing an invalid reference to the Opus native methods.
Pass frameSize to OpusDecoder.cs#Decode

* Ensure address string is null terminated

* Handle RTP header extensions

* Only operate on voice data, not the entirety of the rented buffer

* Account for PCM unit size when allocating PCM buffer

* Improved error handling

* XML doc for RtpUtilities.cs#GetHeaderExtensionLength
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants