xref: /aosp_15_r20/external/webrtc/modules/audio_coding/test/TestRedFec.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2011 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 MODULES_AUDIO_CODING_TEST_TESTREDFEC_H_
12 #define MODULES_AUDIO_CODING_TEST_TESTREDFEC_H_
13 
14 #include <memory>
15 #include <string>
16 
17 #include "api/audio_codecs/audio_decoder_factory.h"
18 #include "api/audio_codecs/audio_encoder_factory.h"
19 #include "common_audio/vad/include/vad.h"
20 #include "modules/audio_coding/test/Channel.h"
21 #include "modules/audio_coding/test/PCMFile.h"
22 #include "test/scoped_key_value_config.h"
23 
24 namespace webrtc {
25 
26 class TestRedFec {
27  public:
28   explicit TestRedFec();
29   ~TestRedFec();
30 
31   void Perform();
32 
33  private:
34   void RegisterSendCodec(const std::unique_ptr<AudioCodingModule>& acm,
35                          const SdpAudioFormat& codec_format,
36                          absl::optional<Vad::Aggressiveness> vad_mode,
37                          bool use_red);
38   void Run();
39   void OpenOutFile(int16_t testNumber);
40 
41   test::ScopedKeyValueConfig field_trials_;
42   const rtc::scoped_refptr<AudioEncoderFactory> encoder_factory_;
43   const rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_;
44   std::unique_ptr<AudioCodingModule> _acmA;
45   std::unique_ptr<AudioCodingModule> _acmB;
46 
47   Channel* _channelA2B;
48 
49   PCMFile _inFileA;
50   PCMFile _outFileB;
51   int16_t _testCntr;
52 };
53 
54 }  // namespace webrtc
55 
56 #endif  // MODULES_AUDIO_CODING_TEST_TESTREDFEC_H_
57