dtmf_queue.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. #ifndef MODULES_RTP_RTCP_SOURCE_DTMF_QUEUE_H_
  11. #define MODULES_RTP_RTCP_SOURCE_DTMF_QUEUE_H_
  12. #include <stdint.h>
  13. #include <list>
  14. #include "rtc_base/synchronization/mutex.h"
  15. namespace webrtc {
  16. class DtmfQueue {
  17. public:
  18. struct Event {
  19. uint16_t duration_ms = 0;
  20. uint8_t payload_type = 0;
  21. uint8_t key = 0;
  22. uint8_t level = 0;
  23. };
  24. DtmfQueue();
  25. ~DtmfQueue();
  26. bool AddDtmf(const Event& event);
  27. bool NextDtmf(Event* event);
  28. bool PendingDtmf() const;
  29. private:
  30. mutable Mutex dtmf_mutex_;
  31. std::list<Event> queue_;
  32. };
  33. } // namespace webrtc
  34. #endif // MODULES_RTP_RTCP_SOURCE_DTMF_QUEUE_H_