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}
This commit is contained in:
Minyue Li
2019-11-04 14:47:52 +01:00
committed by Commit Bot
parent 0696eecbd0
commit 8e83c7ac09
7 changed files with 116 additions and 45 deletions

View File

@ -299,9 +299,19 @@ void OpusTest::Run(TestPackStereo* channel,
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 @@ void OpusTest::Run(TestPackStereo* channel,
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);
}
}