summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew de los Reyes <adlr@google.com>2015-10-02 02:22:46 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-10-02 02:22:46 +0000
commitc9b392395f3eada767cf9d1dce1eb40930ca1b95 (patch)
tree846449de728a5197d6b1cdf402b33579e5bc2669
parentbcf2901af9f5737f510b968ba9dda5ba58b86f8a (diff)
parent6c51a07d30a3c4bed9675da88c5f6f24a741d9a2 (diff)
downloadframeworks_native-c9b392395f3eada767cf9d1dce1eb40930ca1b95.zip
frameworks_native-c9b392395f3eada767cf9d1dce1eb40930ca1b95.tar.gz
frameworks_native-c9b392395f3eada767cf9d1dce1eb40930ca1b95.tar.bz2
am 6c51a07d: am de18f6c3: InputResampling: Don\'t extrapolate for very low frame rates.
* commit '6c51a07d30a3c4bed9675da88c5f6f24a741d9a2': InputResampling: Don't extrapolate for very low frame rates.
-rw-r--r--libs/input/InputTransport.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/libs/input/InputTransport.cpp b/libs/input/InputTransport.cpp
index 0382f57..7f83da5 100644
--- a/libs/input/InputTransport.cpp
+++ b/libs/input/InputTransport.cpp
@@ -51,6 +51,10 @@ static const nsecs_t RESAMPLE_LATENCY = 5 * NANOS_PER_MS;
// Minimum time difference between consecutive samples before attempting to resample.
static const nsecs_t RESAMPLE_MIN_DELTA = 2 * NANOS_PER_MS;
+// Maximum time difference between consecutive samples before attempting to resample
+// by extrapolation.
+static const nsecs_t RESAMPLE_MAX_DELTA = 20 * NANOS_PER_MS;
+
// Maximum time to predict forward from the last known state, to avoid predicting too
// far into the future. This time is further bounded by 50% of the last time delta.
static const nsecs_t RESAMPLE_MAX_PREDICTION = 8 * NANOS_PER_MS;
@@ -724,7 +728,7 @@ void InputConsumer::resampleTouchState(nsecs_t sampleTime, MotionEvent* event,
nsecs_t delta = future.eventTime - current->eventTime;
if (delta < RESAMPLE_MIN_DELTA) {
#if DEBUG_RESAMPLING
- ALOGD("Not resampled, delta time is %lld ns.", delta);
+ ALOGD("Not resampled, delta time is too small: %lld ns.", delta);
#endif
return;
}
@@ -736,7 +740,12 @@ void InputConsumer::resampleTouchState(nsecs_t sampleTime, MotionEvent* event,
nsecs_t delta = current->eventTime - other->eventTime;
if (delta < RESAMPLE_MIN_DELTA) {
#if DEBUG_RESAMPLING
- ALOGD("Not resampled, delta time is %lld ns.", delta);
+ ALOGD("Not resampled, delta time is too small: %lld ns.", delta);
+#endif
+ return;
+ } else if (delta > RESAMPLE_MAX_DELTA) {
+#if DEBUG_RESAMPLING
+ ALOGD("Not resampled, delta time is too large: %lld ns.", delta);
#endif
return;
}