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

Side by Side Diff: third_party/WebKit/public/platform/WebMediaConstraints.h

Issue 1729683002: Remove old-style constraints from Chrome internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Complete the interface change 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 89
90 bool matches(long value) const; 90 bool matches(long value) const;
91 bool isEmpty() const override; 91 bool isEmpty() const override;
92 bool hasMandatory() const override; 92 bool hasMandatory() const override;
93 WebString toString() const override; 93 WebString toString() const override;
94 bool hasMin() const { return m_hasMin; } 94 bool hasMin() const { return m_hasMin; }
95 long min() const { return m_min; } 95 long min() const { return m_min; }
96 bool hasMax() const { return m_hasMax; } 96 bool hasMax() const { return m_hasMax; }
97 long max() const { return m_max; } 97 long max() const { return m_max; }
98 bool hasExact() const { return m_hasExact; }
99 long exact() const { return m_exact; }
98 100
99 private: 101 private:
100 long m_min; 102 long m_min;
101 long m_max; 103 long m_max;
102 long m_exact; 104 long m_exact;
103 long m_ideal; 105 long m_ideal;
104 unsigned m_hasMin : 1; 106 unsigned m_hasMin : 1;
105 unsigned m_hasMax : 1; 107 unsigned m_hasMax : 1;
106 unsigned m_hasExact : 1; 108 unsigned m_hasExact : 1;
107 unsigned m_hasIdeal : 1; 109 unsigned m_hasIdeal : 1;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 143 }
142 144
143 bool matches(double value) const; 145 bool matches(double value) const;
144 bool isEmpty() const override; 146 bool isEmpty() const override;
145 bool hasMandatory() const override; 147 bool hasMandatory() const override;
146 WebString toString() const override; 148 WebString toString() const override;
147 bool hasMin() const { return m_hasMin; } 149 bool hasMin() const { return m_hasMin; }
148 double min() const { return m_min; } 150 double min() const { return m_min; }
149 bool hasMax() const { return m_hasMax; } 151 bool hasMax() const { return m_hasMax; }
150 double max() const { return m_max; } 152 double max() const { return m_max; }
153 bool hasExact() const { return m_hasExact; }
154 double exact() const { return m_exact; }
151 155
152 private: 156 private:
153 double m_min; 157 double m_min;
154 double m_max; 158 double m_max;
155 double m_exact; 159 double m_exact;
156 double m_ideal; 160 double m_ideal;
157 unsigned m_hasMin : 1; 161 unsigned m_hasMin : 1;
158 unsigned m_hasMax : 1; 162 unsigned m_hasMax : 1;
159 unsigned m_hasExact : 1; 163 unsigned m_hasExact : 1;
160 unsigned m_hasIdeal : 1; 164 unsigned m_hasIdeal : 1;
(...skipping 18 matching lines...) Expand all
179 void setIdeal(const WebVector<WebString>& ideal) 183 void setIdeal(const WebVector<WebString>& ideal)
180 { 184 {
181 m_ideal.assign(ideal); 185 m_ideal.assign(ideal);
182 } 186 }
183 187
184 188
185 bool matches(WebString value) const; 189 bool matches(WebString value) const;
186 bool isEmpty() const override; 190 bool isEmpty() const override;
187 bool hasMandatory() const override; 191 bool hasMandatory() const override;
188 WebString toString() const override; 192 WebString toString() const override;
193 bool hasExact() const { return !m_exact.isEmpty(); }
189 const WebVector<WebString>& exact() const; 194 const WebVector<WebString>& exact() const;
190 const WebVector<WebString>& ideal() const; 195 const WebVector<WebString>& ideal() const;
191 196
192 private: 197 private:
193 WebVector<WebString> m_exact; 198 WebVector<WebString> m_exact;
194 WebVector<WebString> m_ideal; 199 WebVector<WebString> m_ideal;
195 }; 200 };
196 201
197 class BLINK_PLATFORM_EXPORT BooleanConstraint : public BaseConstraint { 202 class BLINK_PLATFORM_EXPORT BooleanConstraint : public BaseConstraint {
198 public: 203 public:
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 BooleanConstraint googExperimentalAutoGainControl; 258 BooleanConstraint googExperimentalAutoGainControl;
254 BooleanConstraint googNoiseSuppression; 259 BooleanConstraint googNoiseSuppression;
255 BooleanConstraint googHighpassFilter; 260 BooleanConstraint googHighpassFilter;
256 BooleanConstraint googTypingNoiseDetection; 261 BooleanConstraint googTypingNoiseDetection;
257 BooleanConstraint googExperimentalNoiseSuppression; 262 BooleanConstraint googExperimentalNoiseSuppression;
258 BooleanConstraint googBeamforming; 263 BooleanConstraint googBeamforming;
259 StringConstraint googArrayGeometry; 264 StringConstraint googArrayGeometry;
260 BooleanConstraint googAudioMirroring; 265 BooleanConstraint googAudioMirroring;
261 BooleanConstraint googDAEchoCancellation; 266 BooleanConstraint googDAEchoCancellation;
262 BooleanConstraint googNoiseReduction; 267 BooleanConstraint googNoiseReduction;
263 StringConstraint offerToReceiveAudio; 268 LongConstraint offerToReceiveAudio;
264 StringConstraint offerToReceiveVideo; 269 LongConstraint offerToReceiveVideo;
265 BooleanConstraint voiceActivityDetection; 270 BooleanConstraint voiceActivityDetection;
266 BooleanConstraint iceRestart; 271 BooleanConstraint iceRestart;
267 BooleanConstraint googUseRtpMux; 272 BooleanConstraint googUseRtpMux;
268 BooleanConstraint enableDtlsSrtp; 273 BooleanConstraint enableDtlsSrtp;
269 BooleanConstraint enableRtpDataChannels; 274 BooleanConstraint enableRtpDataChannels;
270 BooleanConstraint enableDscp; 275 BooleanConstraint enableDscp;
271 BooleanConstraint enableIPv6; 276 BooleanConstraint enableIPv6;
272 BooleanConstraint googEnableVideoSuspendBelowMinBitrate; 277 BooleanConstraint googEnableVideoSuspendBelowMinBitrate;
273 LongConstraint googNumUnsignalledRecvStreams; 278 LongConstraint googNumUnsignalledRecvStreams;
274 BooleanConstraint googCombinedAudioVideoBwe; 279 BooleanConstraint googCombinedAudioVideoBwe;
275 LongConstraint googScreencastMinBitrate; 280 LongConstraint googScreencastMinBitrate;
276 BooleanConstraint googCpuOveruseDetection; 281 BooleanConstraint googCpuOveruseDetection;
277 LongConstraint googCpuUnderuseThreshold; 282 LongConstraint googCpuUnderuseThreshold;
278 LongConstraint googCpuOveruseThreshold; 283 LongConstraint googCpuOveruseThreshold;
279 LongConstraint googCpuUnderuseEncodeRsdThreshold; 284 LongConstraint googCpuUnderuseEncodeRsdThreshold;
280 LongConstraint googCpuOveruseEncodeRsdThreshold; 285 LongConstraint googCpuOveruseEncodeRsdThreshold;
281 BooleanConstraint googCpuOveruseEncodeUsage; 286 BooleanConstraint googCpuOveruseEncodeUsage;
282 LongConstraint googHighStartBitrate; 287 LongConstraint googHighStartBitrate;
283 BooleanConstraint googPayloadPadding; 288 BooleanConstraint googPayloadPadding;
289 LongConstraint googLatencyMs;
290 LongConstraint googPowerLineFrequency;
284 291
285 BLINK_PLATFORM_EXPORT bool isEmpty() const; 292 BLINK_PLATFORM_EXPORT bool isEmpty() const;
286 BLINK_PLATFORM_EXPORT bool hasMandatory() const; 293 BLINK_PLATFORM_EXPORT bool hasMandatory() const;
287 BLINK_PLATFORM_EXPORT bool hasMandatoryOutsideSet(const std::vector<std::str ing>&, std::string&) const; 294 BLINK_PLATFORM_EXPORT bool hasMandatoryOutsideSet(const std::vector<std::str ing>&, std::string&) const;
288 BLINK_PLATFORM_EXPORT WebString toString() const; 295 BLINK_PLATFORM_EXPORT WebString toString() const;
289 296
290 private: 297 private:
291 std::vector<const BaseConstraint*> allConstraints() const; 298 std::vector<const BaseConstraint*> allConstraints() const;
292 }; 299 };
293 300
294 // Old type/value form of constraint. Will be deprecated.
295 struct WebMediaConstraint {
296 WebMediaConstraint()
297 {
298 }
299
300 WebMediaConstraint(WebString name, WebString value)
301 : m_name(name)
302 , m_value(value)
303 {
304 }
305
306 WebString m_name;
307 WebString m_value;
308 };
309
310 class WebMediaConstraints { 301 class WebMediaConstraints {
311 public: 302 public:
312 WebMediaConstraints() 303 WebMediaConstraints()
313 { 304 {
314 } 305 }
315 WebMediaConstraints(const WebMediaConstraints& other) { assign(other); } 306 WebMediaConstraints(const WebMediaConstraints& other) { assign(other); }
316 ~WebMediaConstraints() { reset(); } 307 ~WebMediaConstraints() { reset(); }
317 308
318 WebMediaConstraints& operator=(const WebMediaConstraints& other) 309 WebMediaConstraints& operator=(const WebMediaConstraints& other)
319 { 310 {
320 assign(other); 311 assign(other);
321 return *this; 312 return *this;
322 } 313 }
323 314
324 BLINK_PLATFORM_EXPORT void assign(const WebMediaConstraints&); 315 BLINK_PLATFORM_EXPORT void assign(const WebMediaConstraints&);
325 316
326 BLINK_PLATFORM_EXPORT void reset(); 317 BLINK_PLATFORM_EXPORT void reset();
327 bool isNull() const { return m_private.isNull(); } 318 bool isNull() const { return m_private.isNull(); }
328
329 BLINK_PLATFORM_EXPORT bool isEmpty() const; 319 BLINK_PLATFORM_EXPORT bool isEmpty() const;
330 // Old accessors, will be deprecated
331 BLINK_PLATFORM_EXPORT void getOptionalConstraints(WebVector<WebMediaConstrai nt>&) const;
332 BLINK_PLATFORM_EXPORT void getMandatoryConstraints(WebVector<WebMediaConstra int>&) const;
333
334 BLINK_PLATFORM_EXPORT bool getOptionalConstraintValue(const WebString& name, WebString& value) const;
335 BLINK_PLATFORM_EXPORT bool getMandatoryConstraintValue(const WebString& name , WebString& value) const;
336 // End of will be deprecated
337 320
338 BLINK_PLATFORM_EXPORT void initialize(); 321 BLINK_PLATFORM_EXPORT void initialize();
339 // Transition initializer, will be removed
340 BLINK_PLATFORM_EXPORT void initialize(const WebVector<WebMediaConstraint>& o ptional, const WebVector<WebMediaConstraint>& mandatory, const WebMediaTrackCons traintSet& basic, const WebVector<WebMediaTrackConstraintSet>& advanced);
341
342 BLINK_PLATFORM_EXPORT void initialize(const WebMediaTrackConstraintSet& basi c, const WebVector<WebMediaTrackConstraintSet>& advanced); 322 BLINK_PLATFORM_EXPORT void initialize(const WebMediaTrackConstraintSet& basi c, const WebVector<WebMediaTrackConstraintSet>& advanced);
343 323
344 BLINK_PLATFORM_EXPORT const WebMediaTrackConstraintSet& basic() const; 324 BLINK_PLATFORM_EXPORT const WebMediaTrackConstraintSet& basic() const;
345 BLINK_PLATFORM_EXPORT const WebVector<WebMediaTrackConstraintSet>& advanced( ) const; 325 BLINK_PLATFORM_EXPORT const WebVector<WebMediaTrackConstraintSet>& advanced( ) const;
346 326
347 BLINK_PLATFORM_EXPORT const WebString toString() const; 327 BLINK_PLATFORM_EXPORT const WebString toString() const;
348 328
349 private: 329 private:
350 WebPrivatePtr<WebMediaConstraintsPrivate> m_private; 330 WebPrivatePtr<WebMediaConstraintsPrivate> m_private;
351 }; 331 };
352 332
353 } // namespace blink 333 } // namespace blink
354 334
355 #endif // WebMediaConstraints_h 335 #endif // WebMediaConstraints_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698