opus icon indicating copy to clipboard operation
opus copied to clipboard

Added SetComplexity to decoder

Open avezina-ubik opened this issue 1 year ago • 8 comments

In order to support deep PLC, libopus added OPUS_SET_COMPLEXITY() to the decoder API.

This PR adds SetComplexity method to the decoder.

Note that if libopus < 1.5 this function will return ErrUnimplemented so users could easily ignore it like this:

dec, err := opus.NewDecoder(48000, 1)
if err != nil {
	// ... handle error
}

err = dec.SetComplexity(10)
if err != nil && err != opus.ErrUnimplemented {
	// ... handle error
}

avezina-ubik avatar Sep 30 '24 18:09 avezina-ubik

This should help #54

avezina-ubik avatar Sep 30 '24 19:09 avezina-ubik

@hraban curious if this can be merged?

jackspirou avatar Feb 12 '25 16:02 jackspirou

Yes looks great sorry I forgot but it's on my radar will restore my go dev env in a bit

hraban avatar Feb 13 '25 05:02 hraban

this would be a great addition!

gregriff avatar Nov 06 '25 05:11 gregriff

Thank you for the PR! I added some tests in CI and rebased your change on top of it and it seems to be failing. See e.g. https://github.com/hraban/opus/actions/runs/19424167437 . Do you know what could be going wrong?

hraban avatar Nov 17 '25 09:11 hraban

Hey @hraban ,

I just checked the build logs and it seems the workflows are using libopus from Ubuntu 24.04, which is version 1.4.

This PR depends on a feature that was first implemented in libopus 1.5.

Ubuntu 25.04 ships with libopus 1.5.2, which would work: https://answers.launchpad.net/ubuntu/plucky/amd64/libopus-dev

Would you like me to include an updated test.yml in this PR that runs the jobs in an ubuntu:25.04 container? That would allow us to test the new functionality.

avezina-ubik avatar Nov 17 '25 17:11 avezina-ubik

ah thanks that explains it. I'll have another look on my end tonight, see if I can get it merged.

hraban avatar Nov 17 '25 17:11 hraban

All right let me know if you need something

avezina-ubik avatar Nov 17 '25 18:11 avezina-ubik