[PATCH 3/4] amstream/tests: Test that streams call IMediaStreamFilter::Flush in IPin::BeginFlush.
Anton Baskanov
baskanov at gmail.com
Wed Apr 14 02:18:47 CDT 2021
Signed-off-by: Anton Baskanov <baskanov at gmail.com>
---
dlls/amstream/tests/amstream.c | 98 +++++++++++++++++++++++++++++++++-
1 file changed, 96 insertions(+), 2 deletions(-)
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c
index e42651bb97c..df3cac48754 100644
--- a/dlls/amstream/tests/amstream.c
+++ b/dlls/amstream/tests/amstream.c
@@ -1318,6 +1318,8 @@ struct testmediastreamfilter
IMediaStreamFilter IMediaStreamFilter_iface;
LONG refcount;
unsigned int got_end_of_stream;
+ unsigned int got_flush;
+ BOOL flush_cancel_eos;
};
static inline struct testmediastreamfilter *impl_from_IMediaStreamFilter(IMediaStreamFilter *iface)
@@ -1470,8 +1472,10 @@ static HRESULT WINAPI testmediastreamfilter_WaitUntil(IMediaStreamFilter *iface,
static HRESULT WINAPI testmediastreamfilter_Flush(IMediaStreamFilter *iface, BOOL cancel_eos)
{
- ok(0, "Unexpected call.\n");
- return E_NOTIMPL;
+ struct testmediastreamfilter *filter = impl_from_IMediaStreamFilter(iface);
+ ++filter->got_flush;
+ filter->flush_cancel_eos = cancel_eos;
+ return S_OK;
}
static HRESULT WINAPI testmediastreamfilter_EndOfStream(IMediaStreamFilter *iface)
@@ -4273,9 +4277,11 @@ static void test_audiostream_initialize(void)
static void test_audiostream_begin_flush_end_flush(void)
{
IAMMultiMediaStream *mmstream = create_ammultimediastream();
+ struct testmediastreamfilter filter;
IAudioStreamSample *stream_sample;
IAudioMediaStream *audio_stream;
IMediaSample *media_sample;
+ IAMMediaStream *am_stream;
struct testfilter source;
IAudioData *audio_data;
IGraphBuilder *graph;
@@ -4372,6 +4378,49 @@ static void test_audiostream_begin_flush_end_flush(void)
IAudioMediaStream_Release(audio_stream);
ref = IMediaStream_Release(stream);
ok(!ref, "Got outstanding refcount %d.\n", ref);
+
+ testmediastreamfilter_init(&filter);
+
+ hr = CoCreateInstance(&CLSID_AMAudioStream, NULL, CLSCTX_INPROC_SERVER, &IID_IAMMediaStream, (void **)&am_stream);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ hr = IAMMediaStream_QueryInterface(am_stream, &IID_IPin, (void **)&pin);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ hr = IAMMediaStream_JoinFilter(am_stream, &filter.IMediaStreamFilter_iface);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ filter.got_flush = 0;
+ filter.flush_cancel_eos = FALSE;
+
+ hr = IPin_BeginFlush(pin);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ todo_wine ok(filter.got_flush == 1, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_flush);
+ ok(!filter.flush_cancel_eos, "Got cancel_eos %d.\n", filter.flush_cancel_eos);
+
+ hr = IPin_EndFlush(pin);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IPin_EndOfStream(pin);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IPin_BeginFlush(pin);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ todo_wine ok(filter.got_flush == 2, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_flush);
+ todo_wine ok(filter.flush_cancel_eos, "Got cancel_eos %d.\n", filter.flush_cancel_eos);
+
+ hr = IPin_EndFlush(pin);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IPin_BeginFlush(pin);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ todo_wine ok(filter.got_flush == 3, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_flush);
+ ok(!filter.flush_cancel_eos, "Got cancel_eos %d.\n", filter.flush_cancel_eos);
+
+ hr = IPin_EndFlush(pin);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ IPin_Release(pin);
+ ref = IAMMediaStream_Release(am_stream);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
}
static IMediaSample *ammediastream_allocate_sample(struct testfilter *source, const BYTE *input_data, DWORD input_length)
@@ -5752,8 +5801,10 @@ static void test_ddrawstream_begin_flush_end_flush(void)
IAMMultiMediaStream *mmstream = create_ammultimediastream();
IDirectDrawStreamSample *stream_sample;
IDirectDrawMediaStream *ddraw_stream;
+ struct testmediastreamfilter filter;
IMediaSample *media_sample;
IMediaFilter *media_filter;
+ IAMMediaStream *am_stream;
struct testfilter source;
IGraphBuilder *graph;
IMediaStream *stream;
@@ -5860,6 +5911,49 @@ static void test_ddrawstream_begin_flush_end_flush(void)
IDirectDrawMediaStream_Release(ddraw_stream);
ref = IMediaStream_Release(stream);
ok(!ref, "Got outstanding refcount %d.\n", ref);
+
+ testmediastreamfilter_init(&filter);
+
+ hr = CoCreateInstance(&CLSID_AMDirectDrawStream, NULL, CLSCTX_INPROC_SERVER, &IID_IAMMediaStream, (void **)&am_stream);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ hr = IAMMediaStream_QueryInterface(am_stream, &IID_IPin, (void **)&pin);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ hr = IAMMediaStream_JoinFilter(am_stream, &filter.IMediaStreamFilter_iface);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ filter.got_flush = 0;
+ filter.flush_cancel_eos = FALSE;
+
+ hr = IPin_BeginFlush(pin);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ todo_wine ok(filter.got_flush == 1, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_flush);
+ ok(!filter.flush_cancel_eos, "Got cancel_eos %d.\n", filter.flush_cancel_eos);
+
+ hr = IPin_EndFlush(pin);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IPin_EndOfStream(pin);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IPin_BeginFlush(pin);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ todo_wine ok(filter.got_flush == 2, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_flush);
+ todo_wine ok(filter.flush_cancel_eos, "Got cancel_eos %d.\n", filter.flush_cancel_eos);
+
+ hr = IPin_EndFlush(pin);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = IPin_BeginFlush(pin);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ todo_wine ok(filter.got_flush == 3, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_flush);
+ ok(!filter.flush_cancel_eos, "Got cancel_eos %d.\n", filter.flush_cancel_eos);
+
+ hr = IPin_EndFlush(pin);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ IPin_Release(pin);
+ ref = IAMMediaStream_Release(am_stream);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
}
static void test_ddrawstream_new_segment(void)
--
2.25.1
More information about the wine-devel
mailing list