- allow Opus spec to use slash as divider + cleanup source code

This commit is contained in:
Dmytro Bogovych 2024-10-18 09:46:42 +03:00
parent 20c2ac3e63
commit 5a0a7e1070
2 changed files with 665 additions and 661 deletions

View File

@ -494,7 +494,11 @@ int OpusCodec::encode(const void* input, int inputBytes, void* output, int outpu
int OpusCodec::decode(const void* input, int inputBytes, void* output, int outputCapacity)
{
int nr_of_channels = opus_packet_get_nb_channels((const unsigned char*)input);
assert(nr_of_channels == channels());
if (nr_of_channels != channels())
{
// Most probably bad configuration
return 0;
}
int nr_of_frames = opus_decoder_get_nb_samples(mDecoderCtx, (const unsigned char*)input, inputBytes);
if (nr_of_frames > 0)

View File

@ -116,7 +116,7 @@ CodecList::Settings::OpusSpec CodecList::Settings::OpusSpec::parse(const std::st
{
OpusSpec result;
auto parts = strx::split(spec, "-");
auto parts = strx::split(spec, "-/");
if (parts.size() == 3)
{
result.mPayloadType = strx::toInt(strx::trim(parts.front()).c_str(), -1);