Chromium Code Reviews| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 int value = rtc::FromString<int>(constraint.value); | 150 int value = rtc::FromString<int>(constraint.value); |
| 151 if (value == 0) { | 151 if (value == 0) { |
| 152 if (mandatory) { | 152 if (mandatory) { |
| 153 // TODO(ronghuawu): Convert the constraint value to float when sub-1fps | 153 // TODO(ronghuawu): Convert the constraint value to float when sub-1fps |
| 154 // is supported by the capturer. | 154 // is supported by the capturer. |
| 155 return false; | 155 return false; |
| 156 } else { | 156 } else { |
| 157 value = 1; | 157 value = 1; |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 if (value <= cricket::VideoFormat::IntervalToFps(format_in.interval)) { | 160 if (value <= cricket::VideoFormat::IntervalToFps(format_in.interval)) |
| 161 format_out->interval = cricket::VideoFormat::FpsToInterval(value); | 161 format_out->interval = cricket::VideoFormat::FpsToInterval(value); |
| 162 return true; | 162 return true; |
| 163 } else { | |
| 164 return false; | |
|
magjed_webrtc
2015/08/27 13:50:23
I removed this because it looks like a bug to me.
| |
| 165 } | |
| 166 } else if (constraint.key == MediaConstraintsInterface::kMinAspectRatio) { | 163 } else if (constraint.key == MediaConstraintsInterface::kMinAspectRatio) { |
| 167 double value = rtc::FromString<double>(constraint.value); | 164 double value = rtc::FromString<double>(constraint.value); |
| 168 // The aspect ratio in |constraint.value| has been converted to a string and | 165 // The aspect ratio in |constraint.value| has been converted to a string and |
| 169 // back to a double, so it may have a rounding error. | 166 // back to a double, so it may have a rounding error. |
| 170 // E.g if the value 1/3 is converted to a string, the string will not have | 167 // E.g if the value 1/3 is converted to a string, the string will not have |
| 171 // infinite length. | 168 // infinite length. |
| 172 // We add a margin of 0.0005 which is high enough to detect the same aspect | 169 // We add a margin of 0.0005 which is high enough to detect the same aspect |
| 173 // ratio but small enough to avoid matching wrong aspect ratios. | 170 // ratio but small enough to avoid matching wrong aspect ratios. |
| 174 double ratio = static_cast<double>(format_in.width) / format_in.height; | 171 double ratio = static_cast<double>(format_in.width) / format_in.height; |
| 175 return (value <= ratio + kRoundingTruncation); | 172 return (value <= ratio + kRoundingTruncation); |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 465 } | 462 } |
| 466 | 463 |
| 467 void VideoSource::SetState(SourceState new_state) { | 464 void VideoSource::SetState(SourceState new_state) { |
| 468 if (VERIFY(state_ != new_state)) { | 465 if (VERIFY(state_ != new_state)) { |
| 469 state_ = new_state; | 466 state_ = new_state; |
| 470 FireOnChanged(); | 467 FireOnChanged(); |
| 471 } | 468 } |
| 472 } | 469 } |
| 473 | 470 |
| 474 } // namespace webrtc | 471 } // namespace webrtc |
| OLD | NEW |