OLD | NEW |
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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 } else if (constraint.m_name.equals(kCpuOveruseEncodeRsdThreshold)) { | 347 } else if (constraint.m_name.equals(kCpuOveruseEncodeRsdThreshold)) { |
348 result.googCpuOveruseEncodeRsdThreshold.setExact(atoi(constraint.m_v
alue.utf8().c_str())); | 348 result.googCpuOveruseEncodeRsdThreshold.setExact(atoi(constraint.m_v
alue.utf8().c_str())); |
349 } else if (constraint.m_name.equals(kCpuOveruseEncodeUsage)) { | 349 } else if (constraint.m_name.equals(kCpuOveruseEncodeUsage)) { |
350 result.googCpuOveruseEncodeUsage.setExact(toBoolean(constraint.m_val
ue)); | 350 result.googCpuOveruseEncodeUsage.setExact(toBoolean(constraint.m_val
ue)); |
351 } else if (constraint.m_name.equals(kHighStartBitrate)) { | 351 } else if (constraint.m_name.equals(kHighStartBitrate)) { |
352 result.googHighStartBitrate.setExact(atoi(constraint.m_value.utf8().
c_str())); | 352 result.googHighStartBitrate.setExact(atoi(constraint.m_value.utf8().
c_str())); |
353 } else if (constraint.m_name.equals(kPayloadPadding)) { | 353 } else if (constraint.m_name.equals(kPayloadPadding)) { |
354 result.googPayloadPadding.setExact(toBoolean(constraint.m_value)); | 354 result.googPayloadPadding.setExact(toBoolean(constraint.m_value)); |
355 } else if (constraint.m_name.equals(kTestConstraint1) | 355 } else if (constraint.m_name.equals(kTestConstraint1) |
356 || constraint.m_name.equals(kTestConstraint2)) { | 356 || constraint.m_name.equals(kTestConstraint2)) { |
357 // These constraints are only for testing parsing. Ignore them. | 357 // These constraints are only for testing parsing. |
| 358 // Values 0 and 1 are legal, all others are a ConstraintError. |
| 359 if (!constraint.m_value.equals("0") && !constraint.m_value.equals("1
")) |
| 360 errorState.throwConstraintError("Illegal value for constraint",
constraint.m_name); |
358 } else { | 361 } else { |
359 // TODO(hta): UMA stats for unknown constraints passed. | 362 // TODO(hta): UMA stats for unknown constraints passed. |
360 // https://crbug.com/576613 | 363 // https://crbug.com/576613 |
361 WTF_LOG(Media, "Unknown constraint name detected"); | 364 WTF_LOG(Media, "Unknown constraint name detected"); |
362 errorState.throwConstraintError("Unknown name of constraint detected
", constraint.m_name); | 365 errorState.throwConstraintError("Unknown name of constraint detected
", constraint.m_name); |
363 } | 366 } |
364 } | 367 } |
365 } | 368 } |
366 | 369 |
367 static WebMediaConstraints createFromNamedConstraints(WebVector<WebMediaConstrai
nt>& mandatory, const WebVector<WebMediaConstraint>& optional, MediaErrorState&
errorState) | 370 static WebMediaConstraints createFromNamedConstraints(WebVector<WebMediaConstrai
nt>& mandatory, const WebVector<WebMediaConstraint>& optional, MediaErrorState&
errorState) |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 | 518 |
516 WebMediaConstraints create() | 519 WebMediaConstraints create() |
517 { | 520 { |
518 WebMediaConstraints constraints; | 521 WebMediaConstraints constraints; |
519 constraints.initialize(); | 522 constraints.initialize(); |
520 return constraints; | 523 return constraints; |
521 } | 524 } |
522 | 525 |
523 } // namespace MediaConstraintsImpl | 526 } // namespace MediaConstraintsImpl |
524 } // namespace blink | 527 } // namespace blink |
OLD | NEW |