OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 best_diff_interval = diff_interval; | 260 best_diff_interval = diff_interval; |
261 best_it = it; | 261 best_it = it; |
262 } | 262 } |
263 } | 263 } |
264 return *best_it; | 264 return *best_it; |
265 } | 265 } |
266 | 266 |
267 // Set |option| to the highest-priority value of |key| in the constraints. | 267 // Set |option| to the highest-priority value of |key| in the constraints. |
268 // Return false if the key is mandatory, and the value is invalid. | 268 // Return false if the key is mandatory, and the value is invalid. |
269 bool ExtractOption(const MediaConstraintsInterface* all_constraints, | 269 bool ExtractOption(const MediaConstraintsInterface* all_constraints, |
270 const std::string& key, cricket::Settable<bool>* option) { | 270 const std::string& key, |
| 271 rtc::Maybe<bool>* option) { |
271 size_t mandatory = 0; | 272 size_t mandatory = 0; |
272 bool value; | 273 bool value; |
273 if (FindConstraint(all_constraints, key, &value, &mandatory)) { | 274 if (FindConstraint(all_constraints, key, &value, &mandatory)) { |
274 option->Set(value); | 275 *option = rtc::Maybe<bool>(value); |
275 return true; | 276 return true; |
276 } | 277 } |
277 | 278 |
278 return mandatory == 0; | 279 return mandatory == 0; |
279 } | 280 } |
280 | 281 |
281 // Search |all_constraints| for known video options. Apply all options that are | 282 // Search |all_constraints| for known video options. Apply all options that are |
282 // found with valid values, and return false if any mandatory video option was | 283 // found with valid values, and return false if any mandatory video option was |
283 // found with an invalid value. | 284 // found with an invalid value. |
284 bool ExtractVideoOptions(const MediaConstraintsInterface* all_constraints, | 285 bool ExtractVideoOptions(const MediaConstraintsInterface* all_constraints, |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 } | 461 } |
461 | 462 |
462 void VideoSource::SetState(SourceState new_state) { | 463 void VideoSource::SetState(SourceState new_state) { |
463 if (VERIFY(state_ != new_state)) { | 464 if (VERIFY(state_ != new_state)) { |
464 state_ = new_state; | 465 state_ = new_state; |
465 FireOnChanged(); | 466 FireOnChanged(); |
466 } | 467 } |
467 } | 468 } |
468 | 469 |
469 } // namespace webrtc | 470 } // namespace webrtc |
OLD | NEW |