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

Side by Side Diff: talk/app/webrtc/videosource.cc

Issue 1308953004: AndroidVideoCapturer: Delegate framerate choice to VideoCapturerAndroid.java (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: return true Created 5 years, 3 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
« no previous file with comments | « talk/app/webrtc/androidvideocapturer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « talk/app/webrtc/androidvideocapturer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698