Document stereo live audio and compact rotation controls

This commit is contained in:
evgeny committed 2026-10-13 14:30:07 +02:00
1 parent c251de4f77
commit 727106f4e9
2 files changed
+31 -8

No files matched your search

+21 -1
View File
@@ -211,6 +211,25 @@ static int test_multiple_frames(void) {
return ok ? 0 : 1;
}
/* Stereo-output плееров также принимает mono Opus; upmix выполняет сам libopus. */
static int test_mono_packet_stereo_output(void) {
printf("test_mono_packet_stereo_output: ");
opus_codec_encoder_t* encoder = opus_codec_encoder_create(48000, 1);
opus_codec_decoder_t* decoder = opus_codec_decoder_create(48000, 2);
int ok = encoder && decoder;
if (ok) {
int16_t input[960], output[1920]; uint8_t packet[1275];
for (unsigned i = 0; i < 960; i++) input[i] = (int16_t)(6000 * sin(i * 0.1));
int length = opus_codec_encode(encoder, input, 960, packet, sizeof(packet));
ok = length > 0 && opus_codec_decode(decoder, packet, length, output, 960) == 960;
int audible = 0;
if (ok) for (unsigned i = 0; i < 960; i++) { audible |= output[2 * i] != 0; if (output[2 * i] != output[2 * i + 1]) ok = 0; }
ok = ok && audible;
}
opus_codec_encoder_destroy(encoder); opus_codec_decoder_destroy(decoder);
printf("%s\n", ok ? "PASS" : "FAIL"); return ok ? 0 : 1;
}
int main(void) {
int failed = 0;
failed += test_encode_decode_silence();
@@ -220,7 +239,8 @@ int main(void) {
failed += test_null_args();
failed += test_default_sample_rate();
failed += test_multiple_frames();
failed += test_mono_packet_stereo_output();
printf("\n%s: %d/%d tests passed\n", failed ? "FAIL" : "OK", 7 - failed, 7);
printf("\n%s: %d/%d tests passed\n", failed ? "FAIL" : "OK", 8 - failed, 8);
return failed ? 1 : 0;
}