Frames/Samples confusion
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 3.3k
- Forks
- 808
- PR merge metrics
- No merged PRs in 30d
Description
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()andopus_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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No documentation file or test is named in the issue. Locate the API documentation for opus_packet_get_samples_per_frame(), opus_packet_get_nb_samples(), and opus_decoder_get_nb_samples(), then update it to explain the distinction between samples, audio frames, Opus frames, and channels. Done means the documented behavior resolves the reported stereo example without changing the functions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- audio-video-rtc
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100