From 6e8df9584e18ae85e8441396f787dd8d350e2349 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Wed, 25 Sep 2013 14:37:53 -0700 Subject: [PATCH] Faceshift starts reporting failure to track under load, so determine active state based on the amount of time elapsed since last successful tracking data received. --- interface/src/devices/Faceshift.cpp | 8 ++++---- interface/src/devices/Faceshift.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/interface/src/devices/Faceshift.cpp b/interface/src/devices/Faceshift.cpp index c1b1dfcb52..213fbec817 100644 --- a/interface/src/devices/Faceshift.cpp +++ b/interface/src/devices/Faceshift.cpp @@ -20,7 +20,7 @@ const quint16 FACESHIFT_PORT = 33433; Faceshift::Faceshift() : _tcpEnabled(false), - _lastMessageReceived(0), + _lastTrackingStateReceived(0), _eyeGazeLeftPitch(0.0f), _eyeGazeLeftYaw(0.0f), _eyeGazeRightPitch(0.0f), @@ -53,8 +53,7 @@ Faceshift::Faceshift() : bool Faceshift::isActive() const { const uint64_t ACTIVE_TIMEOUT_USECS = 1000000; - return (_tcpSocket.state() == QAbstractSocket::ConnectedState || - (usecTimestampNow() - _lastMessageReceived) < ACTIVE_TIMEOUT_USECS) && _tracking; + return (usecTimestampNow() - _lastTrackingStateReceived) < ACTIVE_TIMEOUT_USECS; } void Faceshift::update() { @@ -153,6 +152,8 @@ void Faceshift::receive(const QByteArray& buffer) { _eyeGazeRightPitch = -data.m_eyeGazeRightPitch; _eyeGazeRightYaw = data.m_eyeGazeRightYaw; _blendshapeCoefficients = data.m_coeffs; + + _lastTrackingStateReceived = usecTimestampNow(); } break; } @@ -202,5 +203,4 @@ void Faceshift::receive(const QByteArray& buffer) { break; } } - _lastMessageReceived = usecTimestampNow(); } diff --git a/interface/src/devices/Faceshift.h b/interface/src/devices/Faceshift.h index 1b93c717a5..ad98f72d38 100644 --- a/interface/src/devices/Faceshift.h +++ b/interface/src/devices/Faceshift.h @@ -85,7 +85,7 @@ private: fs::fsBinaryStream _stream; bool _tcpEnabled; bool _tracking; - uint64_t _lastMessageReceived; + uint64_t _lastTrackingStateReceived; glm::quat _headRotation; glm::vec3 _headTranslation;