Commit 78555de5 authored by Thiago Santini's avatar Thiago Santini

Uses the timestamp from libuvc instead of our own

parent b9d12317
...@@ -158,7 +158,8 @@ void UVCCameraSession::setSurface(QAbstractVideoSurface* surface) ...@@ -158,7 +158,8 @@ void UVCCameraSession::setSurface(QAbstractVideoSurface* surface)
void cb(uvc_frame_t *frame, void *ptr) { if (ptr && frame) static_cast<UVCCameraSession*>(ptr)->callback(frame); } void cb(uvc_frame_t *frame, void *ptr) { if (ptr && frame) static_cast<UVCCameraSession*>(ptr)->callback(frame); }
void UVCCameraSession::callback(uvc_frame_t *frame) void UVCCameraSession::callback(uvc_frame_t *frame)
{ {
qreal t = frameReference.elapsed(); //qreal t = frameReference.elapsed();
qreal t = 1e3*frame->capture_time.tv_sec + 1e-3*frame->capture_time.tv_usec; // use libuvc timestamp instead of our own
if (!streaming) if (!streaming)
return; return;
...@@ -196,8 +197,8 @@ void UVCCameraSession::presentFrame(QVideoFrame frame, const qreal t) ...@@ -196,8 +197,8 @@ void UVCCameraSession::presentFrame(QVideoFrame frame, const qreal t)
frame.setMetaData("timestamp", t); frame.setMetaData("timestamp", t);
if (latency <= MAX_LATENCY_MS && m_surface) if (latency <= MAX_LATENCY_MS && m_surface)
m_surface->present(frame); m_surface->present(frame);
//else //else
// qWarning() << "Dropping frame (" << latency << "ms old )"; // qWarning() << "Dropping frame (" << latency << "ms old )";
} }
template<typename T> bool set(const QSettings *settings, const QString key, T &v) template<typename T> bool set(const QSettings *settings, const QString key, T &v)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment