Reenables several NetEq unittests on android.

Several unittests were disabled on android, this CL will reenable them. One of
the tests was accidentally disabled on all platforms, and now no longer gives a
bitexact result.

BUG=webrtc:3343,webrtc:5349

Review URL: https://codereview.webrtc.org/1532903002

Cr-Commit-Position: refs/heads/master@{#11323}
This commit is contained in:
ivoc
2016-01-20 07:26:24 -08:00
committed by Commit bot
parent 32f81542c2
commit 72c08edced
7 changed files with 58 additions and 28 deletions

View File

@ -0,0 +1 @@
2853ab577fe571adfc7b18f77bbe58f1253d2019

View File

@ -0,0 +1 @@
f3f7b3d3e71d7e635240b5373b57df6a7e4ce9d4

View File

@ -0,0 +1 @@
133f5c18838c1d5c3cc61744e1e5f4d144518239

View File

@ -161,7 +161,7 @@ class NetEqStereoTest : public ::testing::TestWithParam<TestParameters> {
return next_send_time;
}
void VerifyOutput(size_t num_samples) {
virtual void VerifyOutput(size_t num_samples) {
for (size_t i = 0; i < num_samples; ++i) {
for (size_t j = 0; j < num_channels_; ++j) {
ASSERT_EQ(output_[i], output_multi_channel_[i * num_channels_ + j]) <<
@ -275,12 +275,7 @@ class NetEqStereoTestNoJitter : public NetEqStereoTest {
}
};
#if defined(WEBRTC_ANDROID)
#define MAYBE_RunTest DISABLED_RunTest
#else
#define MAYBE_RunTest RunTest
#endif
TEST_P(NetEqStereoTestNoJitter, MAYBE_RunTest) {
TEST_P(NetEqStereoTestNoJitter, RunTest) {
RunTest(8);
}
@ -305,7 +300,7 @@ class NetEqStereoTestPositiveDrift : public NetEqStereoTest {
double drift_factor;
};
TEST_P(NetEqStereoTestPositiveDrift, MAYBE_RunTest) {
TEST_P(NetEqStereoTestPositiveDrift, RunTest) {
RunTest(100);
}
@ -318,7 +313,7 @@ class NetEqStereoTestNegativeDrift : public NetEqStereoTestPositiveDrift {
}
};
TEST_P(NetEqStereoTestNegativeDrift, MAYBE_RunTest) {
TEST_P(NetEqStereoTestNegativeDrift, RunTest) {
RunTest(100);
}
@ -346,7 +341,7 @@ class NetEqStereoTestDelays : public NetEqStereoTest {
int frame_index_;
};
TEST_P(NetEqStereoTestDelays, MAYBE_RunTest) {
TEST_P(NetEqStereoTestDelays, RunTest) {
RunTest(1000);
}
@ -362,13 +357,25 @@ class NetEqStereoTestLosses : public NetEqStereoTest {
return (++frame_index_) % kLossInterval == 0;
}
// TODO(hlundin): NetEq is not giving bitexact results for these cases.
virtual void VerifyOutput(size_t num_samples) {
for (size_t i = 0; i < num_samples; ++i) {
auto first_channel_sample = output_multi_channel_[i * num_channels_];
for (size_t j = 0; j < num_channels_; ++j) {
const int kErrorMargin = 200;
EXPECT_NEAR(output_[i], output_multi_channel_[i * num_channels_ + j],
kErrorMargin)
<< "Diff in sample " << i << ", channel " << j << ".";
EXPECT_EQ(first_channel_sample,
output_multi_channel_[i * num_channels_ + j]);
}
}
}
int frame_index_;
};
// TODO(pbos): Enable on non-Android, this went failing while being accidentally
// disabled on all platforms and not just Android.
// https://bugs.chromium.org/p/webrtc/issues/detail?id=5387
TEST_P(NetEqStereoTestLosses, DISABLED_RunTest) {
TEST_P(NetEqStereoTestLosses, RunTest) {
RunTest(100);
}

View File

@ -412,6 +412,10 @@ void NetEqDecodingTest::Process(size_t* out_len) {
if (packet_->payload_length_bytes() > 0) {
WebRtcRTPHeader rtp_header;
packet_->ConvertHeader(&rtp_header);
#ifndef WEBRTC_CODEC_ISAC
// Ignore payload type 104 (iSAC-swb) if ISAC is not supported.
if (rtp_header.header.payloadType != 104)
#endif
ASSERT_EQ(0, neteq_->InsertPacket(
rtp_header,
rtc::ArrayView<const uint8_t>(
@ -515,10 +519,10 @@ void NetEqDecodingTest::PopulateCng(int frame_index,
*payload_len = 1; // Only noise level, no spectral parameters.
}
#if !defined(WEBRTC_IOS) && !defined(WEBRTC_ANDROID) && \
defined(WEBRTC_NETEQ_UNITTEST_BITEXACT) && \
#if !defined(WEBRTC_IOS) && defined(WEBRTC_NETEQ_UNITTEST_BITEXACT) && \
(defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) && \
defined(WEBRTC_CODEC_ILBC) && defined(WEBRTC_CODEC_G722)
defined(WEBRTC_CODEC_ILBC) && defined(WEBRTC_CODEC_G722) && \
!defined(WEBRTC_ARCH_ARM64)
#define MAYBE_TestBitExactness TestBitExactness
#else
#define MAYBE_TestBitExactness DISABLED_TestBitExactness
@ -929,12 +933,12 @@ TEST_F(NetEqDecodingTest, UnknownPayloadType) {
EXPECT_EQ(NetEq::kUnknownRtpPayloadType, neteq_->LastError());
}
#if defined(WEBRTC_ANDROID)
#define MAYBE_DecoderError DISABLED_DecoderError
#else
#define MAYBE_DecoderError DecoderError
#endif
#if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
#define MAYBE_DecoderError DecoderError
#else
#define MAYBE_DecoderError DISABLED_DecoderError
#endif
TEST_F(NetEqDecodingTest, MAYBE_DecoderError) {
const size_t kPayloadBytes = 100;
uint8_t payload[kPayloadBytes] = {0};
@ -955,8 +959,16 @@ TEST_F(NetEqDecodingTest, MAYBE_DecoderError) {
&samples_per_channel, &num_channels, &type));
// Verify that there is a decoder error to check.
EXPECT_EQ(NetEq::kDecoderErrorCode, neteq_->LastError());
// Code 6730 is an iSAC error code.
EXPECT_EQ(6730, neteq_->LastDecoderError());
enum NetEqDecoderError {
ISAC_LENGTH_MISMATCH = 6730,
ISAC_RANGE_ERROR_DECODE_FRAME_LENGTH = 6640
};
#if defined(WEBRTC_CODEC_ISAC)
EXPECT_EQ(ISAC_LENGTH_MISMATCH, neteq_->LastDecoderError());
#elif defined(WEBRTC_CODEC_ISACFX)
EXPECT_EQ(ISAC_RANGE_ERROR_DECODE_FRAME_LENGTH, neteq_->LastDecoderError());
#endif
// Verify that the first 160 samples are set to 0, and that the remaining
// samples are left unmodified.
static const int kExpectedOutputLength = 160; // 10 ms at 16 kHz sample rate.
@ -973,7 +985,6 @@ TEST_F(NetEqDecodingTest, MAYBE_DecoderError) {
EXPECT_EQ(1, out_data_[i]);
}
}
#endif
TEST_F(NetEqDecodingTest, GetAudioBeforeInsertPacket) {
NetEqOutputType type;
@ -1172,7 +1183,11 @@ TEST_F(NetEqBgnTestFade, RunTest) {
}
#if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
TEST_F(NetEqDecodingTest, SyncPacketInsert) {
#define MAYBE_SyncPacketInsert SyncPacketInsert
#else
#define MAYBE_SyncPacketInsert DISABLED_SyncPacketInsert
#endif
TEST_F(NetEqDecodingTest, MAYBE_SyncPacketInsert) {
WebRtcRTPHeader rtp_info;
uint32_t receive_timestamp = 0;
// For the readability use the following payloads instead of the defaults of
@ -1251,7 +1266,6 @@ TEST_F(NetEqDecodingTest, SyncPacketInsert) {
--rtp_info.header.ssrc;
EXPECT_EQ(0, neteq_->InsertSyncPacket(rtp_info, receive_timestamp));
}
#endif
// First insert several noise like packets, then sync-packets. Decoding all
// packets should not produce error, statistics should not show any packet loss

View File

@ -11,6 +11,9 @@
'variables': {
'files': [
'<(DEPTH)/data/audio_processing/output_data_fixed.pb',
'<(DEPTH)/resources/audio_coding/neteq4_network_stats_android.dat',
'<(DEPTH)/resources/audio_coding/neteq4_rtcp_stats_android.dat',
'<(DEPTH)/resources/audio_coding/neteq4_universal_ref_android.pcm',
],
},
}],

View File

@ -222,6 +222,9 @@ std::string ResourcePath(std::string name, std::string extension) {
#ifdef WEBRTC_MAC
platform = "mac";
#endif // WEBRTC_MAC
#ifdef WEBRTC_ANDROID
platform = "android";
#endif // WEBRTC_ANDROID
#ifdef WEBRTC_ARCH_64_BITS
std::string architecture = "64";