Make Opus PLC always output 10ms audio.
BUG: b/143582588
Change-Id: I41ad5f4f91d9af3f595666a8f32b7ab5382605bd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158672
Commit-Queue: Minyue Li <minyue@webrtc.org>
Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29733}
diff --git a/modules/audio_coding/test/opus_test.cc b/modules/audio_coding/test/opus_test.cc
index 10644e2..e110924 100644
--- a/modules/audio_coding/test/opus_test.cc
+++ b/modules/audio_coding/test/opus_test.cc
@@ -299,9 +299,19 @@
opus_mono_decoder_, bitstream, bitstream_len_byte,
&out_audio[decoded_samples * channels], &audio_type);
} else {
- decoded_samples += WebRtcOpus_Decode(
- opus_mono_decoder_, NULL, 0,
- &out_audio[decoded_samples * channels], &audio_type);
+ // Call decoder PLC.
+ constexpr int kPlcDurationMs = 10;
+ constexpr int kPlcSamples = 48 * kPlcDurationMs;
+ size_t total_plc_samples = 0;
+ while (total_plc_samples < frame_length) {
+ int ret = WebRtcOpus_Decode(
+ opus_mono_decoder_, NULL, 0,
+ &out_audio[decoded_samples * channels], &audio_type);
+ EXPECT_EQ(ret, kPlcSamples);
+ decoded_samples += ret;
+ total_plc_samples += ret;
+ }
+ EXPECT_EQ(total_plc_samples, frame_length);
}
} else {
if (!lost_packet) {
@@ -309,9 +319,19 @@
opus_stereo_decoder_, bitstream, bitstream_len_byte,
&out_audio[decoded_samples * channels], &audio_type);
} else {
- decoded_samples += WebRtcOpus_Decode(
- opus_stereo_decoder_, NULL, 0,
- &out_audio[decoded_samples * channels], &audio_type);
+ // Call decoder PLC.
+ constexpr int kPlcDurationMs = 10;
+ constexpr int kPlcSamples = 48 * kPlcDurationMs;
+ size_t total_plc_samples = 0;
+ while (total_plc_samples < frame_length) {
+ int ret = WebRtcOpus_Decode(
+ opus_stereo_decoder_, NULL, 0,
+ &out_audio[decoded_samples * channels], &audio_type);
+ EXPECT_EQ(ret, kPlcSamples);
+ decoded_samples += ret;
+ total_plc_samples += ret;
+ }
+ EXPECT_EQ(total_plc_samples, frame_length);
}
}