Adding DTX to WebRTC Opus wrapper

This is a step toward adding Opus DTX support in WebRTC.

Note that opus_encode() returns 1 byte in case of DTX, then the packet does not need to be transmitted. See

https://mf4.xiph.org/jenkins/view/opus/job/opus/ws/doc/html/group__opus__encoder.html

We transmit the first 1-byte packet to let decoder be in-sync

BUG=webrtc:1014
R=henrik.lundin@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/13219004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7846 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
minyue@webrtc.org
2014-12-09 13:27:39 +00:00
parent 5c3ee4bce6
commit 4321f175f1
5 changed files with 390 additions and 108 deletions

View File

@ -111,6 +111,8 @@ static const bool runtime_dummy =
DEFINE_bool(fec, true, "Whether to enable FEC for encoding.");
DEFINE_bool(dtx, true, "Whether to enable DTX for encoding.");
class NetEqOpusFecQualityTest : public NetEqQualityTest {
protected:
NetEqOpusFecQualityTest();
@ -123,6 +125,7 @@ class NetEqOpusFecQualityTest : public NetEqQualityTest {
int channels_;
int bit_rate_kbps_;
bool fec_;
bool dtx_;
int target_loss_rate_;
};
@ -137,6 +140,7 @@ NetEqOpusFecQualityTest::NetEqOpusFecQualityTest()
channels_(FLAGS_channels),
bit_rate_kbps_(FLAGS_bit_rate_kbps),
fec_(FLAGS_fec),
dtx_(FLAGS_dtx),
target_loss_rate_(FLAGS_reported_loss_rate) {
}
@ -149,6 +153,9 @@ void NetEqOpusFecQualityTest::SetUp() {
if (fec_) {
EXPECT_EQ(0, WebRtcOpus_EnableFec(opus_encoder_));
}
if (dtx_) {
EXPECT_EQ(0, WebRtcOpus_EnableDtx(opus_encoder_));
}
EXPECT_EQ(0, WebRtcOpus_SetPacketLossRate(opus_encoder_,
target_loss_rate_));
NetEqQualityTest::SetUp();
@ -166,7 +173,6 @@ int NetEqOpusFecQualityTest::EncodeBlock(int16_t* in_data,
int value = WebRtcOpus_Encode(opus_encoder_, in_data,
block_size_samples, max_bytes,
payload);
EXPECT_GT(value, 0);
return value;
}