Fix audio/video sync when FEC is enabled.

Also improves the tests by adding a test case for FEC, and running the a/v sync
tests with NACK and simulated packet loss.

BUG=crbug/374104
R=mflodman@webrtc.org, pbos@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7053 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org 2014-09-04 06:48:14 +00:00
parent bfd7a8c448
commit 01581da711
6 changed files with 26 additions and 8 deletions

View File

@ -159,6 +159,8 @@ const unsigned int CallTest::kLongTimeoutMs = 120 * 1000;
const uint8_t CallTest::kSendPayloadType = 100;
const uint8_t CallTest::kFakeSendPayloadType = 125;
const uint8_t CallTest::kSendRtxPayloadType = 98;
const uint8_t CallTest::kRedPayloadType = 118;
const uint8_t CallTest::kUlpfecPayloadType = 119;
const uint32_t CallTest::kSendRtxSsrcs[kNumSsrcs] = {0xBADCAFD, 0xBADCAFE,
0xBADCAFF};
const uint32_t CallTest::kSendSsrcs[kNumSsrcs] = {0xC0FFED, 0xC0FFEE, 0xC0FFEF};

View File

@ -36,6 +36,8 @@ class CallTest : public ::testing::Test {
static const uint8_t kSendPayloadType;
static const uint8_t kSendRtxPayloadType;
static const uint8_t kFakeSendPayloadType;
static const uint8_t kRedPayloadType;
static const uint8_t kUlpfecPayloadType;
static const uint32_t kSendRtxSsrcs[kNumSsrcs];
static const uint32_t kSendSsrcs[kNumSsrcs];
static const uint32_t kReceiverLocalSsrc;

View File

@ -48,6 +48,8 @@ namespace webrtc {
class CallPerfTest : public test::CallTest {
protected:
void TestAudioVideoSync(bool fec);
void TestMinTransmitBitrate(bool pad_to_min_bitrate);
void TestCaptureNtpTime(const FakeNetworkPipe::Config& net_config,
@ -188,7 +190,7 @@ class VideoRtcpAndSyncObserver : public SyncRtcpObserver, public VideoRenderer {
int64_t first_time_in_sync_;
};
TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSync) {
void CallPerfTest::TestAudioVideoSync(bool fec) {
class AudioPacketReceiver : public PacketReceiver {
public:
AudioPacketReceiver(int channel, VoENetwork* voe_network)
@ -229,6 +231,7 @@ TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSync) {
FakeNetworkPipe::Config net_config;
net_config.queue_delay_ms = 500;
net_config.loss_percent = 5;
SyncRtcpObserver audio_observer(net_config);
VideoRtcpAndSyncObserver observer(Clock::GetRealTimeClock(),
channel,
@ -257,6 +260,14 @@ TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSync) {
CreateSendConfig(1);
CreateMatchingReceiveConfigs();
send_config_.rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
if (fec) {
send_config_.rtp.fec.red_payload_type = kRedPayloadType;
send_config_.rtp.fec.ulpfec_payload_type = kUlpfecPayloadType;
receive_configs_[0].rtp.fec.red_payload_type = kRedPayloadType;
receive_configs_[0].rtp.fec.ulpfec_payload_type = kUlpfecPayloadType;
}
receive_configs_[0].rtp.nack.rtp_history_ms = 1000;
receive_configs_[0].renderer = &observer;
receive_configs_[0].audio_channel_id = channel;
@ -294,6 +305,14 @@ TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSync) {
VoiceEngine::Delete(voice_engine);
}
TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSync) {
TestAudioVideoSync(false);
}
TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSyncWithFec) {
TestAudioVideoSync(true);
}
void CallPerfTest::TestCaptureNtpTime(const FakeNetworkPipe::Config& net_config,
int threshold_ms,
int start_time_ms,

View File

@ -44,8 +44,6 @@
namespace webrtc {
static const unsigned long kSilenceTimeoutMs = 2000;
static const int kRedPayloadType = 118;
static const int kUlpfecPayloadType = 119;
class EndToEndTest : public test::CallTest {
public:

View File

@ -311,8 +311,6 @@ TEST_F(VideoSendStreamTest, SwapsI420VideoFrames) {
}
TEST_F(VideoSendStreamTest, SupportsFec) {
static const int kRedPayloadType = 118;
static const int kUlpfecPayloadType = 119;
class FecObserver : public test::SendTest {
public:
FecObserver()
@ -486,8 +484,6 @@ void VideoSendStreamTest::TestPacketFragmentationSize(VideoFormat format,
static const uint32_t start = 90;
static const uint32_t stop = 290;
static const int kRedPayloadType = 118;
static const int kUlpfecPayloadType = 119;
// Observer that verifies that the expected number of packets and bytes
// arrive for each frame size, from start_size to stop_size.
class FrameFragmentationTest : public test::SendTest,

View File

@ -193,7 +193,8 @@ bool ViEReceiver::OnRecoveredPacket(const uint8_t* rtp_packet,
return false;
}
header.payload_type_frequency = kVideoPayloadTypeFrequency;
return ReceivePacket(rtp_packet, rtp_packet_length, header, false);
bool in_order = IsPacketInOrder(header);
return ReceivePacket(rtp_packet, rtp_packet_length, header, in_order);
}
void ViEReceiver::ReceivedBWEPacket(