Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: webrtc/media/engine/webrtcvoiceengine.cc

Issue 1798903002: Relanding https://codereview.webrtc.org/1715883002/ in pieces. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added test case Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/media/engine/webrtcvoiceengine_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // See http://tools.ietf.org/html/rfc2474 for details. 92 // See http://tools.ietf.org/html/rfc2474 for details.
93 // See also http://tools.ietf.org/html/draft-jennings-rtcweb-qos-00 93 // See also http://tools.ietf.org/html/draft-jennings-rtcweb-qos-00
94 const rtc::DiffServCodePoint kAudioDscpValue = rtc::DSCP_EF; 94 const rtc::DiffServCodePoint kAudioDscpValue = rtc::DSCP_EF;
95 95
96 // Constants from voice_engine_defines.h. 96 // Constants from voice_engine_defines.h.
97 const int kMinTelephoneEventCode = 0; // RFC4733 (Section 2.3.1) 97 const int kMinTelephoneEventCode = 0; // RFC4733 (Section 2.3.1)
98 const int kMaxTelephoneEventCode = 255; 98 const int kMaxTelephoneEventCode = 255;
99 const int kMinTelephoneEventDuration = 100; 99 const int kMinTelephoneEventDuration = 100;
100 const int kMaxTelephoneEventDuration = 60000; // Actual limit is 2^16 100 const int kMaxTelephoneEventDuration = 60000; // Actual limit is 2^16
101 101
102 const int kMinPayloadType = 0;
103 const int kMaxPayloadType = 127;
104
102 class ProxySink : public webrtc::AudioSinkInterface { 105 class ProxySink : public webrtc::AudioSinkInterface {
103 public: 106 public:
104 ProxySink(AudioSinkInterface* sink) : sink_(sink) { RTC_DCHECK(sink); } 107 ProxySink(AudioSinkInterface* sink) : sink_(sink) { RTC_DCHECK(sink); }
105 108
106 void OnData(const Data& audio) override { sink_->OnData(audio); } 109 void OnData(const Data& audio) override { sink_->OnData(audio); }
107 110
108 private: 111 private:
109 webrtc::AudioSinkInterface* sink_; 112 webrtc::AudioSinkInterface* sink_;
110 }; 113 };
111 114
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 } 1545 }
1543 1546
1544 // Utility function called from SetSendParameters() to extract current send 1547 // Utility function called from SetSendParameters() to extract current send
1545 // codec settings from the given list of codecs (originally from SDP). Both send 1548 // codec settings from the given list of codecs (originally from SDP). Both send
1546 // and receive streams may be reconfigured based on the new settings. 1549 // and receive streams may be reconfigured based on the new settings.
1547 bool WebRtcVoiceMediaChannel::SetSendCodecs( 1550 bool WebRtcVoiceMediaChannel::SetSendCodecs(
1548 const std::vector<AudioCodec>& codecs) { 1551 const std::vector<AudioCodec>& codecs) {
1549 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 1552 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
1550 // TODO(solenberg): Validate input - that payload types don't overlap, are 1553 // TODO(solenberg): Validate input - that payload types don't overlap, are
1551 // within range, filter out codecs we don't support, 1554 // within range, filter out codecs we don't support,
1552 // redundant codecs etc. 1555 // redundant codecs etc - the same way it is done for
1556 // RtpHeaderExtensions.
1553 1557
1554 // Find the DTMF telephone event "codec" payload type. 1558 // Find the DTMF telephone event "codec" payload type.
1555 dtmf_payload_type_ = rtc::Optional<int>(); 1559 dtmf_payload_type_ = rtc::Optional<int>();
1556 for (const AudioCodec& codec : codecs) { 1560 for (const AudioCodec& codec : codecs) {
1557 if (IsCodec(codec, kDtmfCodecName)) { 1561 if (IsCodec(codec, kDtmfCodecName)) {
1562 if (codec.id < kMinPayloadType || codec.id > kMaxPayloadType) {
1563 return false;
1564 }
1558 dtmf_payload_type_ = rtc::Optional<int>(codec.id); 1565 dtmf_payload_type_ = rtc::Optional<int>(codec.id);
1559 break; 1566 break;
1560 } 1567 }
1561 } 1568 }
1562 1569
1563 // Scan through the list to figure out the codec to use for sending, along 1570 // Scan through the list to figure out the codec to use for sending, along
1564 // with the proper configuration for VAD, CNG, RED, NACK and Opus-specific 1571 // with the proper configuration for VAD, CNG, RED, NACK and Opus-specific
1565 // parameters. 1572 // parameters.
1566 { 1573 {
1567 SendCodecSpec send_codec_spec; 1574 SendCodecSpec send_codec_spec;
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
2535 } 2542 }
2536 } else { 2543 } else {
2537 LOG(LS_INFO) << "Stopping playout for channel #" << channel; 2544 LOG(LS_INFO) << "Stopping playout for channel #" << channel;
2538 engine()->voe()->base()->StopPlayout(channel); 2545 engine()->voe()->base()->StopPlayout(channel);
2539 } 2546 }
2540 return true; 2547 return true;
2541 } 2548 }
2542 } // namespace cricket 2549 } // namespace cricket
2543 2550
2544 #endif // HAVE_WEBRTC_VOICE 2551 #endif // HAVE_WEBRTC_VOICE
OLDNEW
« no previous file with comments | « no previous file | webrtc/media/engine/webrtcvoiceengine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698