From cd6a109f6068ea74270cb47736b3e2259e4ace84 Mon Sep 17 00:00:00 2001 From: Val Doroshchuk Date: Fri, 30 Aug 2019 10:44:00 +0200 Subject: DirectShow: Round stop position down to available bytes in IAsyncReader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (cherry picked from commit 9e96fe2cbf79a44039de0edcc854050d84b87588) Reviewed-by: Tor Arne Vestbø --- src/plugins/directshow/player/directshowioreader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') 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((endTime - startTime) / 10000000, m_availableLength); auto request = new DirectShowSampleRequest(pSample, dwUser, position, length, buffer); -- cgit v1.2.3