properly check for incorrect/unsupported mapping family

parent 6ffb25b2
......@@ -297,7 +297,10 @@ OggOpusEnc *ope_encoder_create_callbacks(const OpusEncCallbacks *callbacks, void
OggOpusEnc *enc=NULL;
int ret;
if (family != 0 && family != 1 && family != 255 && family != -1) {
if (error) *error = OPE_UNIMPLEMENTED;
if (error) {
if (family < -1 || family > 255) *error = OPE_BAD_ARG;
else *error = OPE_UNIMPLEMENTED;
}
return NULL;
}
if (channels <= 0 || channels > 255) {
......@@ -396,7 +399,9 @@ int ope_encoder_deferred_init_with_mapping(OggOpusEnc *enc, int family, int stre
if (enc->st!=NULL) {
return OPE_TOO_LATE;
}
if (streams <= 0 || streams>255 || coupled_streams<0 || coupled_streams >= 128 || streams+coupled_streams > 255) return OPE_BAD_ARG;
if (family < 0 || family > 255) return OPE_BAD_ARG;
else if (family != 0 && family != 1 && family != 255) return OPE_UNIMPLEMENTED;
else if (streams <= 0 || streams>255 || coupled_streams<0 || coupled_streams >= 128 || streams+coupled_streams > 255) return OPE_BAD_ARG;
st=opus_multistream_encoder_create(48000, enc->channels, streams, coupled_streams, mapping, OPUS_APPLICATION_AUDIO, &ret);
if (! (ret == OPUS_OK && st != NULL) ) {
goto fail;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment