opus_test.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright (c) 2012 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. #ifndef MODULES_AUDIO_CODING_TEST_OPUS_TEST_H_
  11. #define MODULES_AUDIO_CODING_TEST_OPUS_TEST_H_
  12. #include <math.h>
  13. #include <memory>
  14. #include "modules/audio_coding/acm2/acm_resampler.h"
  15. #include "modules/audio_coding/codecs/opus/opus_interface.h"
  16. #include "modules/audio_coding/test/PCMFile.h"
  17. #include "modules/audio_coding/test/TestStereo.h"
  18. namespace webrtc {
  19. class OpusTest {
  20. public:
  21. OpusTest();
  22. ~OpusTest();
  23. void Perform();
  24. private:
  25. void Run(TestPackStereo* channel,
  26. size_t channels,
  27. int bitrate,
  28. size_t frame_length,
  29. int percent_loss = 0);
  30. void OpenOutFile(int test_number);
  31. std::unique_ptr<AudioCodingModule> acm_receiver_;
  32. TestPackStereo* channel_a2b_;
  33. PCMFile in_file_stereo_;
  34. PCMFile in_file_mono_;
  35. PCMFile out_file_;
  36. PCMFile out_file_standalone_;
  37. int counter_;
  38. uint8_t payload_type_;
  39. uint32_t rtp_timestamp_;
  40. acm2::ACMResampler resampler_;
  41. WebRtcOpusEncInst* opus_mono_encoder_;
  42. WebRtcOpusEncInst* opus_stereo_encoder_;
  43. WebRtcOpusDecInst* opus_mono_decoder_;
  44. WebRtcOpusDecInst* opus_stereo_decoder_;
  45. };
  46. } // namespace webrtc
  47. #endif // MODULES_AUDIO_CODING_TEST_OPUS_TEST_H_