Commit c362ce20 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mfreadwrite: Do not call async reader callback if source failed to start up.

parent 910ec21b
...@@ -895,7 +895,7 @@ static BOOL source_reader_get_read_result(struct source_reader *reader, struct m ...@@ -895,7 +895,7 @@ static BOOL source_reader_get_read_result(struct source_reader *reader, struct m
source_reader_release_response(response); source_reader_release_response(response);
} }
return request_sample; return !request_sample;
} }
static HRESULT source_reader_get_stream_read_index(struct source_reader *reader, DWORD index, DWORD *stream_index) static HRESULT source_reader_get_stream_read_index(struct source_reader *reader, DWORD index, DWORD *stream_index)
...@@ -984,8 +984,8 @@ static HRESULT WINAPI source_reader_async_commands_callback_Invoke(IMFAsyncCallb ...@@ -984,8 +984,8 @@ static HRESULT WINAPI source_reader_async_commands_callback_Invoke(IMFAsyncCallb
struct source_reader_async_command *command; struct source_reader_async_command *command;
struct stream_response *response; struct stream_response *response;
DWORD stream_index, stream_flags; DWORD stream_index, stream_flags;
BOOL request_sample = FALSE;
struct media_stream *stream; struct media_stream *stream;
BOOL report_sample = FALSE;
IMFSample *sample = NULL; IMFSample *sample = NULL;
LONGLONG timestamp = 0; LONGLONG timestamp = 0;
HRESULT hr, status; HRESULT hr, status;
...@@ -1008,10 +1008,8 @@ static HRESULT WINAPI source_reader_async_commands_callback_Invoke(IMFAsyncCallb ...@@ -1008,10 +1008,8 @@ static HRESULT WINAPI source_reader_async_commands_callback_Invoke(IMFAsyncCallb
if (SUCCEEDED(hr = source_reader_start_source(reader))) if (SUCCEEDED(hr = source_reader_start_source(reader)))
{ {
request_sample = source_reader_get_read_result(reader, stream, command->flags, &status, &stream_index, if (!(report_sample = source_reader_get_read_result(reader, stream, command->flags, &status, &stream_index,
&stream_flags, &timestamp, &sample); &stream_flags, &timestamp, &sample)))
if (request_sample)
{ {
stream->requests++; stream->requests++;
source_reader_request_sample(reader, stream); source_reader_request_sample(reader, stream);
...@@ -1021,7 +1019,7 @@ static HRESULT WINAPI source_reader_async_commands_callback_Invoke(IMFAsyncCallb ...@@ -1021,7 +1019,7 @@ static HRESULT WINAPI source_reader_async_commands_callback_Invoke(IMFAsyncCallb
LeaveCriticalSection(&stream->cs); LeaveCriticalSection(&stream->cs);
if (!request_sample) if (report_sample)
IMFSourceReaderCallback_OnReadSample(reader->async_callback, status, stream_index, stream_flags, IMFSourceReaderCallback_OnReadSample(reader->async_callback, status, stream_index, stream_flags,
timestamp, sample); timestamp, sample);
...@@ -1532,7 +1530,6 @@ static HRESULT source_reader_read_sample(struct source_reader *reader, DWORD ind ...@@ -1532,7 +1530,6 @@ static HRESULT source_reader_read_sample(struct source_reader *reader, DWORD ind
unsigned int actual_index_tmp; unsigned int actual_index_tmp;
struct media_stream *stream; struct media_stream *stream;
LONGLONG timestamp_tmp; LONGLONG timestamp_tmp;
BOOL request_sample;
DWORD stream_index; DWORD stream_index;
HRESULT hr = S_OK; HRESULT hr = S_OK;
...@@ -1563,10 +1560,8 @@ static HRESULT source_reader_read_sample(struct source_reader *reader, DWORD ind ...@@ -1563,10 +1560,8 @@ static HRESULT source_reader_read_sample(struct source_reader *reader, DWORD ind
if (SUCCEEDED(hr = source_reader_start_source(reader))) if (SUCCEEDED(hr = source_reader_start_source(reader)))
{ {
request_sample = source_reader_get_read_result(reader, stream, flags, &hr, actual_index, stream_flags, if (!source_reader_get_read_result(reader, stream, flags, &hr, actual_index, stream_flags,
timestamp, sample); timestamp, sample))
if (request_sample)
{ {
while (list_empty(&stream->responses) && stream->state != STREAM_STATE_EOS) while (list_empty(&stream->responses) && stream->state != STREAM_STATE_EOS)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment