Index: webrtc/modules/rtp_rtcp/source/dtmf_queue.cc |
diff --git a/webrtc/modules/rtp_rtcp/source/dtmf_queue.cc b/webrtc/modules/rtp_rtcp/source/dtmf_queue.cc |
index f73be079d5e17a87bd2634ffbfe8064ef1e4c658..d711f25f6f4ffd721ca825091b4654b588eb916c 100644 |
--- a/webrtc/modules/rtp_rtcp/source/dtmf_queue.cc |
+++ b/webrtc/modules/rtp_rtcp/source/dtmf_queue.cc |
@@ -9,54 +9,36 @@ |
*/ |
#include "webrtc/modules/rtp_rtcp/source/dtmf_queue.h" |
- |
-#include <string.h> |
+#include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" |
hlundin-webrtc
2016/10/28 08:12:36
I'd rather you moved DTMF_OUTBAND_MAX to this file
the sun
2016/11/07 13:33:31
Agree.
|
namespace webrtc { |
-DTMFqueue::DTMFqueue() : next_empty_index_(0) { |
- memset(dtmf_key_, 0, sizeof(dtmf_key_)); |
- memset(dtmf_length, 0, sizeof(dtmf_length)); |
- memset(dtmf_level_, 0, sizeof(dtmf_level_)); |
-} |
+DTMFQueue::DTMFQueue() {} |
-DTMFqueue::~DTMFqueue() {} |
+DTMFQueue::~DTMFQueue() {} |
-int32_t DTMFqueue::AddDTMF(uint8_t key, uint16_t len, uint8_t level) { |
+int DTMFQueue::AddDTMF(const Event& event) { |
hlundin-webrtc
2016/10/28 08:12:36
This looks like a bool-returning method to me.
the sun
2016/11/07 13:33:31
Done.
|
rtc::CritScope lock(&dtmf_critsect_); |
- |
- if (next_empty_index_ >= DTMF_OUTBAND_MAX) { |
+ if (queue_.size() >= DTMF_OUTBAND_MAX) { |
hlundin-webrtc
2016/10/28 08:12:36
Probably no longer needed as such, since queue_ is
the sun
2016/11/07 13:33:31
Yes.
|
return -1; |
} |
- int32_t index = next_empty_index_; |
- dtmf_key_[index] = key; |
- dtmf_length[index] = len; |
- dtmf_level_[index] = level; |
- next_empty_index_++; |
+ queue_.push_back(event); |
return 0; |
} |
-int8_t DTMFqueue::NextDTMF(uint8_t* dtmf_key, uint16_t* len, uint8_t* level) { |
+int DTMFQueue::NextDTMF(Event* event) { |
hlundin-webrtc
2016/10/28 08:12:36
Wouldn't hurt to change this to return an rtc::Opt
the sun
2016/11/07 13:33:31
Changed it at first, but decided against. since it
hlundin-webrtc
2016/11/08 09:01:59
Acknowledged.
|
+ RTC_DCHECK(event); |
rtc::CritScope lock(&dtmf_critsect_); |
- if (next_empty_index_ == 0) |
+ if (queue_.empty()) { |
return -1; |
+ } |
- *dtmf_key = dtmf_key_[0]; |
- *len = dtmf_length[0]; |
- *level = dtmf_level_[0]; |
- |
- memmove(&(dtmf_key_[0]), &(dtmf_key_[1]), |
- next_empty_index_ * sizeof(uint8_t)); |
- memmove(&(dtmf_length[0]), &(dtmf_length[1]), |
- next_empty_index_ * sizeof(uint16_t)); |
- memmove(&(dtmf_level_[0]), &(dtmf_level_[1]), |
- next_empty_index_ * sizeof(uint8_t)); |
- |
- next_empty_index_--; |
+ *event = queue_.front(); |
+ queue_.pop_front(); |
return 0; |
} |
-bool DTMFqueue::PendingDTMF() { |
+bool DTMFQueue::PendingDTMF() { |
rtc::CritScope lock(&dtmf_critsect_); |
- return next_empty_index_ > 0; |
+ return !queue_.empty(); |
} |
} // namespace webrtc |