From: "Zebediah Figura (she/her)" Subject: Re: [PATCH v2 3/4] winegstreamer: Only seek if it was requested by the caller. Message-Id: Date: Fri, 11 Jun 2021 16:10:46 -0500 In-Reply-To: <20210611105356.311376-3-gmascellani@codeweavers.com> References: <20210611105356.311376-1-gmascellani@codeweavers.com> <20210611105356.311376-3-gmascellani@codeweavers.com> On 6/11/21 5:53 AM, Giovanni Mascellani wrote: > Signed-off-by: Giovanni Mascellani > --- > dlls/winegstreamer/media_source.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c > index 3e1e3001dc7..9188a350305 100644 > --- a/dlls/winegstreamer/media_source.c > +++ b/dlls/winegstreamer/media_source.c > @@ -324,8 +324,9 @@ static void start_pipeline(struct media_source *source, struct source_async_comm > > source->state = SOURCE_RUNNING; > > - unix_funcs->wg_parser_stream_seek(source->streams[0]->wg_stream, 1.0, > - position->hVal.QuadPart, 0, AM_SEEKING_AbsolutePositioning, AM_SEEKING_NoPositioning); > + if (position->vt == VT_I8) > + unix_funcs->wg_parser_stream_seek(source->streams[0]->wg_stream, 1.0, > + position->hVal.QuadPart, 0, AM_SEEKING_AbsolutePositioning, AM_SEEKING_NoPositioning); > unix_funcs->wg_parser_end_flush(source->wg_parser); > } > > I don't think this works reliably as-is. The API is a little awkward and doesn't communicate this clearly (sorry), but if GStreamer gives us a sample between wg_parser_stream_enable() and wg_parser_end_flush(), we'll return GST_FLOW_FLUSHING, which will generally cause the upstream element to stop sending data. The seek event is necessary to tell it to start sending data again. This situation is probably more than a little undesirable. We probably need to modify the interface and backend to prevent any samples from getting lost (and, ideally, to avoid seeking the GStreamer backend if we don't need to). What happens if you change which streams are selected without seeking? Currently the WG backend discards any events/buffers on disabled streams, which means that in general they won't be synchronized and we may end up throwing away an entire stream. My guess is that this is fine, because as far as I can tell mfplat doesn't actually make any synchronization guarantees even among selected streams, but I'd like to make sure...