summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVal Doroshchuk <valentyn.doroshchuk@qt.io>2019-08-30 10:44:00 +0200
committerVaL Doroshchuk <valentyn.doroshchuk@qt.io>2020-03-16 10:06:07 +0000
commitcd6a109f6068ea74270cb47736b3e2259e4ace84 (patch)
tree34d348ea07baeb788d1b7db75b5d7bb66207ab61
parent9a4ec4b49601e25d7ac0fd4cfd3df47339ff3ddb (diff)
downloadqtmultimedia-cd6a109f6068ea74270cb47736b3e2259e4ace84.tar.gz
DirectShow: Round stop position down to available bytes in IAsyncReader
Currently requested IMediaSample might contain the end time that exceeds the available bytes which causes returning an error in WaitForNext() and stopping the playback. Regarding to IAsyncReader::Request documentation: The start and stop positions should match the alignment that was decided when the pins connected. The stop position might exceed the real duration. If so, the method rounds the stop position down to the actual alignment. Fixes: QTBUG-77782 Change-Id: I644e25bfc6bb8f6d345b8424b79fb56490d82c0e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 9e96fe2cbf79a44039de0edcc854050d84b87588) Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
-rw-r--r--src/plugins/directshow/player/directshowioreader.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/directshow/player/directshowioreader.cpp b/src/plugins/directshow/player/directshowioreader.cpp
index ced10ea10..3318d57b5 100644
--- a/src/plugins/directshow/player/directshowioreader.cpp
+++ b/src/plugins/directshow/player/directshowioreader.cpp
@@ -155,7 +155,7 @@ HRESULT DirectShowIOReader::Request(IMediaSample *pSample, DWORD_PTR dwUser)
return VFW_E_SAMPLE_TIME_NOT_SET;
}
LONGLONG position = startTime / 10000000;
- LONG length = (endTime - startTime) / 10000000;
+ LONG length = qMin<qint64>((endTime - startTime) / 10000000, m_availableLength);
auto request = new DirectShowSampleRequest(pSample, dwUser, position, length, buffer);