| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 const int kIsacMaxBitrateBps = 56000; | 95 const int kIsacMaxBitrateBps = 56000; |
| 96 | 96 |
| 97 // Default audio dscp value. | 97 // Default audio dscp value. |
| 98 // See http://tools.ietf.org/html/rfc2474 for details. | 98 // See http://tools.ietf.org/html/rfc2474 for details. |
| 99 // See also http://tools.ietf.org/html/draft-jennings-rtcweb-qos-00 | 99 // See also http://tools.ietf.org/html/draft-jennings-rtcweb-qos-00 |
| 100 const rtc::DiffServCodePoint kAudioDscpValue = rtc::DSCP_EF; | 100 const rtc::DiffServCodePoint kAudioDscpValue = rtc::DSCP_EF; |
| 101 | 101 |
| 102 // Constants from voice_engine_defines.h. | 102 // Constants from voice_engine_defines.h. |
| 103 const int kMinTelephoneEventCode = 0; // RFC4733 (Section 2.3.1) | 103 const int kMinTelephoneEventCode = 0; // RFC4733 (Section 2.3.1) |
| 104 const int kMaxTelephoneEventCode = 255; | 104 const int kMaxTelephoneEventCode = 255; |
| 105 const int kMinTelephoneEventDuration = 100; | |
| 106 const int kMaxTelephoneEventDuration = 60000; // Actual limit is 2^16 | |
| 107 | 105 |
| 108 const int kMinPayloadType = 0; | 106 const int kMinPayloadType = 0; |
| 109 const int kMaxPayloadType = 127; | 107 const int kMaxPayloadType = 127; |
| 110 | 108 |
| 111 class ProxySink : public webrtc::AudioSinkInterface { | 109 class ProxySink : public webrtc::AudioSinkInterface { |
| 112 public: | 110 public: |
| 113 ProxySink(AudioSinkInterface* sink) : sink_(sink) { RTC_DCHECK(sink); } | 111 ProxySink(AudioSinkInterface* sink) : sink_(sink) { RTC_DCHECK(sink); } |
| 114 | 112 |
| 115 void OnData(const Data& audio) override { sink_->OnData(audio); } | 113 void OnData(const Data& audio) override { sink_->OnData(audio); } |
| 116 | 114 |
| (...skipping 2322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2439 auto it = ssrc != 0 ? send_streams_.find(ssrc) : send_streams_.begin(); | 2437 auto it = ssrc != 0 ? send_streams_.find(ssrc) : send_streams_.begin(); |
| 2440 if (it == send_streams_.end()) { | 2438 if (it == send_streams_.end()) { |
| 2441 LOG(LS_WARNING) << "The specified ssrc " << ssrc << " is not in use."; | 2439 LOG(LS_WARNING) << "The specified ssrc " << ssrc << " is not in use."; |
| 2442 return false; | 2440 return false; |
| 2443 } | 2441 } |
| 2444 if (event < kMinTelephoneEventCode || | 2442 if (event < kMinTelephoneEventCode || |
| 2445 event > kMaxTelephoneEventCode) { | 2443 event > kMaxTelephoneEventCode) { |
| 2446 LOG(LS_WARNING) << "DTMF event code " << event << " out of range."; | 2444 LOG(LS_WARNING) << "DTMF event code " << event << " out of range."; |
| 2447 return false; | 2445 return false; |
| 2448 } | 2446 } |
| 2449 if (duration < kMinTelephoneEventDuration || | |
| 2450 duration > kMaxTelephoneEventDuration) { | |
| 2451 LOG(LS_WARNING) << "DTMF event duration " << duration << " out of range."; | |
| 2452 return false; | |
| 2453 } | |
| 2454 RTC_DCHECK_NE(-1, dtmf_payload_freq_); | 2447 RTC_DCHECK_NE(-1, dtmf_payload_freq_); |
| 2455 return it->second->SendTelephoneEvent(*dtmf_payload_type_, dtmf_payload_freq_, | 2448 return it->second->SendTelephoneEvent(*dtmf_payload_type_, dtmf_payload_freq_, |
| 2456 event, duration); | 2449 event, duration); |
| 2457 } | 2450 } |
| 2458 | 2451 |
| 2459 void WebRtcVoiceMediaChannel::OnPacketReceived( | 2452 void WebRtcVoiceMediaChannel::OnPacketReceived( |
| 2460 rtc::CopyOnWriteBuffer* packet, const rtc::PacketTime& packet_time) { | 2453 rtc::CopyOnWriteBuffer* packet, const rtc::PacketTime& packet_time) { |
| 2461 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 2454 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 2462 | 2455 |
| 2463 const webrtc::PacketTime webrtc_packet_time(packet_time.timestamp, | 2456 const webrtc::PacketTime webrtc_packet_time(packet_time.timestamp, |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2698 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 2691 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 2699 const auto it = send_streams_.find(ssrc); | 2692 const auto it = send_streams_.find(ssrc); |
| 2700 if (it != send_streams_.end()) { | 2693 if (it != send_streams_.end()) { |
| 2701 return it->second->channel(); | 2694 return it->second->channel(); |
| 2702 } | 2695 } |
| 2703 return -1; | 2696 return -1; |
| 2704 } | 2697 } |
| 2705 } // namespace cricket | 2698 } // namespace cricket |
| 2706 | 2699 |
| 2707 #endif // HAVE_WEBRTC_VOICE | 2700 #endif // HAVE_WEBRTC_VOICE |
| OLD | NEW |