Connor McAdams : winegstreamer: Delay duration query until caps have been acquired.
Alexandre Julliard
julliard at winehq.org
Fri Apr 30 16:03:27 CDT 2021
Module: wine
Branch: master
Commit: 2c5314d007755241a8705335ffbf94e5b60a2680
URL: https://source.winehq.org/git/wine.git/?a=commit;h=2c5314d007755241a8705335ffbf94e5b60a2680
Author: Connor McAdams <cmcadams at codeweavers.com>
Date: Thu Apr 29 15:49:13 2021 -0500
winegstreamer: Delay duration query until caps have been acquired.
Signed-off-by: Connor McAdams <cmcadams at codeweavers.com>
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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 5529321490e..0d59297a026 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);
More information about the wine-cvs
mailing list