"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "dlls/strmbase/qualitycontrol.c" between
wine-5.12.tar.xz and wine-5.13.tar.xz

About: Wine is an Open Source implementation of the MS Windows API on top of X, OpenGL, and Unix. Think of Wine as a compatibility layer for running Windows programs. Development release.

qualitycontrol.c  (wine-5.12.tar.xz):qualitycontrol.c  (wine-5.13.tar.xz)
skipping to change at line 30 skipping to change at line 30
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "strmbase_private.h" #include "strmbase_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(strmbase_qc); WINE_DEFAULT_DEBUG_CHANNEL(strmbase_qc);
HRESULT QualityControlImpl_Create(struct strmbase_pin *pin, QualityControlImpl * *ppv) static inline struct strmbase_qc *impl_from_IQualityControl(IQualityControl *ifa ce)
{ {
QualityControlImpl *This; return CONTAINING_RECORD(iface, struct strmbase_qc, IQualityControl_iface);
*ppv = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(QualityControlImpl
));
if (!*ppv)
return E_OUTOFMEMORY;
This = *ppv;
This->pin = pin;
This->tonotify = NULL;
This->current_rstart = This->current_rstop = -1;
TRACE("-> %p\n", This);
return S_OK;
}
void QualityControlImpl_Destroy(QualityControlImpl *This)
{
HeapFree(GetProcessHeap(),0,This);
}
static inline QualityControlImpl *impl_from_IQualityControl(IQualityControl *ifa
ce)
{
return CONTAINING_RECORD(iface, QualityControlImpl, IQualityControl_iface);
} }
HRESULT WINAPI QualityControlImpl_QueryInterface(IQualityControl *iface, REFIID riid, void **ppv) static HRESULT WINAPI quality_control_QueryInterface(IQualityControl *iface, REF IID riid, void **ppv)
{ {
QualityControlImpl *This = impl_from_IQualityControl(iface); struct strmbase_qc *This = impl_from_IQualityControl(iface);
return IBaseFilter_QueryInterface(&This->pin->filter->IBaseFilter_iface, rii d, ppv); return IBaseFilter_QueryInterface(&This->pin->filter->IBaseFilter_iface, rii d, ppv);
} }
ULONG WINAPI QualityControlImpl_AddRef(IQualityControl *iface) static ULONG WINAPI quality_control_AddRef(IQualityControl *iface)
{ {
QualityControlImpl *This = impl_from_IQualityControl(iface); struct strmbase_qc *This = impl_from_IQualityControl(iface);
return IBaseFilter_AddRef(&This->pin->filter->IBaseFilter_iface); return IBaseFilter_AddRef(&This->pin->filter->IBaseFilter_iface);
} }
ULONG WINAPI QualityControlImpl_Release(IQualityControl *iface) static ULONG WINAPI quality_control_Release(IQualityControl *iface)
{ {
QualityControlImpl *This = impl_from_IQualityControl(iface); struct strmbase_qc *This = impl_from_IQualityControl(iface);
return IBaseFilter_Release(&This->pin->filter->IBaseFilter_iface); return IBaseFilter_Release(&This->pin->filter->IBaseFilter_iface);
} }
HRESULT WINAPI QualityControlImpl_Notify(IQualityControl *iface, IBaseFilter *se nder, Quality qm) static HRESULT WINAPI quality_control_Notify(IQualityControl *iface, IBaseFilter *sender, Quality qm)
{ {
QualityControlImpl *This = impl_from_IQualityControl(iface); struct strmbase_qc *This = impl_from_IQualityControl(iface);
HRESULT hr = S_FALSE; HRESULT hr = S_FALSE;
TRACE("iface %p, sender %p, type %#x, proportion %u, late %s, timestamp %s.\ n", TRACE("iface %p, sender %p, type %#x, proportion %u, late %s, timestamp %s.\ n",
iface, sender, qm.Type, qm.Proportion, debugstr_time(qm.Late), debugstr_ time(qm.TimeStamp)); iface, sender, qm.Type, qm.Proportion, debugstr_time(qm.Late), debugstr_ time(qm.TimeStamp));
if (This->tonotify) if (This->tonotify)
return IQualityControl_Notify(This->tonotify, &This->pin->filter->IBaseF ilter_iface, qm); return IQualityControl_Notify(This->tonotify, &This->pin->filter->IBaseF ilter_iface, qm);
if (This->pin->peer) if (This->pin->peer)
{ {
skipping to change at line 97 skipping to change at line 78
if (qc) if (qc)
{ {
hr = IQualityControl_Notify(qc, &This->pin->filter->IBaseFilter_ifac e, qm); hr = IQualityControl_Notify(qc, &This->pin->filter->IBaseFilter_ifac e, qm);
IQualityControl_Release(qc); IQualityControl_Release(qc);
} }
} }
return hr; return hr;
} }
HRESULT WINAPI QualityControlImpl_SetSink(IQualityControl *iface, IQualityContro l *tonotify) static HRESULT WINAPI quality_control_SetSink(IQualityControl *iface, IQualityCo ntrol *tonotify)
{ {
QualityControlImpl *This = impl_from_IQualityControl(iface); struct strmbase_qc *This = impl_from_IQualityControl(iface);
TRACE("%p %p\n", This, tonotify); TRACE("%p %p\n", This, tonotify);
This->tonotify = tonotify; This->tonotify = tonotify;
return S_OK; return S_OK;
} }
static const IQualityControlVtbl quality_control_vtbl =
{
quality_control_QueryInterface,
quality_control_AddRef,
quality_control_Release,
quality_control_Notify,
quality_control_SetSink,
};
/* Macros copied from gstreamer, weighted average between old average and new on es */ /* Macros copied from gstreamer, weighted average between old average and new on es */
#define DO_RUNNING_AVG(avg,val,size) (((val) + ((size)-1) * (avg)) / (size)) #define DO_RUNNING_AVG(avg,val,size) (((val) + ((size)-1) * (avg)) / (size))
/* generic running average, this has a neutral window size */ /* generic running average, this has a neutral window size */
#define UPDATE_RUNNING_AVG(avg,val) DO_RUNNING_AVG(avg,val,8) #define UPDATE_RUNNING_AVG(avg,val) DO_RUNNING_AVG(avg,val,8)
/* the windows for these running averages are experimentally obtained. /* the windows for these running averages are experimentally obtained.
* positive values get averaged more while negative values use a small * positive values get averaged more while negative values use a small
* window so we can react faster to badness. */ * window so we can react faster to badness. */
#define UPDATE_RUNNING_AVG_P(avg,val) DO_RUNNING_AVG(avg,val,16) #define UPDATE_RUNNING_AVG_P(avg,val) DO_RUNNING_AVG(avg,val,16)
#define UPDATE_RUNNING_AVG_N(avg,val) DO_RUNNING_AVG(avg,val,4) #define UPDATE_RUNNING_AVG_N(avg,val) DO_RUNNING_AVG(avg,val,4)
void QualityControlRender_Start(QualityControlImpl *This, REFERENCE_TIME tStart) void QualityControlRender_Start(struct strmbase_qc *This, REFERENCE_TIME tStart)
{ {
This->avg_render = This->last_in_time = This->last_left = This->avg_duration = This->avg_pt = -1; This->avg_render = This->last_in_time = This->last_left = This->avg_duration = This->avg_pt = -1;
This->clockstart = tStart; This->clockstart = tStart;
This->avg_rate = -1.0; This->avg_rate = -1.0;
This->rendered = This->dropped = 0; This->rendered = This->dropped = 0;
This->is_dropped = FALSE; This->is_dropped = FALSE;
This->qos_handled = TRUE; /* Lie that will be corrected on first adjustment */ This->qos_handled = TRUE; /* Lie that will be corrected on first adjustment */
} }
static BOOL QualityControlRender_IsLate(QualityControlImpl *This, REFERENCE_TIME jitter, static BOOL QualityControlRender_IsLate(struct strmbase_qc *This, REFERENCE_TIME jitter,
REFERENCE_TIME start, REFERENCE_TIME sto p) REFERENCE_TIME start, REFERENCE_TIME sto p)
{ {
REFERENCE_TIME max_lateness = 200000; REFERENCE_TIME max_lateness = 200000;
TRACE("jitter %s, start %s, stop %s.\n", debugstr_time(jitter), TRACE("jitter %s, start %s, stop %s.\n", debugstr_time(jitter),
debugstr_time(start), debugstr_time(stop)); debugstr_time(start), debugstr_time(stop));
/* we can add a valid stop time */ /* we can add a valid stop time */
if (stop >= start) if (stop >= start)
max_lateness += stop; max_lateness += stop;
skipping to change at line 156 skipping to change at line 146
if (This->last_in_time < 0 || if (This->last_in_time < 0 ||
start - This->last_in_time < 10000000) start - This->last_in_time < 10000000)
return TRUE; return TRUE;
FIXME("A lot of buffers are being dropped.\n"); FIXME("A lot of buffers are being dropped.\n");
FIXME("There may be a timestamping problem, or this computer is too slow .\n"); FIXME("There may be a timestamping problem, or this computer is too slow .\n");
} }
This->last_in_time = start; This->last_in_time = start;
return FALSE; return FALSE;
} }
void QualityControlRender_DoQOS(QualityControlImpl *priv) void QualityControlRender_DoQOS(struct strmbase_qc *priv)
{ {
REFERENCE_TIME start, stop, jitter, pt, entered, left, duration; REFERENCE_TIME start, stop, jitter, pt, entered, left, duration;
double rate; double rate;
TRACE("%p\n", priv); TRACE("%p\n", priv);
if (!priv->pin->filter->clock || priv->current_rstart < 0) if (!priv->pin->filter->clock || priv->current_rstart < 0)
return; return;
start = priv->current_rstart; start = priv->current_rstart;
skipping to change at line 268 skipping to change at line 258
q.TimeStamp = priv->current_rstart; q.TimeStamp = priv->current_rstart;
TRACE("Late: %s from %s, rate: %g\n", debugstr_time(q.Late), debugstr_ti me(q.TimeStamp), 1./priv->avg_rate); TRACE("Late: %s from %s, rate: %g\n", debugstr_time(q.Late), debugstr_ti me(q.TimeStamp), 1./priv->avg_rate);
hr = IQualityControl_Notify(&priv->IQualityControl_iface, &priv->pin->fi lter->IBaseFilter_iface, q); hr = IQualityControl_Notify(&priv->IQualityControl_iface, &priv->pin->fi lter->IBaseFilter_iface, q);
priv->qos_handled = hr == S_OK; priv->qos_handled = hr == S_OK;
} }
/* record when this buffer will leave us */ /* record when this buffer will leave us */
priv->last_left = left; priv->last_left = left;
} }
void QualityControlRender_BeginRender(QualityControlImpl *This, REFERENCE_TIME s tart, REFERENCE_TIME stop) void QualityControlRender_BeginRender(struct strmbase_qc *This, REFERENCE_TIME s tart, REFERENCE_TIME stop)
{ {
This->start = -1; This->start = -1;
This->current_rstart = start; This->current_rstart = start;
This->current_rstop = max(stop, start); This->current_rstop = max(stop, start);
if (start >= 0) if (start >= 0)
{ {
REFERENCE_TIME now; REFERENCE_TIME now;
IReferenceClock_GetTime(This->pin->filter->clock, &now); IReferenceClock_GetTime(This->pin->filter->clock, &now);
skipping to change at line 301 skipping to change at line 291
This->rendered++; This->rendered++;
if (!This->pin->filter->clock) if (!This->pin->filter->clock)
return; return;
IReferenceClock_GetTime(This->pin->filter->clock, &This->start); IReferenceClock_GetTime(This->pin->filter->clock, &This->start);
TRACE("Starting at %s.\n", debugstr_time(This->start)); TRACE("Starting at %s.\n", debugstr_time(This->start));
} }
void QualityControlRender_EndRender(QualityControlImpl *This) void QualityControlRender_EndRender(struct strmbase_qc *This)
{ {
REFERENCE_TIME elapsed; REFERENCE_TIME elapsed;
TRACE("%p\n", This); TRACE("%p\n", This);
if (!This->pin->filter->clock || This->start < 0 if (!This->pin->filter->clock || This->start < 0
|| FAILED(IReferenceClock_GetTime(This->pin->filter->clock, &This->s top))) || FAILED(IReferenceClock_GetTime(This->pin->filter->clock, &This->s top)))
return; return;
elapsed = This->start - This->stop; elapsed = This->start - This->stop;
if (elapsed < 0) if (elapsed < 0)
return; return;
if (This->avg_render < 0) if (This->avg_render < 0)
This->avg_render = elapsed; This->avg_render = elapsed;
else else
This->avg_render = UPDATE_RUNNING_AVG (This->avg_render, elapsed); This->avg_render = UPDATE_RUNNING_AVG (This->avg_render, elapsed);
} }
void strmbase_qc_init(struct strmbase_qc *qc, struct strmbase_pin *pin)
{
memset(qc, 0, sizeof(*qc));
qc->pin = pin;
qc->current_rstart = qc->current_rstop = -1;
qc->IQualityControl_iface.lpVtbl = &quality_control_vtbl;
}
 End of changes. 19 change blocks. 
38 lines changed or deleted 26 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)