Home | History | Annotate | Download | only in neteq

Lines Matching refs:event

42 // |     event     |E|R| volume    |          duration             |
46 // - event: The event field is a number between 0 and 255 identifying a
47 // specific telephony event. The buffer will not accept any event
50 // packet contains the end of the event. For long-lasting events
59 // - duration: The duration field indicates the duration of the event or segment
61 // integer in network byte order. For a non-zero value, the event
64 // The event may or may not have ended. If the event duration
66 // event is split into several contiguous segments. The buffer will
72 DtmfEvent* event) {
74 RTC_CHECK(event);
80 event->event_no = payload[0];
81 event->end_bit = ((payload[1] & 0x80) != 0);
82 event->volume = (payload[1] & 0x3F);
83 event->duration = payload[2] << 8 | payload[3];
84 event->timestamp = rtp_timestamp;
88 // Inserts a DTMF event into the buffer. The event should be parsed from the
91 // DTMF events can be quite long, and in most cases the duration of the event
94 // event as it is being created (typically, as the user is pressing the key).
95 // These packets will all share the same start timestamp and event number,
97 // inserting a new event, the InsertEvent method tries to find a matching event
98 // already in the buffer. If so, the new event is simply merged with the
100 int DtmfBuffer::InsertEvent(const DtmfEvent& event) {
101 if (event.event_no < 0 || event.event_no > 15 ||
102 event.volume < 0 || event.volume > 36 ||
103 event.duration <= 0 || event.duration > 65535) {
109 if (MergeEvents(it, event)) {
110 // A matching event was found and the new event was merged.
115 buffer_.push_back(event);
121 bool DtmfBuffer::GetEvent(uint32_t current_timestamp, DtmfEvent* event) {
124 // |event_end| is an estimate of where the current event ends. If the end
125 // bit is set, we know that the event ends at |timestamp| + |duration|.
131 // If the end bit is not set, we allow extrapolation of the event for
137 // If there is a next event in the buffer, we will not extrapolate over
138 // the start of that new event.
147 // Found a matching event.
148 if (event) {
149 event->event_no = it->event_no;
150 event->end_bit = it->end_bit;
151 event->volume = it->volume;
152 event->duration = it->duration;
153 event->timestamp = it->timestamp;
158 // We are done playing this. Erase the event.
164 // Erase old event. Operation returns a valid pointer to the next element
168 if (event) {
169 event->event_no = it->event_no;
170 event->end_bit = it->end_bit;
171 event->volume = it->volume;
172 event->duration = it->duration;
173 event->timestamp = it->timestamp;
211 // The are defined as equal if they share the same timestamp and event number.
219 bool DtmfBuffer::MergeEvents(DtmfList::iterator it, const DtmfEvent& event) {
220 if (SameEvent(*it, event)) {
222 // Do not extend the duration of an event for which the end bit was
224 it->duration = std::max(event.duration, it->duration);
226 if (event.end_bit) {
238 // timestamp, the event number is used to rank the two. Note that packets