blob: e5955a1297c44383da19c55d413885ad3fd21ff3 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_RTP_RTCP_SOURCE_DTMF_QUEUE_H_
12#define MODULES_RTP_RTCP_SOURCE_DTMF_QUEUE_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
Yves Gerey988cc082018-10-23 12:03:01 +020014#include <stdint.h>
solenbergffbbcac2016-11-17 05:25:37 -080015#include <list>
16
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020017#include "rtc_base/criticalsection.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000018
19namespace webrtc {
solenbergffbbcac2016-11-17 05:25:37 -080020class DtmfQueue {
phoglund@webrtc.org315d3982013-05-08 10:04:06 +000021 public:
solenbergffbbcac2016-11-17 05:25:37 -080022 struct Event {
23 uint16_t duration_ms = 0;
24 uint8_t payload_type = 0;
25 uint8_t key = 0;
26 uint8_t level = 0;
27 };
niklase@google.com470e71d2011-07-07 08:21:25 +000028
solenbergffbbcac2016-11-17 05:25:37 -080029 DtmfQueue();
30 ~DtmfQueue();
31
32 bool AddDtmf(const Event& event);
33 bool NextDtmf(Event* event);
34 bool PendingDtmf() const;
niklase@google.com470e71d2011-07-07 08:21:25 +000035
phoglund@webrtc.org315d3982013-05-08 10:04:06 +000036 private:
danilchap7c9426c2016-04-14 03:05:31 -070037 rtc::CriticalSection dtmf_critsect_;
solenbergffbbcac2016-11-17 05:25:37 -080038 std::list<Event> queue_;
niklase@google.com470e71d2011-07-07 08:21:25 +000039};
phoglund@webrtc.org315d3982013-05-08 10:04:06 +000040} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000041
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020042#endif // MODULES_RTP_RTCP_SOURCE_DTMF_QUEUE_H_