From: Connor McAdams cmcadams@codeweavers.com
Signed-off-by: Connor McAdams cmcadams@codeweavers.com Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/waveparser.c | 2 +- dlls/winegstreamer/wg_parser.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/quartz/tests/waveparser.c b/dlls/quartz/tests/waveparser.c index f3ea8f2b482..f78e15e5c19 100644 --- a/dlls/quartz/tests/waveparser.c +++ b/dlls/quartz/tests/waveparser.c @@ -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); diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c index d6aceff8cfe..c06e5af8160 100644 --- a/dlls/winegstreamer/wg_parser.c +++ b/dlls/winegstreamer/wg_parser.c @@ -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);