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

Frames/Samples confusion #315

Open
davidebeatrici opened this issue Mar 1, 2024 · 0 comments
Open

Frames/Samples confusion #315

davidebeatrici opened this issue Mar 1, 2024 · 0 comments

Comments

@davidebeatrici
Copy link
Contributor

Let's suppose my application receives stereo (2 channels) packets that contain a total of 960 float samples (3840 bytes in total) each:

  • opus_packet_get_nb_channels() returns 2, which is correct.
  • opus_packet_get_nb_frames() returns 1, which is correct because it refers to the Opus frames.
  • opus_packet_get_samples_per_frame() returns 480, which is wrong because that is the number of audio frames. The Opus frame contains 960 samples.
  • opus_packet_get_nb_samples() and opus_decoder_get_nb_samples() return 480, which is wrong because that is the number of audio frames. The packet contains 960 samples.

Audio/Opus frame confusion aside, the issue consists in the functions not taking the number of channels into account.

Since changing the behavior is not feasible, I would simply add a short explanation to the documentation.

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

No branches or pull requests

1 participant