mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
Adding bit exactness test for Opus decoding in NetEq.
Opus has become the mostly used codec in WebRTC. There, however, is no bit exactness test for Opus decoding in NetEq. The new RTP file is generated by the following steps: 1. Encode a clean RTP file with Opus RTPencode resources/audio_coding/speech_mono_32_48kHz.pcm neteq_opus_raw.rtp 960 opus 1 2. Adding jitter to the clean RTP file RTPjitter neteq_opus_raw.rtp jitter.dat neteq_opus.rtp (Note: jitter.dat does not exist in WebRTC resources folder. Check the source code for RTPjitter to know how to define such a file.) BUG=webrtc:3987 TEST=observed Opus normal decoding and FEC decoding were used, listened to the reference output. Review URL: https://codereview.webrtc.org/1515113002 Cr-Commit-Position: refs/heads/master@{#11113}
This commit is contained in:
parent
a72e7349d5
commit
93c08b7438
7 changed files with 44 additions and 4 deletions
|
@ -0,0 +1 @@
|
|||
cc9fa62d0a8f46ffebc782aea2610dda67bb5558
|
1
resources/audio_coding/neteq4_opus_ref.pcm.sha1
Normal file
1
resources/audio_coding/neteq4_opus_ref.pcm.sha1
Normal file
|
@ -0,0 +1 @@
|
|||
301895f1aaa9cd9eae0f5d04d179d63491d744cc
|
1
resources/audio_coding/neteq4_opus_ref_win_32.pcm.sha1
Normal file
1
resources/audio_coding/neteq4_opus_ref_win_32.pcm.sha1
Normal file
|
@ -0,0 +1 @@
|
|||
fbad99878c7a26958e755190027c976692708334
|
1
resources/audio_coding/neteq4_opus_ref_win_64.pcm.sha1
Normal file
1
resources/audio_coding/neteq4_opus_ref_win_64.pcm.sha1
Normal file
|
@ -0,0 +1 @@
|
|||
fbad99878c7a26958e755190027c976692708334
|
1
resources/audio_coding/neteq4_opus_rtcp_stats.dat.sha1
Normal file
1
resources/audio_coding/neteq4_opus_rtcp_stats.dat.sha1
Normal file
|
@ -0,0 +1 @@
|
|||
e37c797e3de6a64dda88c9ade7a013d022a2e1e0
|
1
resources/audio_coding/neteq_opus.rtp.sha1
Normal file
1
resources/audio_coding/neteq_opus.rtp.sha1
Normal file
|
@ -0,0 +1 @@
|
|||
21c8f8aaf9518a629d6c6def87fe6ea1305d5c91
|
|
@ -229,7 +229,7 @@ void RefFiles::ReadFromFileAndCompare(
|
|||
ASSERT_EQ(stats.accelerate_rate, ref_stats.accelerate_rate());
|
||||
ASSERT_EQ(stats.clockdrift_ppm, ref_stats.clockdrift_ppm());
|
||||
ASSERT_EQ(stats.added_zero_samples, ref_stats.added_zero_samples());
|
||||
ASSERT_EQ(stats.secondary_decoded_rate, 0);
|
||||
ASSERT_EQ(stats.secondary_decoded_rate, ref_stats.secondary_decoded_rate());
|
||||
ASSERT_LE(stats.speech_expand_rate, ref_stats.expand_rate());
|
||||
#else
|
||||
FAIL() << "Reading from reference file requires Proto Buffer.";
|
||||
|
@ -279,7 +279,8 @@ class NetEqDecodingTest : public ::testing::Test {
|
|||
static const size_t kBlockSize8kHz = kTimeStepMs * 8;
|
||||
static const size_t kBlockSize16kHz = kTimeStepMs * 16;
|
||||
static const size_t kBlockSize32kHz = kTimeStepMs * 32;
|
||||
static const size_t kMaxBlockSize = kBlockSize32kHz;
|
||||
static const size_t kBlockSize48kHz = kTimeStepMs * 48;
|
||||
static const size_t kMaxBlockSize = kBlockSize48kHz;
|
||||
static const int kInitSampleRateHz = 8000;
|
||||
|
||||
NetEqDecodingTest();
|
||||
|
@ -380,6 +381,10 @@ void NetEqDecodingTest::LoadDecoders() {
|
|||
// Load iSAC SWB.
|
||||
ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderISACswb,
|
||||
"isac-swb", 104));
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_OPUS
|
||||
ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderOpus,
|
||||
"opus", 111));
|
||||
#endif
|
||||
// Load PCM16B nb.
|
||||
ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderPCM16B,
|
||||
|
@ -426,7 +431,8 @@ void NetEqDecodingTest::Process(size_t* out_len) {
|
|||
&num_channels, &type));
|
||||
ASSERT_TRUE((*out_len == kBlockSize8kHz) ||
|
||||
(*out_len == kBlockSize16kHz) ||
|
||||
(*out_len == kBlockSize32kHz));
|
||||
(*out_len == kBlockSize32kHz) ||
|
||||
(*out_len == kBlockSize48kHz));
|
||||
output_sample_rate_ = static_cast<int>(*out_len / 10 * 1000);
|
||||
EXPECT_EQ(output_sample_rate_, neteq_->last_output_sample_rate_hz());
|
||||
|
||||
|
@ -548,6 +554,34 @@ TEST_F(NetEqDecodingTest, MAYBE_TestBitExactness) {
|
|||
}
|
||||
}
|
||||
|
||||
#if !defined(WEBRTC_IOS) && !defined(WEBRTC_ANDROID) && \
|
||||
defined(WEBRTC_NETEQ_UNITTEST_BITEXACT) && \
|
||||
defined(WEBRTC_CODEC_OPUS)
|
||||
#define MAYBE_TestOpusBitExactness TestOpusBitExactness
|
||||
#else
|
||||
#define MAYBE_TestOpusBitExactness DISABLED_TestOpusBitExactness
|
||||
#endif
|
||||
TEST_F(NetEqDecodingTest, MAYBE_TestOpusBitExactness) {
|
||||
const std::string input_rtp_file =
|
||||
webrtc::test::ResourcePath("audio_coding/neteq_opus", "rtp");
|
||||
const std::string input_ref_file =
|
||||
webrtc::test::ResourcePath("audio_coding/neteq4_opus_ref", "pcm");
|
||||
const std::string network_stat_ref_file =
|
||||
webrtc::test::ResourcePath("audio_coding/neteq4_opus_network_stats",
|
||||
"dat");
|
||||
const std::string rtcp_stat_ref_file =
|
||||
webrtc::test::ResourcePath("audio_coding/neteq4_opus_rtcp_stats", "dat");
|
||||
|
||||
if (FLAGS_gen_ref) {
|
||||
DecodeAndCompare(input_rtp_file, "", "", "");
|
||||
} else {
|
||||
DecodeAndCompare(input_rtp_file,
|
||||
input_ref_file,
|
||||
network_stat_ref_file,
|
||||
rtcp_stat_ref_file);
|
||||
}
|
||||
}
|
||||
|
||||
// Use fax mode to avoid time-scaling. This is to simplify the testing of
|
||||
// packet waiting times in the packet buffer.
|
||||
class NetEqDecodingTestFaxMode : public NetEqDecodingTest {
|
||||
|
|
Loading…
Reference in a new issue