quartz: Introduce a helper to trace reference time.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Zebediah Figura 2020-01-30 19:05:17 -06:00 committed by Alexandre Julliard
parent f8a63ffda4
commit eea01d8e8b
6 changed files with 43 additions and 13 deletions

View File

@ -163,7 +163,7 @@ static HRESULT WINAPI ACMWrapper_Receive(TransformFilter *tf, IMediaSample *pSam
goto error;
}
TRACE("Sample start time: %u.%03u\n", (DWORD)(tStart/10000000), (DWORD)((tStart/10000)%1000));
TRACE("Sample start time: %s.\n", debugstr_time(tStart));
if (ash.cbSrcLengthUsed == cbSrcStream)
{
IMediaSample_SetTime(pOutSample, &tStart, &tStop);
@ -196,7 +196,7 @@ static HRESULT WINAPI ACMWrapper_Receive(TransformFilter *tf, IMediaSample *pSam
IMediaSample_SetMediaTime(pOutSample, NULL, NULL);
}
TRACE("Sample stop time: %u.%03u\n", (DWORD)(tStart/10000000), (DWORD)((tStart/10000)%1000));
TRACE("Sample stop time: %s\n", debugstr_time(tStart));
hr = IMemInputPin_Receive(This->tf.source.pMemInputPin, pOutSample);
if (hr != S_OK && hr != VFW_E_NOT_CONNECTED) {

View File

@ -171,7 +171,7 @@ static HRESULT DSoundRender_GetWritePos(DSoundRenderImpl *This, DWORD *ret_write
*ret_writepos = writepos;
} else if (delta_t < 0) {
REFERENCE_TIME past, min_writepos_t;
WARN("Delta too big %i/%i, overwriting old data or even skipping\n", (int)delta_t / 10000, (int)max_lag / 10000);
WARN("Delta too big %s/%s, overwriting old data or even skipping\n", debugstr_time(delta_t), debugstr_time(max_lag));
if (min_writepos >= playpos)
min_writepos_t = cur + time_from_pos(This, min_writepos - playpos);
else
@ -189,7 +189,7 @@ static HRESULT DSoundRender_GetWritePos(DSoundRenderImpl *This, DWORD *ret_write
}
} else /* delta_t > 0 */ {
DWORD aheadbytes;
WARN("Delta too big %i/%i, too far ahead\n", (int)delta_t / 10000, (int)max_lag / 10000);
WARN("Delta too big %s/%s, too far ahead\n", debugstr_time(delta_t), debugstr_time(max_lag));
aheadbytes = pos_from_time(This, delta_t);
WARN("Advancing %u bytes\n", aheadbytes);
if (delta_t >= DSoundRenderer_Max_Fill)
@ -204,7 +204,8 @@ end:
else
*pfree = This->buf_size + playpos - *ret_writepos;
if (time_from_pos(This, This->buf_size - *pfree) >= DSoundRenderer_Max_Fill) {
TRACE("Blocked: too full %i / %i\n", (int)(time_from_pos(This, This->buf_size - *pfree)/10000), (int)(DSoundRenderer_Max_Fill / 10000));
TRACE("Blocked: too full %s / %s\n", debugstr_time(time_from_pos(This, This->buf_size - *pfree)),
debugstr_time(DSoundRenderer_Max_Fill));
return S_FALSE;
}
return S_OK;

View File

@ -2500,6 +2500,8 @@ static HRESULT WINAPI MediaSeeking_GetStopPosition(IMediaSeeking *iface, LONGLON
}
LeaveCriticalSection(&graph->cs);
TRACE("Returning %s (%s seconds).\n", wine_dbgstr_longlong(*stop), debugstr_time(*stop));
return hr;
}
@ -2525,7 +2527,7 @@ static HRESULT WINAPI MediaSeeking_GetCurrentPosition(IMediaSeeking *iface, LONG
LeaveCriticalSection(&graph->cs);
TRACE("Returning %s.\n", wine_dbgstr_longlong(ret));
TRACE("Returning %s (%s seconds).\n", wine_dbgstr_longlong(ret), debugstr_time(ret));
*current = ret;
return S_OK;
@ -2565,6 +2567,12 @@ static HRESULT WINAPI MediaSeeking_SetPositions(IMediaSeeking *iface, LONGLONG *
TRACE("graph %p, current %s, current_flags %#x, stop %s, stop_flags %#x.\n", graph,
current_ptr ? wine_dbgstr_longlong(*current_ptr) : "<null>", current_flags,
stop_ptr ? wine_dbgstr_longlong(*stop_ptr): "<null>", stop_flags);
if (current_ptr)
TRACE("Setting current position to %s (%s seconds).\n",
wine_dbgstr_longlong(*current_ptr), debugstr_time(*current_ptr));
if (stop_ptr)
TRACE("Setting stop position to %s (%s seconds).\n",
wine_dbgstr_longlong(*stop_ptr), debugstr_time(*stop_ptr));
if ((current_flags & 0x7) != AM_SEEKING_AbsolutePositioning
&& (current_flags & 0x7) != AM_SEEKING_NoPositioning)
@ -5249,7 +5257,7 @@ static HRESULT WINAPI MediaFilter_Run(IMediaFilter *iface, REFERENCE_TIME start)
IFilterGraphImpl *graph = impl_from_IMediaFilter(iface);
REFERENCE_TIME stream_start = start;
TRACE("graph %p, start %s.\n", graph, wine_dbgstr_longlong(start));
TRACE("graph %p, start %s.\n", graph, debugstr_time(start));
EnterCriticalSection(&graph->cs);

View File

@ -564,7 +564,8 @@ static HRESULT WINAPI StdMediaSample2_SetTime(IMediaSample2 *iface, REFERENCE_TI
{
StdMediaSample2 *sample = impl_from_IMediaSample2(iface);
TRACE("iface %p, start %p, end %p.\n", iface, start, end);
TRACE("sample %p, start %s, end %s.\n", sample, start ? debugstr_time(*start) : "(null)",
end ? debugstr_time(*end) : "(null)");
if (start)
{
@ -745,7 +746,8 @@ static HRESULT WINAPI StdMediaSample2_SetMediaTime(IMediaSample2 *iface, LONGLON
{
StdMediaSample2 *sample = impl_from_IMediaSample2(iface);
TRACE("sample %p, start %p, end %p.\n", iface, start, end);
TRACE("sample %p, start %s, end %s.\n", sample, start ? debugstr_time(*start) : "(null)",
end ? debugstr_time(*end) : "(null)");
if (start)
{

View File

@ -36,6 +36,26 @@
#include "wine/strmbase.h"
#include "wine/list.h"
static inline const char *debugstr_time(REFERENCE_TIME time)
{
ULONGLONG abstime = time >= 0 ? time : -time;
unsigned int i = 0, j = 0;
char buffer[23], rev[23];
while (abstime || i <= 8)
{
buffer[i++] = '0' + (abstime % 10);
abstime /= 10;
if (i == 7) buffer[i++] = '.';
}
if (time < 0) buffer[i++] = '-';
while (i--) rev[j++] = buffer[i];
rev[j] = 0;
return wine_dbg_sprintf("%s", rev);
}
/* see IAsyncReader::Request on MSDN for the explanation of this */
#define MEDIATIME_FROM_BYTES(x) ((LONGLONG)(x) * 10000000)
#define BYTES_FROM_MEDIATIME(time) ((time) / 10000000)

View File

@ -202,8 +202,6 @@ static HRESULT WINAPI SystemClockImpl_GetTime(IReferenceClock *iface, REFERENCE_
REFERENCE_TIME ret;
HRESULT hr;
TRACE("clock %p, time %p.\n", clock, time);
if (!time) {
return E_POINTER;
}
@ -217,6 +215,7 @@ static HRESULT WINAPI SystemClockImpl_GetTime(IReferenceClock *iface, REFERENCE_
LeaveCriticalSection(&clock->cs);
TRACE("clock %p, time %p, returning %s.\n", clock, time, debugstr_time(ret));
return hr;
}
@ -227,7 +226,7 @@ static HRESULT WINAPI SystemClockImpl_AdviseTime(IReferenceClock *iface,
struct advise_sink *sink;
TRACE("clock %p, base %s, offset %s, event %#lx, cookie %p.\n",
clock, wine_dbgstr_longlong(base), wine_dbgstr_longlong(offset), event, cookie);
clock, debugstr_time(base), debugstr_time(offset), event, cookie);
if (!event)
return E_INVALIDARG;
@ -263,7 +262,7 @@ static HRESULT WINAPI SystemClockImpl_AdvisePeriodic(IReferenceClock* iface,
struct advise_sink *sink;
TRACE("clock %p, start %s, period %s, semaphore %#lx, cookie %p.\n",
clock, wine_dbgstr_longlong(start), wine_dbgstr_longlong(period), semaphore, cookie);
clock, debugstr_time(start), debugstr_time(period), semaphore, cookie);
if (!semaphore)
return E_INVALIDARG;