[PATCH 0/1] MR6373: mfplat: Seek byte stream to the start for URL hint detection.
Some tests reuse the same MP4 stream and are currently passing only because we have the generic byte stream handler fallback. They pass on Windows too, so I'm assuming the stream is seeked before looking for the hints. We could also very well remove the position restore because the media sources are rewinding the stream later too, but I've kept it like it was. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6373
From: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/mfplat/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index aa987ff0496..6c4ee89ba8b 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -6257,8 +6257,8 @@ static HRESULT resolver_get_bytestream_url_hint(IMFByteStream *stream, WCHAR con if (FAILED(hr = IMFByteStream_GetCurrentPosition(stream, &position))) return hr; - - hr = IMFByteStream_Read(stream, buffer, sizeof(buffer), &length); + if (SUCCEEDED(hr = IMFByteStream_SetCurrentPosition(stream, 0))) + hr = IMFByteStream_Read(stream, buffer, sizeof(buffer), &length); IMFByteStream_SetCurrentPosition(stream, position); if (FAILED(hr)) return hr; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6373
Could we check what it should be doing? Does not have to be a integrated wine test. With that change change it looks awkward - we save/restore original position but reading a chunk form 0 offset instead. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6373#note_80349
It seeks to 0 while detecting the stream type, when that fails it sometimes doesn't restore it (if MF_RESOLUTION_CONTENT_DOES_NOT_HAVE_TO_MATCH_EXTENSION_OR_MIME_TYPE isn't set), and other times it does (when the flag is set, but media source creation has failed). In both cases the stream is also closed when resolution failed early. In some cases it is restoring position during the process, probably when it makes sense to do so (like trying a different resolution method, or before actually creating the media source), but obviously after a media source is successfully created the position is rarely where it was initially. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6373#note_80377
Should I do something differently? Do you want tests for this? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6373#note_82497
Main question is whether current stream position should be respected at all, or if it's always assumed that start of the data is at 0 and not current position. From what you're describing it sounds that it's not possible to start with particular offset? If you're confident that's how it works then sure, let's have it. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6373#note_82509
Okay, I'll write some tests. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6373#note_82517
participants (2)
-
Nikolay Sivov (@nsivov) -
Rémi Bernon