diff options
author | Val Doroshchuk <valentyn.doroshchuk@qt.io> | 2019-08-30 10:44:00 +0200 |
---|---|---|
committer | Val Doroshchuk <valentyn.doroshchuk@qt.io> | 2019-09-12 11:08:10 +0200 |
commit | 9e96fe2cbf79a44039de0edcc854050d84b87588 (patch) | |
tree | b9301538e4fb89741dab3889648eab49a3c07c8f | |
parent | bbf21e0a222f4f9bb5acae7b02faddca3b354e4e (diff) | |
download | qtmultimedia-9e96fe2cbf79a44039de0edcc854050d84b87588.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>
-rw-r--r-- | src/plugins/directshow/player/directshowioreader.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/directshow/player/directshowioreader.cpp b/src/plugins/directshow/player/directshowioreader.cpp index c10d9a239..31117a377 100644 --- a/src/plugins/directshow/player/directshowioreader.cpp +++ b/src/plugins/directshow/player/directshowioreader.cpp @@ -169,7 +169,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); |