[mod_opus] Fix status returned by switch_opus_decode(). Should be SWITCH_STATUS_FALSE instead of SWITCH_STATUS_NOOP. Add a unit-test.

This commit is contained in:
Andrey Volk
2024-02-05 23:50:01 +03:00
parent 9df3076f29
commit 647035c323
4 changed files with 247 additions and 1 deletions
+26
View File
@@ -127,6 +127,32 @@ FST_CORE_BEGIN("./conf")
}
FST_TEST_END()
FST_TEST_BEGIN(test_mod_opus_switch_status_false)
{
signed char outbuf[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 };
uint32_t decoded_len = 0;
uint32_t decoded_rate = 48000;
unsigned int flags = 0;
switch_codec_t orig_codec = { 0 };
switch_status_t status;
switch_codec_settings_t codec_settings = { { 0 } };
status = switch_core_codec_init(&orig_codec,
"OPUS",
"mod_opus",
NULL,
48000,
20,
1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
&codec_settings, fst_pool);
fst_check(status == SWITCH_STATUS_SUCCESS);
status = switch_core_codec_decode(&orig_codec, NULL, "test", 5, 48000, outbuf, &decoded_len, &decoded_rate, &flags);
fst_check_int_equals(status, SWITCH_STATUS_FALSE);
switch_core_codec_destroy(&orig_codec);
}
FST_TEST_END()
}
FST_SUITE_END()
}