• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
11 #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_TEST_PACKETLOSSTEST_H_
12 #define WEBRTC_MODULES_AUDIO_CODING_MAIN_TEST_PACKETLOSSTEST_H_
13 
14 #include <string>
15 #include "webrtc/modules/audio_coding/main/test/EncodeDecodeTest.h"
16 #include "webrtc/system_wrappers/interface/scoped_ptr.h"
17 
18 namespace webrtc {
19 
20 class ReceiverWithPacketLoss : public Receiver {
21  public:
22   ReceiverWithPacketLoss();
23   void Setup(AudioCodingModule *acm, RTPStream *rtpStream,
24              std::string out_file_name, int channels, int loss_rate,
25              int burst_length);
26   bool IncomingPacket() OVERRIDE;
27  protected:
28   bool PacketLost();
29   int loss_rate_;
30   int burst_length_;
31   int packet_counter_;
32   int lost_packet_counter_;
33   int burst_lost_counter_;
34 };
35 
36 class SenderWithFEC : public Sender {
37  public:
38   SenderWithFEC();
39   void Setup(AudioCodingModule *acm, RTPStream *rtpStream,
40              std::string in_file_name, int sample_rate, int channels,
41              int expected_loss_rate);
42   bool SetPacketLossRate(int expected_loss_rate);
43   bool SetFEC(bool enable_fec);
44  protected:
45   int expected_loss_rate_;
46 };
47 
48 class PacketLossTest : public ACMTest {
49  public:
50   PacketLossTest(int channels, int expected_loss_rate_, int actual_loss_rate,
51                  int burst_length);
52   void Perform();
53  protected:
54   int channels_;
55   std::string in_file_name_;
56   int sample_rate_hz_;
57   scoped_ptr<SenderWithFEC> sender_;
58   scoped_ptr<ReceiverWithPacketLoss> receiver_;
59   int expected_loss_rate_;
60   int actual_loss_rate_;
61   int burst_length_;
62 };
63 
64 }  // namespace webrtc
65 
66 #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_TEST_PACKETLOSSTEST_H_
67