[PATCH v2] winegstreamer: Do not block forever if EOS races with command queue.

Zebediah Figura (she/her) zfigura at codeweavers.com
Fri Feb 25 11:19:47 CST 2022


On 2/22/22 15:14, Zebediah Figura (she/her) wrote:
> On 2/22/22 15:09, Nikolay Sivov wrote:
>>
>>
>> On 2/9/22 11:40, Giovanni Mascellani wrote:
>>> Currently, the winegstreamer media source checks for EOS when
>>> RequestSample() is called, but doesn't handle the cases when EOS
>>> is detected between the RequestSample() call and the moment when
>>> the request is popped from the command queue and serviced. This
>>> can result in the media source waiting forever for a sample and
>>> get stuck.
>>>
>>> This commit fixes the bug by adding a check for EOS in
>>> wait_for_event().
>>>
>>> This commit fixes Medieval Dynasty hanging on developer logos on
>>> the Steam Deck.
>>>
>>> Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
>>> ---
>>>   dlls/winegstreamer/media_source.c | 6 ++++++
>>>   1 file changed, 6 insertions(+)
>>>
>>> diff --git a/dlls/winegstreamer/media_source.c
>>> b/dlls/winegstreamer/media_source.c
>>> index 85ec31d2498..ca8f92b07ea 100644
>>> --- a/dlls/winegstreamer/media_source.c
>>> +++ b/dlls/winegstreamer/media_source.c
>>> @@ -534,6 +534,12 @@ static void wait_on_sample(struct media_stream
>>> *stream, IUnknown *token)
>>>         TRACE("%p, %p\n", stream, token);
>>>   +    if (stream->eos)
>>> +    {
>>> +        IMFMediaEventQueue_QueueEventParamVar(stream->event_queue,
>>> MEError, &GUID_NULL, MF_E_END_OF_STREAM, &empty_var);
>>> +        return;
>>> +    }
>>> +
>>>       for (;;)
>>>       {
>>>           if (!wg_parser_stream_get_event(stream->wg_stream, &event))
>> Sorry, I missed this one. What I don't understand about this is why
>> wg_parser_stream_get_event() can't simply return for streams that
>> reached eos. It seems it should be able to track such state differences.
>> There is already eos flag in wg_parser_stream(), but I see it means
>> something else, and is never reset (I think).
> 
> The current design of winegstreamer has wg_parser_stream_get_event()
> only returning an EOS event once. The DirectShow frontend actually
> depends on this design. I'm currently working on reorganizing things so
> that it doesn't, though, at which point we could allow that function to
> never block on EOS, and probably make things easier.

FWIW, this is done now, in 28c9c138d26.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20220225/1b19b626/attachment.sig>


More information about the wine-devel mailing list