iSACTest.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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_ISACTEST_H_
  11. #define MODULES_AUDIO_CODING_TEST_ISACTEST_H_
  12. #include <string.h>
  13. #include <memory>
  14. #include "modules/audio_coding/include/audio_coding_module.h"
  15. #include "modules/audio_coding/test/Channel.h"
  16. #include "modules/audio_coding/test/PCMFile.h"
  17. namespace webrtc {
  18. struct ACMTestISACConfig {
  19. int32_t currentRateBitPerSec;
  20. int16_t currentFrameSizeMsec;
  21. int16_t encodingMode;
  22. uint32_t initRateBitPerSec;
  23. int16_t initFrameSizeInMsec;
  24. bool enforceFrameSize;
  25. };
  26. class ISACTest {
  27. public:
  28. ISACTest();
  29. ~ISACTest();
  30. void Perform();
  31. private:
  32. class ACMTestTimer {
  33. public:
  34. ACMTestTimer();
  35. ~ACMTestTimer();
  36. void Reset();
  37. void Tick10ms();
  38. void Tick1ms();
  39. void Tick100ms();
  40. void Tick1sec();
  41. void CurrentTimeHMS(char* currTime);
  42. void CurrentTime(unsigned long& h,
  43. unsigned char& m,
  44. unsigned char& s,
  45. unsigned short& ms);
  46. private:
  47. void Adjust();
  48. unsigned short _msec;
  49. unsigned char _sec;
  50. unsigned char _min;
  51. unsigned long _hour;
  52. };
  53. void Setup();
  54. void Run10ms();
  55. void EncodeDecode(int testNr,
  56. ACMTestISACConfig& wbISACConfig,
  57. ACMTestISACConfig& swbISACConfig);
  58. void SwitchingSamplingRate(int testNr, int maxSampRateChange);
  59. std::unique_ptr<AudioCodingModule> _acmA;
  60. std::unique_ptr<AudioCodingModule> _acmB;
  61. std::unique_ptr<Channel> _channel_A2B;
  62. std::unique_ptr<Channel> _channel_B2A;
  63. PCMFile _inFileA;
  64. PCMFile _inFileB;
  65. PCMFile _outFileA;
  66. PCMFile _outFileB;
  67. std::string file_name_swb_;
  68. ACMTestTimer _myTimer;
  69. };
  70. } // namespace webrtc
  71. #endif // MODULES_AUDIO_CODING_TEST_ISACTEST_H_