blob: b26f6ec4ba35cd83b2bdedad572e218859d1e1be [file] [log] [blame]
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +00001/*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_AUDIO_CODING_TEST_PACKETLOSSTEST_H_
12#define MODULES_AUDIO_CODING_TEST_PACKETLOSSTEST_H_
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +000013
14#include <string>
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020015#include "modules/audio_coding/test/EncodeDecodeTest.h"
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +000016
17namespace webrtc {
18
19class ReceiverWithPacketLoss : public Receiver {
20 public:
21 ReceiverWithPacketLoss();
Yves Gerey665174f2018-06-19 15:03:05 +020022 void Setup(AudioCodingModule* acm,
23 RTPStream* rtpStream,
24 std::string out_file_name,
25 int channels,
Fredrik Solenberg657b2962018-12-05 10:30:25 +010026 int file_num,
Yves Gerey665174f2018-06-19 15:03:05 +020027 int loss_rate,
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +000028 int burst_length);
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000029 bool IncomingPacket() override;
30
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +000031 protected:
32 bool PacketLost();
33 int loss_rate_;
34 int burst_length_;
35 int packet_counter_;
36 int lost_packet_counter_;
37 int burst_lost_counter_;
38};
39
40class SenderWithFEC : public Sender {
41 public:
42 SenderWithFEC();
Yves Gerey665174f2018-06-19 15:03:05 +020043 void Setup(AudioCodingModule* acm,
44 RTPStream* rtpStream,
45 std::string in_file_name,
Fredrik Solenberg657b2962018-12-05 10:30:25 +010046 int payload_type,
47 SdpAudioFormat format,
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +000048 int expected_loss_rate);
49 bool SetPacketLossRate(int expected_loss_rate);
50 bool SetFEC(bool enable_fec);
Yves Gerey665174f2018-06-19 15:03:05 +020051
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +000052 protected:
53 int expected_loss_rate_;
54};
55
Karl Wiberg3ff52ff2018-10-01 12:31:22 +020056class PacketLossTest {
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +000057 public:
Yves Gerey665174f2018-06-19 15:03:05 +020058 PacketLossTest(int channels,
59 int expected_loss_rate_,
60 int actual_loss_rate,
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +000061 int burst_length);
62 void Perform();
Yves Gerey665174f2018-06-19 15:03:05 +020063
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +000064 protected:
65 int channels_;
66 std::string in_file_name_;
67 int sample_rate_hz_;
minyue@webrtc.orgaa5ea1c2014-05-23 15:16:51 +000068 int expected_loss_rate_;
69 int actual_loss_rate_;
70 int burst_length_;
71};
72
73} // namespace webrtc
74
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020075#endif // MODULES_AUDIO_CODING_TEST_PACKETLOSSTEST_H_