OPUS_GET_BITRATE always returns default value for opus_multistream_encoder
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 3.3k
- Forks
- 808
- PR merge metrics
- No merged PRs in 30d
Description
When I call the OPUS_GET_BITRATE control on a multistream encoder, it always returns the default value, e.g. 144000 for 2 channels at 48 kHz
int32_t bitrate = 64000; // could also be OPUS_BITRATE_MAX
opus_multistream_encoder_ctl(state, OPUS_SET_BITRATE(bitrate));
// always returns the default...
opus_multistream_encoder_ctl(state, OPUS_GET_BITRATE(&bitrate));
other controls like OPUS_GET_COMPLEXITY or OPUS_GET_SIGNAL work as expected.
Here's the reason:
opus_multistream_encoder has a dedicated field bitrate_bps and OPUS_SET_BITRATE sets it as expected. OPUS_GET_BITRATE, however, internally calls opus_encoder_ctl on the sub-states, which gets the value of user_bitrate_bps. Since the latter is initialized to OPUS_AUTO and never overriden, it would always return the value of the default bitrate.
Not sure what's the best approach to fix this...
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
Start at opus_multistream_encoder_ctl and trace the OPUS_SET_BITRATE and OPUS_GET_BITRATE paths into opus_encoder_ctl. Compare the multistream encoder's bitrate_bps with the sub-state user_bitrate_bps behavior. Done means the getter reports the bitrate previously set on a multistream encoder, including OPUS_BITRATE_MAX, rather than the default value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- audio-video-rtc
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100