On 9/1/21 4:05 PM, Derek Lesho wrote:
diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c index 383afcfce75..abd9a220a7f 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -541,14 +541,21 @@ static DWORD CALLBACK read_thread(void *arg) HRESULT hr; void *data;
- if (!unix_funcs->wg_parser_get_read_request(source->wg_parser, &data, &offset, &size)) + if (!unix_funcs->wg_parser_get_next_read_offset(source->wg_parser, &offset, &size)) continue;
+ data = malloc(size); + ret_size = 0; +
This buffer should probably be retained, and grown if necessary, rather than allocated on every iteration. Same with the quartz version.
if (SUCCEEDED(hr = IMFByteStream_SetCurrentPosition(byte_stream, offset))) hr = IMFByteStream_Read(byte_stream, data, size, &ret_size); + if (FAILED(hr)) + ERR("Failed to read source stream bytes %p+%u. hr=%#x\n", data, size, hr); if (SUCCEEDED(hr) && ret_size != size) ERR("Unexpected short read: requested %u bytes, got %u.\n", size, ret_size); - unix_funcs->wg_parser_complete_read_request(source->wg_parser, SUCCEEDED(hr)); + unix_funcs->wg_parser_push_data(source->wg_parser, SUCCEEDED(hr) ? data : NULL, ret_size); + + free(data); }
TRACE("Media source is shutting down; exiting.\n");