3 * Copyright 2013, Google Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 // This file contains the interface for MediaConstraints, corresponding to
30 // http://www.w3.org/TR/mediacapture-streams/#mediastreamconstraints and also
31 // used in WebRTC: http://dev.w3.org/2011/webrtc/editor/webrtc.html#constraints.
33 #ifndef TALK_APP_WEBRTC_MEDIACONSTRAINTSINTERFACE_H_
34 #define TALK_APP_WEBRTC_MEDIACONSTRAINTSINTERFACE_H_
41 // MediaConstraintsInterface
42 // Interface used for passing arguments about media constraints
43 // to the MediaStream and PeerConnection implementation.
44 class MediaConstraintsInterface {
48 Constraint(const std::string& key, const std::string value)
49 : key(key), value(value) {
55 class Constraints : public std::vector<Constraint> {
57 bool FindFirst(const std::string& key, std::string* value) const;
60 virtual const Constraints& GetMandatory() const = 0;
61 virtual const Constraints& GetOptional() const = 0;
63 // Constraint keys used by a local video source.
64 // Specified by draft-alvestrand-constraints-resolution-00b
65 static const char kMinAspectRatio[]; // minAspectRatio
66 static const char kMaxAspectRatio[]; // maxAspectRatio
67 static const char kMaxWidth[]; // maxWidth
68 static const char kMinWidth[]; // minWidth
69 static const char kMaxHeight[]; // maxHeight
70 static const char kMinHeight[]; // minHeight
71 static const char kMaxFrameRate[]; // maxFrameRate
72 static const char kMinFrameRate[]; // minFrameRate
74 // Constraint keys used by a local audio source.
75 // These keys are google specific.
76 static const char kEchoCancellation[]; // googEchoCancellation
77 static const char kExperimentalEchoCancellation[]; // googEchoCancellation2
78 static const char kAutoGainControl[]; // googAutoGainControl
79 static const char kExperimentalAutoGainControl[]; // googAutoGainControl2
80 static const char kNoiseSuppression[]; // googNoiseSuppression
81 static const char kExperimentalNoiseSuppression[]; // googNoiseSuppression2
82 static const char kHighpassFilter[]; // googHighpassFilter
83 static const char kTypingNoiseDetection[]; // googTypingNoiseDetection
84 static const char kAudioMirroring[]; // googAudioMirroring
86 // Google-specific constraint keys for a local video source
87 static const char kNoiseReduction[]; // googNoiseReduction
88 static const char kLeakyBucket[]; // googLeakyBucket
89 static const char kTemporalLayeredScreencast[];
90 // googTemporalLayeredScreencast
92 // Constraint keys for CreateOffer / CreateAnswer
93 // Specified by the W3C PeerConnection spec
94 static const char kOfferToReceiveVideo[]; // OfferToReceiveVideo
95 static const char kOfferToReceiveAudio[]; // OfferToReceiveAudio
96 static const char kVoiceActivityDetection[]; // VoiceActivityDetection
97 static const char kIceRestart[]; // IceRestart
98 // These keys are google specific.
99 static const char kUseRtpMux[]; // googUseRtpMUX
101 // Constraints values.
102 static const char kValueTrue[]; // true
103 static const char kValueFalse[]; // false
105 // PeerConnection constraint keys.
106 // Temporary pseudo-constraints used to enable DTLS-SRTP
107 static const char kEnableDtlsSrtp[]; // Enable DTLS-SRTP
108 // Temporary pseudo-constraints used to enable DataChannels
109 static const char kEnableRtpDataChannels[]; // Enable RTP DataChannels
110 // Google-specific constraint keys.
111 // Temporary pseudo-constraint for enabling DSCP through JS.
112 static const char kEnableDscp[]; // googDscp
113 // Constraint to enable IPv6 through JS.
114 static const char kEnableIPv6[]; // googIPv6
115 // Temporary constraint to enable suspend below min bitrate feature.
116 static const char kEnableVideoSuspendBelowMinBitrate[];
117 // googSuspendBelowMinBitrate
118 static const char kNumUnsignalledRecvStreams[];
119 // googNumUnsignalledRecvStreams
120 // Constraint to enable combined audio+video bandwidth estimation.
121 static const char kCombinedAudioVideoBwe[]; // googCombinedAudioVideoBwe
122 static const char kScreencastMinBitrate[]; // googScreencastMinBitrate
123 static const char kCpuOveruseDetection[]; // googCpuOveruseDetection
124 static const char kCpuUnderuseThreshold[]; // googCpuUnderuseThreshold
125 static const char kCpuOveruseThreshold[]; // googCpuOveruseThreshold
126 // Low cpu adaptation threshold for relative standard deviation of encode
128 static const char kCpuUnderuseEncodeRsdThreshold[];
129 // High cpu adaptation threshold for relative standard deviation of encode
131 static const char kCpuOveruseEncodeRsdThreshold[];
132 static const char kCpuOveruseEncodeUsage[]; // googCpuOveruseEncodeUsage
133 static const char kHighStartBitrate[]; // googHighStartBitrate
134 static const char kHighBitrate[]; // googHighBitrate
135 static const char kVeryHighBitrate[]; // googVeryHighBitrate
136 static const char kPayloadPadding[]; // googPayloadPadding
138 // The prefix of internal-only constraints whose JS set values should be
139 // stripped by Chrome before passed down to Libjingle.
140 static const char kInternalConstraintPrefix[];
143 // Dtor protected as objects shouldn't be deleted via this interface
144 virtual ~MediaConstraintsInterface() {}
147 bool FindConstraint(const MediaConstraintsInterface* constraints,
148 const std::string& key, bool* value,
149 size_t* mandatory_constraints);
151 } // namespace webrtc
153 #endif // TALK_APP_WEBRTC_MEDIACONSTRAINTSINTERFACE_H_