diff options
author | Val Doroshchuk <valentyn.doroshchuk@qt.io> | 2018-11-27 14:04:37 +0100 |
---|---|---|
committer | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2018-11-29 12:50:18 +0000 |
commit | 06f1f32daa89265269532a02457e73912da3c2d7 (patch) | |
tree | da77b4f45900f9fc69cd3d7d82e780a63f8f051a | |
parent | a9889e9e853b2b0e9b3736a258c908fa7559b35c (diff) | |
download | qtmultimedia-06f1f32daa89265269532a02457e73912da3c2d7.tar.gz |
DirectShow: Don't queue video buffers from sample grabber
Fixed an issue when buffers are sent using queued connection.
Thus all buffers were collected before they were handled.
Now only last buffer is kept.
Also moved handling of device lost timer to main thread.
Task-number: QTBUG-72012
Change-Id: I338587c5854739d6081c5cb502377e5779776417
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r-- | src/plugins/directshow/camera/dscamerasession.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/directshow/camera/dscamerasession.cpp b/src/plugins/directshow/camera/dscamerasession.cpp index 73c97c824..d23b7f1e2 100644 --- a/src/plugins/directshow/camera/dscamerasession.cpp +++ b/src/plugins/directshow/camera/dscamerasession.cpp @@ -611,10 +611,6 @@ void DSCameraSession::onFrameAvailable(double time, const QByteArray &data) m_presentMutex.lock(); - // If no frames provided from ISampleGrabber for some time - // the device might be potentially unplugged. - m_deviceLostEventTimer.start(100); - // In case the source produces frames faster than we can display them, // only keep the most recent one m_currentFrame = QVideoFrame(new QMemoryVideoBuffer(data, m_stride), @@ -641,6 +637,10 @@ void DSCameraSession::onFrameAvailable(double time, const QByteArray &data) void DSCameraSession::presentFrame() { + // If no frames provided from ISampleGrabber for some time + // the device might be potentially unplugged. + m_deviceLostEventTimer.start(100); + m_presentMutex.lock(); if (m_currentFrame.isValid() && m_surface) { @@ -810,7 +810,7 @@ bool DSCameraSession::createFilterGraph() if (!m_previewSampleGrabber) { m_previewSampleGrabber = new DirectShowSampleGrabber; connect(m_previewSampleGrabber, &DirectShowSampleGrabber::bufferAvailable, - this, &DSCameraSession::onFrameAvailable); + this, &DSCameraSession::onFrameAvailable, Qt::DirectConnection); } |