improve: debug

This commit is contained in:
Wim Taymans 2019-09-05 13:09:01 +02:00
parent 0eb2705766
commit b1bfc900d6
3 changed files with 14 additions and 2 deletions

View file

@ -83,7 +83,7 @@ struct spa_io_range {
struct spa_io_clock {
uint32_t id; /**< unique clock id, set by application */
uint32_t flags; /**< clock flags */
uint64_t nsec; /**< time in nanoseconds */
uint64_t nsec; /**< time in nanoseconds against monotonic clock */
uint64_t count; /**< a media specific counter. Can be used to detect
* gaps in the media. It usually represents the amount
* of processed media units (packets, frames,

View file

@ -139,7 +139,7 @@ static void impl_native_update_rate(struct resample *r, double rate)
static uint32_t impl_native_in_len(struct resample *r, uint32_t out_len)
{
struct native_data *data = r->data; \
struct native_data *data = r->data;
uint32_t in_len;
in_len = (data->phase + out_len * data->frac) / data->out_rate;
@ -232,6 +232,8 @@ static void impl_native_process(struct resample *r,
for (c = 0; c < r->channels; c++)
memmove(history[c], &history[c][in], remain * sizeof(float));
}
spa_log_trace_fp(r->log, "native %p: in:%d remain:%d", r, in, remain);
}
data->hist = remain;
return;

View file

@ -29,8 +29,11 @@
#include <errno.h>
#include <time.h>
#include <spa/support/log-impl.h>
#include <spa/debug/mem.h>
SPA_LOG_IMPL(logger);
#include "resample.h"
#include "resample-native.h"
@ -65,6 +68,7 @@ static void test_native(void)
struct resample r;
spa_zero(r);
r.log = &logger.log;
r.channels = 1;
r.i_rate = 44100;
r.o_rate = 44100;
@ -73,6 +77,7 @@ static void test_native(void)
feed_1(&r);
spa_zero(r);
r.log = &logger.log;
r.channels = 1;
r.i_rate = 44100;
r.o_rate = 48000;
@ -114,6 +119,7 @@ static void test_in_len(void)
struct resample r;
spa_zero(r);
r.log = &logger.log;
r.channels = 1;
r.i_rate = 32000;
r.o_rate = 48000;
@ -122,6 +128,7 @@ static void test_in_len(void)
pull_blocks(&r, 1024);
spa_zero(r);
r.log = &logger.log;
r.channels = 1;
r.i_rate = 44100;
r.o_rate = 48000;
@ -130,6 +137,7 @@ static void test_in_len(void)
pull_blocks(&r, 1024);
spa_zero(r);
r.log = &logger.log;
r.channels = 1;
r.i_rate = 48000;
r.o_rate = 44100;
@ -140,6 +148,8 @@ static void test_in_len(void)
int main(int argc, char *argv[])
{
logger.log.level = SPA_LOG_LEVEL_TRACE;
test_native();
test_in_len();