Zebediah Figura : winegstreamer: Clamp both timestamp and timestamp + diff to 0.
Module: wine Branch: stable Commit: 5442ba0b65f971ef7bf6bb57ee839424038ff81d URL: https://source.winehq.org/git/wine.git/?a=commit;h=5442ba0b65f971ef7bf6bb57e... Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Mon Mar 16 21:28:26 2020 -0500 winegstreamer: Clamp both timestamp and timestamp + diff to 0. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> (cherry picked from commit 5ca1d28e8df7e3e87e5b9f3ff51445b07dfcc2fb) Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> --- dlls/winegstreamer/gstdemux.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index cbded6abf5..3ab9e7c663 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -1786,6 +1786,8 @@ static HRESULT WINAPI GST_QualityControl_Notify(IQualityControl *iface, IBaseFil { struct gstdemux_source *pin = impl_from_IQualityControl(iface); GstQOSType type = GST_QOS_TYPE_OVERFLOW; + GstClockTime timestamp; + GstClockTimeDiff diff; GstEvent *evt; TRACE("(%p)->(%p, { 0x%x %u %s %s })\n", pin, sender, @@ -1795,16 +1797,23 @@ static HRESULT WINAPI GST_QualityControl_Notify(IQualityControl *iface, IBaseFil mark_wine_thread(); - if (qm.Type == Flood) - qm.Late = 0; - /* GSTQOS_TYPE_OVERFLOW is also used for buffers that arrive on time, but * DirectShow filters might use Famine, so check that there actually is an * underrun. */ if (qm.Type == Famine && qm.Proportion > 1000) type = GST_QOS_TYPE_UNDERFLOW; - evt = gst_event_new_qos(type, qm.Proportion / 1000.0, qm.Late * 100, qm.TimeStamp * 100); + /* DirectShow filters sometimes pass negative timestamps (Audiosurf uses the + * current time instead of the time of the last buffer). GstClockTime is + * unsigned, so clamp it to 0. */ + timestamp = max(qm.TimeStamp * 100, 0); + + /* The documentation specifies that timestamp + diff must be nonnegative. */ + diff = qm.Late * 100; + if (timestamp < -diff) + diff = -timestamp; + + evt = gst_event_new_qos(type, qm.Proportion / 1000.0, diff, timestamp); if (!evt) { WARN("Failed to create QOS event\n");
participants (1)
-
Alexandre Julliard