Zebediah Figura (@zfigura) commented about dlls/wmvcore/async_reader.c:
> struct stream *stream = arg;
> struct async_reader *reader = stream->reader;
> struct sample *sample;
> + WCHAR buffer[256];
> HRESULT hr;
>
> TRACE("reader %p, number %u\n", reader, stream->number);
>
> + swprintf(buffer, ARRAY_SIZE(buffer), L"wine_wmreader_stream_%u_read", stream->number);
> + SetThreadDescription(GetCurrentThread(), buffer);
Linux cuts off thread names at 15 characters (not counting the null terminator), which somewhat unfortunately makes all of these identical to each other and the deliver threads. Thus far I think Brendan had been trying to make the thread names distinct, if not per se trying to fit the entire name within 15 characters.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1311#note_15868
On Mon Nov 14 12:05:16 2022 +0000, Rémi Bernon wrote:
> I don't think we need to check it here anymore with the latest version.
> Deselected streams will never have pending read requests (or they will
> shortly complete it after deselection, with either error or a last sample).
I guess, but it depends on the fact that "read_result" is zero-initialized and never written, which seems non-obvious and a little fragile. In fact, I think it can already break if a stream was selected and then later becomes deselected, even if the filter was stopped in between. Checking "stream->read_requested" would be more obvious but I think still broken for the same reasons (but simple enough to fix.)
Note that if you do that then read_result becomes superfluous and doesn't really need to be stored anywhere.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1311#note_15867
Zebediah Figura (@zfigura) commented about dlls/wmvcore/async_reader.c:
> }
>
> if (!first_sample)
> - return NS_E_NO_MORE_SAMPLES;
> + return pending ? E_PENDING : NS_E_NO_MORE_SAMPLES;
What's the point of this? We never check the return code of async_reader_get_next_sample(), only whether it FAILED().
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1311#note_15866
Zebediah Figura (@zfigura) commented about dlls/wmvcore/async_reader.c:
> +
> + LeaveCriticalSection(&reader->callback_cs);
> + hr = IWMSyncReader2_GetNextSample(reader->reader, stream->number,
> + &sample->buffer, &sample->pts, &sample->duration,
> + &sample->flags, &sample->output, &sample->stream);
> + EnterCriticalSection(&reader->callback_cs);
> + }
> +
> + if (SUCCEEDED(stream->read_result = hr))
> + {
> + TRACE("Got stream %u buffer with pts %I64d.\n", stream->number, sample->pts);
> + stream->next_sample = sample;
> + }
> + else
> + {
> + WARN("Failed to get stream %u sample, hr %#lx.\n", stream->number, stream->read_result);
Missed this the first time, but: I'd make this an ERR, personally. (An application can trigger it, but it's one of those cases where it's a sign that something went catastrophically wrong, and also we're pretty much guessing how to handle it if not.)
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1311#note_15865