Commit 2c5314d0 authored by Connor McAdams's avatar Connor McAdams Committed by Alexandre Julliard

winegstreamer: Delay duration query until caps have been acquired.

parent ca03802a
......@@ -929,7 +929,7 @@ static void test_seeking(void)
duration = 0xdeadbeef;
hr = IMediaSeeking_GetDuration(seeking, &duration);
ok(hr == S_OK, "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));
stop = current = 0xdeadbeef;
hr = IMediaSeeking_GetStopPosition(seeking, &stop);
......
......@@ -1553,7 +1553,6 @@ static HRESULT CDECL wg_parser_connect(struct wg_parser *parser, uint64_t file_s
{
struct wg_parser_stream *stream = parser->streams[i];
stream->duration = query_duration(stream->their_src);
while (!stream->has_caps && !parser->error)
pthread_cond_wait(&parser->init_cond, &parser->mutex);
if (parser->error)
......@@ -1561,6 +1560,12 @@ static HRESULT CDECL wg_parser_connect(struct wg_parser *parser, uint64_t file_s
pthread_mutex_unlock(&parser->mutex);
return E_FAIL;
}
/* GStreamer doesn't actually provide any guarantees about when duration
* is available, even for seekable streams. However, many elements (e.g.
* avidemux, wavparse, qtdemux) in practice record duration before
* fixing caps, so as a heuristic, wait until we get caps before trying
* to query for duration. */
stream->duration = query_duration(stream->their_src);
}
pthread_mutex_unlock(&parser->mutex);
......
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