[PATCH 4/5] winegstreamer: Don't try to convert duration from byte length.

Zebediah Figura zfigura at codeweavers.com
Thu Jul 22 00:19:03 CDT 2021

This effectively reverts 613446d018b792b10d067314831901437b4ff6e5.

Duration and convert queries, in general, appear to be handled by the first
upstream element that knows how. If two different elements respond to each
query, we may treat the byte duration of the whole file as if it were the
duration of a single stream, or treat an undecoded byte duration as if it were a
decoded byte duration.

The aforementioned commit was written in order to ensure that we receive a valid
duration for test.mp3 in quartz_test.exe, and is obviated by the previous
patches which retry duration queries until successful (or EOS).

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51126
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Supersedes 208044.

 dlls/winegstreamer/wg_parser.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c
index f2a74399b5a..169f223c5a5 100644
--- a/dlls/winegstreamer/wg_parser.c
+++ b/dlls/winegstreamer/wg_parser.c
@@ -1525,7 +1525,7 @@ static HRESULT CDECL wg_parser_connect(struct wg_parser *parser, uint64_t file_s
     for (i = 0; i < parser->stream_count; ++i)
         struct wg_parser_stream *stream = parser->streams[i];
-        gint64 duration, byte_length;
+        gint64 duration;
         while (!stream->has_caps && !parser->error)
             pthread_cond_wait(&parser->init_cond, &parser->mutex);
@@ -1567,18 +1567,6 @@ static HRESULT CDECL wg_parser_connect(struct wg_parser *parser, uint64_t file_s
-            GST_INFO("Failed to query time duration; trying to convert from byte length.\n");
-            /* To accurately get a duration for the stream, we want to only
-             * consider the length of that stream. Hence, query for the pad
-             * duration, instead of using the file duration. */
-            if (gst_pad_query_duration(stream->their_src, GST_FORMAT_BYTES, &byte_length)
-                    && gst_pad_query_convert(stream->their_src, GST_FORMAT_BYTES, byte_length,
-                            GST_FORMAT_TIME, &duration))
-            {
-                stream->duration = duration / 100;
-                break;
-            }
             if (stream->eos)
                 stream->duration = 0;

More information about the wine-devel mailing list