Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.6.2
-
None
-
Windows 7 x64
Description
Phonon hangs when playing certain MPEG2 using the asynchronous streaming interface.
I tracked the problem down to the StreamReader::read() method of the Phonon Direct Show backend ( src/3rdparty/phonon/ds9/iodevicereader.cpp) that is called from IAsyncReader::SyncReadAligned [1] method from the DirectShow filter decoding the video.
The problem seems to stem from the fact that the method returns beforing reading data if the graph is currently stopping. This results in some filters to deadlock because they wait for data infinitely after the canceled read operation.
The attached patch removes the early returns and fixes the deadlock situation.
The problem can be reproduced by running the attached test program with the sample file sample_mpeg2.m2v in the working directory. When starting playback with the "play" button and stopping it using "stop" in the middle of the video, the application deadlocks. After applying the patch, the video stops without a deadlock.
See the following commit for a simmilar fix in the asynchronous Request / WaitNext methods:
http://qt.gitorious.org/+mnemis/qt/mnemogit/commit/71a8a5c97315c114d55190594a7175552bfd41a6
[1] http://msdn.microsoft.com/en-us/library/dd376092(VS.85).aspx