blob: af546dc2309c760cb24ae698a1c4502518d5f780 [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
11#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_DTMF_QUEUE_H_
12#define WEBRTC_MODULES_RTP_RTCP_SOURCE_DTMF_QUEUE_H_
13
solenbergffbbcac2016-11-17 05:25:37 -080014#include <list>
15
danilchap7c9426c2016-04-14 03:05:31 -070016#include "webrtc/base/criticalsection.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000017
18namespace webrtc {
solenbergffbbcac2016-11-17 05:25:37 -080019class DtmfQueue {
phoglund@webrtc.org315d3982013-05-08 10:04:06 +000020 public:
solenbergffbbcac2016-11-17 05:25:37 -080021 struct Event {
22 uint16_t duration_ms = 0;
23 uint8_t payload_type = 0;
24 uint8_t key = 0;
25 uint8_t level = 0;
26 };
niklase@google.com470e71d2011-07-07 08:21:25 +000027
solenbergffbbcac2016-11-17 05:25:37 -080028 DtmfQueue();
29 ~DtmfQueue();
30
31 bool AddDtmf(const Event& event);
32 bool NextDtmf(Event* event);
33 bool PendingDtmf() const;
niklase@google.com470e71d2011-07-07 08:21:25 +000034
phoglund@webrtc.org315d3982013-05-08 10:04:06 +000035 private:
danilchap7c9426c2016-04-14 03:05:31 -070036 rtc::CriticalSection dtmf_critsect_;
solenbergffbbcac2016-11-17 05:25:37 -080037 std::list<Event> queue_;
niklase@google.com470e71d2011-07-07 08:21:25 +000038};
phoglund@webrtc.org315d3982013-05-08 10:04:06 +000039} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000040
phoglund@webrtc.org315d3982013-05-08 10:04:06 +000041#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_DTMF_QUEUE_H_