audio_webrtc_transport.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /* Copyright (C) 2012 Doubango Telecom <http://www.doubango.org>
  2. *
  3. * This file is part of Open Source Doubango Framework.
  4. *
  5. * DOUBANGO is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * DOUBANGO is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with DOUBANGO.
  17. */
  18. #ifndef DOUBANGO_AUDIO_WEBRTC_TRANSPORT_H
  19. #define DOUBANGO_AUDIO_WEBRTC_TRANSPORT_H
  20. #include "audio_webrtc_config.h"
  21. #include <webrtc/audio_device.h>
  22. class AudioTransportImpl: public webrtc::AudioTransport
  23. {
  24. public:
  25. virtual WebRtc_Word32
  26. RecordedDataIsAvailable(const void* audioSamples,
  27. const WebRtc_UWord32 nSamples,
  28. const WebRtc_UWord8 nBytesPerSample,
  29. const WebRtc_UWord8 nChannels,
  30. const WebRtc_UWord32 samplesPerSec,
  31. const WebRtc_UWord32 totalDelayMS,
  32. const WebRtc_Word32 clockDrift,
  33. const WebRtc_UWord32 currentMicLevel,
  34. WebRtc_UWord32& newMicLevel);
  35. virtual WebRtc_Word32 NeedMorePlayData(const WebRtc_UWord32 nSamples,
  36. const WebRtc_UWord8 nBytesPerSample,
  37. const WebRtc_UWord8 nChannels,
  38. const WebRtc_UWord32 samplesPerSec,
  39. void* audioSamples,
  40. WebRtc_UWord32& nSamplesOut);
  41. AudioTransportImpl(webrtc::AudioDeviceModule* audioDevice);
  42. ~AudioTransportImpl();
  43. public:
  44. void SetFullDuplex(bool enable);
  45. void SetSpeakerVolume(bool enable) {
  46. _speakerVolume = enable;
  47. }
  48. ;
  49. void SetSpeakerMute(bool enable) {
  50. _speakerMute = enable;
  51. }
  52. ;
  53. void SetMicrophoneMute(bool enable) {
  54. _microphoneMute = enable;
  55. }
  56. ;
  57. void SetMicrophoneVolume(bool enable) {
  58. _microphoneVolume = enable;
  59. }
  60. ;
  61. void SetMicrophoneBoost(bool enable) {
  62. _microphoneBoost = enable;
  63. }
  64. ;
  65. void SetLoopbackMeasurements(bool enable) {
  66. _loopBackMeasurements = enable;
  67. }
  68. ;
  69. void SetMicrophoneAGC(bool enable) {
  70. _microphoneAGC = enable;
  71. }
  72. ;
  73. void SetConsumer(const struct audio_consumer_webrtc_s* consumer) {
  74. _consumer = consumer;
  75. }
  76. ;
  77. void SetProducer(const struct audio_producer_webrtc_s* producer) {
  78. _producer = producer;
  79. }
  80. ;
  81. private:
  82. webrtc::AudioDeviceModule* _audioDevice;
  83. const struct audio_consumer_webrtc_s* _consumer; // mut be const and must not take reference
  84. const struct audio_producer_webrtc_s* _producer; // mut be const and must not take reference
  85. bool _fullDuplex;
  86. bool _speakerVolume;
  87. bool _speakerMute;
  88. bool _microphoneVolume;
  89. bool _microphoneMute;
  90. bool _microphoneBoost;
  91. bool _microphoneAGC;
  92. bool _loopBackMeasurements;
  93. };
  94. #endif /* DOUBANGO_AUDIO_WEBRTC_TRANSPORT_H */