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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/media/engine/webrtcvoiceengine_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/engine/webrtcvoiceengine.cc
diff --git a/webrtc/media/engine/webrtcvoiceengine.cc b/webrtc/media/engine/webrtcvoiceengine.cc
index a496316b42149637757846ec3e20f89b32915f02..016323892c841ca64310b8fdc8806caaecf83208 100644
--- a/webrtc/media/engine/webrtcvoiceengine.cc
+++ b/webrtc/media/engine/webrtcvoiceengine.cc
@@ -99,6 +99,9 @@ const int kMaxTelephoneEventCode = 255;
const int kMinTelephoneEventDuration = 100;
const int kMaxTelephoneEventDuration = 60000; // Actual limit is 2^16
+const int kMinPayloadType = 0;
+const int kMaxPayloadType = 127;
+
class ProxySink : public webrtc::AudioSinkInterface {
public:
ProxySink(AudioSinkInterface* sink) : sink_(sink) { RTC_DCHECK(sink); }
@@ -1549,12 +1552,16 @@ bool WebRtcVoiceMediaChannel::SetSendCodecs(
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
// TODO(solenberg): Validate input - that payload types don't overlap, are
// within range, filter out codecs we don't support,
- // redundant codecs etc.
+ // redundant codecs etc - the same way it is done for
+ // RtpHeaderExtensions.
// Find the DTMF telephone event "codec" payload type.
dtmf_payload_type_ = rtc::Optional<int>();
for (const AudioCodec& codec : codecs) {
if (IsCodec(codec, kDtmfCodecName)) {
+ if (codec.id < kMinPayloadType || codec.id > kMaxPayloadType) {
+ return false;
+ }
dtmf_payload_type_ = rtc::Optional<int>(codec.id);
break;
}
« 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