[PATCH 1/2] amstream: Return VFW_E_CANNOT_CONNECT in IAMMultiMediaStream::OpenFile() when stream is not initialized and AMMSF_NORENDER is not specified.

Zebediah Figura z.figura12 at gmail.com
Thu Aug 6 11:32:56 CDT 2020


On 8/6/20 4:29 AM, Gijs Vermeulen wrote:
> Signed-off-by: Gijs Vermeulen <gijsvrm at gmail.com>
> ---
>  dlls/amstream/multimedia.c     |  2 ++
>  dlls/amstream/tests/amstream.c | 38 ++++++++++++++++++++++++++++++++--
>  2 files changed, 38 insertions(+), 2 deletions(-)
> 
> diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c
> index 414a903cf2..72af67f36f 100644
> --- a/dlls/amstream/multimedia.c
> +++ b/dlls/amstream/multimedia.c
> @@ -428,6 +428,8 @@ static HRESULT WINAPI multimedia_stream_OpenFile(IAMMultiMediaStream *iface,
>          ret = IAMMultiMediaStream_Initialize(iface, STREAMTYPE_READ, 0, NULL);
>          if (SUCCEEDED(ret))
>              ret = create_graph(This, NULL);
> +        if (!(flags & AMMSF_NORENDER))
> +            return SUCCEEDED(ret) ? VFW_E_CANNOT_CONNECT : ret;
>      }
>  
>      if (SUCCEEDED(ret))

This seems suspicious. In particular, if I add a call to
IAMMultiMediaStream::Initialize() in the relevant test, it still returns
VFW_E_CANNOT_CONNECT.

I suspect that what is happening instead is that amstream ensures that
only its own renderers are used, probably with something like
AM_RENDEREX_RENDERTOEXISTINGRENDERERS.

> diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c
> index 910ab11f52..6a72f3ed89 100644
> --- a/dlls/amstream/tests/amstream.c
> +++ b/dlls/amstream/tests/amstream.c
> @@ -283,13 +283,47 @@ static void test_openfile(const WCHAR *test_avi_path)
>      ok(hr == S_OK, "Got hr %#x.\n", hr);
>      ok(!graph, "Expected NULL graph.\n");
>  
> +    hr = IAMMultiMediaStream_GetFilter(mmstream, &filter);
> +    ok(!!filter, "Expected non-NULL filter.\n");
> +    ok(hr == S_OK, "Got hr %#x.\n", hr);
> +
> +    check_interface(filter, &IID_IMediaSeeking, FALSE);
> +
>      hr = IAMMultiMediaStream_OpenFile(mmstream, test_avi_path, AMMSF_NORENDER);
>      ok(hr == S_OK, "Got hr %#x.\n", hr);
>  
> +    check_interface(filter, &IID_IMediaSeeking, FALSE);
> +
> +    hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &graph);
> +    ok(hr == S_OK, "Got hr %#x.\n", hr);
> +    ok(!!graph, "Expected non-NULL graph.\n");
> +    IGraphBuilder_Release(graph);
> +    IMediaStreamFilter_Release(filter);
> +
> +    ref = IAMMultiMediaStream_Release(mmstream);
> +    ok(!ref, "Got outstanding refcount %d.\n", ref);
> +
> +    mmstream = create_ammultimediastream();
> +    hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &graph);
> +    ok(hr == S_OK, "Got hr %#x.\n", hr);
> +    ok(!graph, "Expected NULL graph.\n");
> +
> +    hr = IAMMultiMediaStream_GetFilter(mmstream, &filter);
> +    ok(!!filter, "Expected non-NULL filter.\n");
> +    ok(hr == S_OK, "Got hr %#x.\n", hr);
> +
> +    check_interface(filter, &IID_IMediaSeeking, FALSE);
> +
> +    hr = IAMMultiMediaStream_OpenFile(mmstream, test_avi_path, 0);
> +    ok(hr == VFW_E_CANNOT_CONNECT, "Got hr %#x.\n", hr);
> +
> +    check_interface(filter, &IID_IMediaSeeking, FALSE);
> +
>      hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &graph);
>      ok(hr == S_OK, "Got hr %#x.\n", hr);
>      ok(!!graph, "Expected non-NULL graph.\n");
>      IGraphBuilder_Release(graph);
> +    IMediaStreamFilter_Release(filter);
>  
>      ref = IAMMultiMediaStream_Release(mmstream);
>      ok(!ref, "Got outstanding refcount %d.\n", ref);
> @@ -389,12 +423,12 @@ static void test_mmstream_get_duration(const WCHAR *test_avi_path)
>      mmstream = create_ammultimediastream();
>  
>      hr = IAMMultiMediaStream_OpenFile(mmstream, test_avi_path, 0);
> -    todo_wine ok(hr == VFW_E_CANNOT_CONNECT, "Got hr %#x.\n", hr);
> +    ok(hr == VFW_E_CANNOT_CONNECT, "Got hr %#x.\n", hr);
>  
>      duration = 0xdeadbeefdeadbeefULL;
>      hr = IAMMultiMediaStream_GetDuration(mmstream, &duration);
>      todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
> -    todo_wine ok(duration == 0, "Got duration %s.\n", wine_dbgstr_longlong(duration));
> +    ok(duration == 0, "Got duration %s.\n", wine_dbgstr_longlong(duration));
>  
>      ref = IAMMultiMediaStream_Release(mmstream);
>      ok(!ref, "Got outstanding refcount %d.\n", ref);
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20200806/7cfaf4eb/attachment.sig>


More information about the wine-devel mailing list