| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 int8_t dtmf_payload_type; | 162 int8_t dtmf_payload_type; |
| 163 uint16_t packet_size_samples; | 163 uint16_t packet_size_samples; |
| 164 { | 164 { |
| 165 rtc::CritScope cs(&send_audio_critsect_); | 165 rtc::CritScope cs(&send_audio_critsect_); |
| 166 audio_level_dbov = audio_level_dbov_; | 166 audio_level_dbov = audio_level_dbov_; |
| 167 dtmf_payload_type = dtmf_payload_type_; | 167 dtmf_payload_type = dtmf_payload_type_; |
| 168 packet_size_samples = packet_size_samples_; | 168 packet_size_samples = packet_size_samples_; |
| 169 } | 169 } |
| 170 | 170 |
| 171 // Check if we have pending DTMFs to send | 171 // Check if we have pending DTMFs to send |
| 172 if (!dtmf_event_is_on_ && PendingDTMF()) { | 172 if (!dtmf_event_is_on_ && dtmf_queue_.PendingDTMF()) { |
| 173 int64_t delaySinceLastDTMF = | 173 int64_t delaySinceLastDTMF = |
| 174 clock_->TimeInMilliseconds() - dtmf_time_last_sent_; | 174 clock_->TimeInMilliseconds() - dtmf_time_last_sent_; |
| 175 | 175 |
| 176 if (delaySinceLastDTMF > 100) { | 176 if (delaySinceLastDTMF > 100) { |
| 177 // New tone to play | 177 // New tone to play |
| 178 dtmf_timestamp_ = rtp_timestamp; | 178 dtmf_timestamp_ = rtp_timestamp; |
| 179 if (NextDTMF(&key, &dtmf_length_ms, &dtmf_level_) >= 0) { | 179 if (dtmf_queue_.NextDTMF(&key, &dtmf_length_ms, &dtmf_level_) >= 0) { |
| 180 dtmf_event_first_packet_sent_ = false; | 180 dtmf_event_first_packet_sent_ = false; |
| 181 dtmf_key_ = key; | 181 dtmf_key_ = key; |
| 182 dtmf_length_samples_ = (kDtmfFrequencyHz / 1000) * dtmf_length_ms; | 182 dtmf_length_samples_ = (kDtmfFrequencyHz / 1000) * dtmf_length_ms; |
| 183 dtmf_event_is_on_ = true; | 183 dtmf_event_is_on_ = true; |
| 184 } | 184 } |
| 185 } | 185 } |
| 186 } | 186 } |
| 187 | 187 |
| 188 // A source MAY send events and coded audio packets for the same time | 188 // A source MAY send events and coded audio packets for the same time |
| 189 // but we don't support it | 189 // but we don't support it |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 int32_t RTPSenderAudio::SendTelephoneEvent(uint8_t key, | 303 int32_t RTPSenderAudio::SendTelephoneEvent(uint8_t key, |
| 304 uint16_t time_ms, | 304 uint16_t time_ms, |
| 305 uint8_t level) { | 305 uint8_t level) { |
| 306 { | 306 { |
| 307 rtc::CritScope lock(&send_audio_critsect_); | 307 rtc::CritScope lock(&send_audio_critsect_); |
| 308 if (dtmf_payload_type_ < 0) { | 308 if (dtmf_payload_type_ < 0) { |
| 309 // TelephoneEvent payloadtype not configured | 309 // TelephoneEvent payloadtype not configured |
| 310 return -1; | 310 return -1; |
| 311 } | 311 } |
| 312 } | 312 } |
| 313 return AddDTMF(key, time_ms, level); | 313 return dtmf_queue_.AddDTMF(key, time_ms, level); |
| 314 } | 314 } |
| 315 | 315 |
| 316 bool RTPSenderAudio::SendTelephoneEventPacket(bool ended, | 316 bool RTPSenderAudio::SendTelephoneEventPacket(bool ended, |
| 317 int8_t dtmf_payload_type, | 317 int8_t dtmf_payload_type, |
| 318 uint32_t dtmf_timestamp, | 318 uint32_t dtmf_timestamp, |
| 319 uint16_t duration, | 319 uint16_t duration, |
| 320 bool marker_bit) { | 320 bool marker_bit) { |
| 321 uint8_t send_count = 1; | 321 uint8_t send_count = 1; |
| 322 bool result = true; | 322 bool result = true; |
| 323 | 323 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "Audio::SendTelephoneEvent", | 365 TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "Audio::SendTelephoneEvent", |
| 366 "timestamp", packet->Timestamp(), "seqnum", packet->SequenceNumber()); | 366 "timestamp", packet->Timestamp(), "seqnum", packet->SequenceNumber()); |
| 367 result = rtp_sender_->SendToNetwork(std::move(packet), kAllowRetransmission, | 367 result = rtp_sender_->SendToNetwork(std::move(packet), kAllowRetransmission, |
| 368 RtpPacketSender::kHighPriority); | 368 RtpPacketSender::kHighPriority); |
| 369 send_count--; | 369 send_count--; |
| 370 } while (send_count > 0 && result); | 370 } while (send_count > 0 && result); |
| 371 | 371 |
| 372 return result; | 372 return result; |
| 373 } | 373 } |
| 374 } // namespace webrtc | 374 } // namespace webrtc |
| OLD | NEW |