mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-06 13:30:01 -05:00
Fix compilation with -Werror=float-conversion
Better make the conversions explicit so that we don't get any surprises. Fixes #4065
This commit is contained in:
parent
50870aac57
commit
1ae4374ccf
71 changed files with 286 additions and 284 deletions
|
|
@ -78,10 +78,10 @@ static void maap_message_debug(struct maap *maap, const struct avb_packet_maap *
|
|||
pw_log_info(" conflict-count: %d", AVB_PACKET_MAAP_GET_CONFLICT_COUNT(p));
|
||||
}
|
||||
|
||||
#define PROBE_TIMEOUT(n) ((n) + (MAAP_PROBE_INTERVAL_MS + \
|
||||
drand48() * MAAP_PROBE_INTERVAL_VAR_MS) * SPA_NSEC_PER_MSEC)
|
||||
#define ANNOUNCE_TIMEOUT(n) ((n) + (MAAP_ANNOUNCE_INTERVAL_MS + \
|
||||
drand48() * MAAP_ANNOUNCE_INTERVAL_VAR_MS) * SPA_NSEC_PER_MSEC)
|
||||
#define PROBE_TIMEOUT(n) (uint64_t)(((n) + (MAAP_PROBE_INTERVAL_MS + \
|
||||
drand48() * MAAP_PROBE_INTERVAL_VAR_MS) * SPA_NSEC_PER_MSEC))
|
||||
#define ANNOUNCE_TIMEOUT(n) (uint64_t)(((n) + (MAAP_ANNOUNCE_INTERVAL_MS + \
|
||||
drand48() * MAAP_ANNOUNCE_INTERVAL_VAR_MS) * SPA_NSEC_PER_MSEC))
|
||||
|
||||
static int make_new_address(struct maap *maap, uint64_t now, int range)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1022,12 +1022,12 @@ static struct spa_pod *get_prop_info(struct graph *graph, struct spa_pod_builder
|
|||
}
|
||||
} else if (p->hint & FC_HINT_INTEGER) {
|
||||
if (min == max) {
|
||||
spa_pod_builder_int(b, def);
|
||||
spa_pod_builder_int(b, (int32_t)def);
|
||||
} else {
|
||||
spa_pod_builder_push_choice(b, &f[1], SPA_CHOICE_Range, 0);
|
||||
spa_pod_builder_int(b, def);
|
||||
spa_pod_builder_int(b, min);
|
||||
spa_pod_builder_int(b, max);
|
||||
spa_pod_builder_int(b, (int32_t)def);
|
||||
spa_pod_builder_int(b, (int32_t)min);
|
||||
spa_pod_builder_int(b, (int32_t)max);
|
||||
spa_pod_builder_pop(b, &f[1]);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1073,7 +1073,7 @@ static struct spa_pod *get_props_param(struct graph *graph, struct spa_pod_build
|
|||
if (p->hint & FC_HINT_BOOLEAN) {
|
||||
spa_pod_builder_bool(b, port->control_data[0] <= 0.0f ? false : true);
|
||||
} else if (p->hint & FC_HINT_INTEGER) {
|
||||
spa_pod_builder_int(b, port->control_data[0]);
|
||||
spa_pod_builder_int(b, (int32_t)port->control_data[0]);
|
||||
} else {
|
||||
spa_pod_builder_float(b, port->control_data[0]);
|
||||
}
|
||||
|
|
@ -1140,7 +1140,7 @@ static int parse_params(struct graph *graph, const struct spa_pod *pod)
|
|||
if (spa_pod_parser_get_float(&prs, &value) >= 0) {
|
||||
val = &value;
|
||||
} else if (spa_pod_parser_get_double(&prs, &dbl_val) >= 0) {
|
||||
value = dbl_val;
|
||||
value = (float)dbl_val;
|
||||
val = &value;
|
||||
} else if (spa_pod_parser_get_int(&prs, &int_val) >= 0) {
|
||||
value = int_val;
|
||||
|
|
@ -1217,7 +1217,7 @@ static int sync_volume(struct graph *graph, struct volume *vol)
|
|||
float v = vol->mute ? 0.0f : vol->volumes[i];
|
||||
switch (vol->scale[n_port]) {
|
||||
case SCALE_CUBIC:
|
||||
v = cbrt(v);
|
||||
v = cbrtf(v);
|
||||
break;
|
||||
}
|
||||
v = v * (vol->max[n_port] - vol->min[n_port]) + vol->min[n_port];
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@ static void set_coefficient(struct biquad *bq, double b0, double b1, double b2,
|
|||
double a0, double a1, double a2)
|
||||
{
|
||||
double a0_inv = 1 / a0;
|
||||
bq->b0 = b0 * a0_inv;
|
||||
bq->b1 = b1 * a0_inv;
|
||||
bq->b2 = b2 * a0_inv;
|
||||
bq->a1 = a1 * a0_inv;
|
||||
bq->a2 = a2 * a0_inv;
|
||||
bq->b0 = (float)(b0 * a0_inv);
|
||||
bq->b1 = (float)(b1 * a0_inv);
|
||||
bq->b2 = (float)(b2 * a0_inv);
|
||||
bq->a1 = (float)(a1 * a0_inv);
|
||||
bq->a2 = (float)(a2 * a0_inv);
|
||||
}
|
||||
|
||||
static void biquad_lowpass(struct biquad *bq, double cutoff, double resonance)
|
||||
|
|
|
|||
|
|
@ -752,10 +752,10 @@ static float *create_hilbert(const char *filename, float gain, int delay, int of
|
|||
if (samples == NULL)
|
||||
return NULL;
|
||||
|
||||
gain *= 2 / M_PI;
|
||||
gain *= 2 / M_PIf;
|
||||
h = length / 2;
|
||||
for (i = 1; i < h; i += 2) {
|
||||
v = (gain / i) * (0.43f + 0.57f * cosf(i * M_PI / h));
|
||||
v = (gain / i) * (0.43f + 0.57f * cosf(i * M_PIf / h));
|
||||
samples[delay + h + i] = -v;
|
||||
samples[delay + h - i] = v;
|
||||
}
|
||||
|
|
@ -1134,7 +1134,7 @@ static void *delay_instantiate(const struct fc_descriptor * Descriptor,
|
|||
return NULL;
|
||||
|
||||
impl->rate = SampleRate;
|
||||
impl->buffer_samples = max_delay * impl->rate;
|
||||
impl->buffer_samples = (uint32_t)(max_delay * impl->rate);
|
||||
pw_log_info("max-delay:%f seconds rate:%lu samples:%d", max_delay, impl->rate, impl->buffer_samples);
|
||||
|
||||
impl->buffer = calloc(impl->buffer_samples, sizeof(float));
|
||||
|
|
@ -1163,7 +1163,7 @@ static void delay_run(void * Instance, unsigned long SampleCount)
|
|||
uint32_t r, w;
|
||||
|
||||
if (delay != impl->delay) {
|
||||
impl->delay_samples = SPA_CLAMP(delay * impl->rate, 0, impl->buffer_samples-1);
|
||||
impl->delay_samples = SPA_CLAMP((uint32_t)(delay * impl->rate), 0u, impl->buffer_samples-1);
|
||||
impl->delay = delay;
|
||||
}
|
||||
r = impl->ptr;
|
||||
|
|
@ -1453,7 +1453,7 @@ static struct fc_port exp_ports[] = {
|
|||
{ .index = 4,
|
||||
.name = "Base",
|
||||
.flags = FC_PORT_INPUT | FC_PORT_CONTROL,
|
||||
.def = M_E, .min = -10.0f, .max = 10.0f
|
||||
.def = M_Ef, .min = -10.0f, .max = 10.0f
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -1510,7 +1510,7 @@ static struct fc_port log_ports[] = {
|
|||
{ .index = 4,
|
||||
.name = "Base",
|
||||
.flags = FC_PORT_INPUT | FC_PORT_CONTROL,
|
||||
.def = M_E, .min = 2.0f, .max = 100.0f
|
||||
.def = M_Ef, .min = 2.0f, .max = 100.0f
|
||||
},
|
||||
{ .index = 5,
|
||||
.name = "M1",
|
||||
|
|
@ -1611,7 +1611,7 @@ static const struct fc_descriptor mult_desc = {
|
|||
.cleanup = builtin_cleanup,
|
||||
};
|
||||
|
||||
#define M_PI_M2 ( M_PI + M_PI )
|
||||
#define M_PI_M2f ( M_PIf + M_PIf )
|
||||
|
||||
/* sine */
|
||||
static void sine_run(void * Instance, unsigned long SampleCount)
|
||||
|
|
@ -1626,13 +1626,13 @@ static void sine_run(void * Instance, unsigned long SampleCount)
|
|||
|
||||
for (n = 0; n < SampleCount; n++) {
|
||||
if (out != NULL)
|
||||
out[n] = sin(impl->accum) * ampl + offs;
|
||||
out[n] = sinf(impl->accum) * ampl + offs;
|
||||
if (notify != NULL && n == 0)
|
||||
notify[0] = sin(impl->accum) * ampl + offs;
|
||||
notify[0] = sinf(impl->accum) * ampl + offs;
|
||||
|
||||
impl->accum += M_PI_M2 * freq / impl->rate;
|
||||
if (impl->accum >= M_PI_M2)
|
||||
impl->accum -= M_PI_M2;
|
||||
impl->accum += M_PI_M2f * freq / impl->rate;
|
||||
if (impl->accum >= M_PI_M2f)
|
||||
impl->accum -= M_PI_M2f;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1658,7 +1658,7 @@ static struct fc_port sine_ports[] = {
|
|||
{ .index = 4,
|
||||
.name = "Phase",
|
||||
.flags = FC_PORT_INPUT | FC_PORT_CONTROL,
|
||||
.def = 0.0f, .min = -M_PI, .max = M_PI
|
||||
.def = 0.0f, .min = -M_PIf, .max = M_PIf
|
||||
},
|
||||
{ .index = 5,
|
||||
.name = "Offset",
|
||||
|
|
|
|||
|
|
@ -1273,7 +1273,7 @@ static void rffti1_ps(int n, float *wa, int *ifac)
|
|||
int k1, j, ii;
|
||||
|
||||
int nf = decompose(n, ifac, ntryh);
|
||||
float argh = (2 * M_PI) / n;
|
||||
float argh = (2 * M_PIf) / n;
|
||||
int is = 0;
|
||||
int nfm1 = nf - 1;
|
||||
int l1 = 1;
|
||||
|
|
@ -1291,8 +1291,8 @@ static void rffti1_ps(int n, float *wa, int *ifac)
|
|||
for (ii = 3; ii <= ido; ii += 2) {
|
||||
i += 2;
|
||||
fi += 1;
|
||||
wa[i - 2] = cos(fi * argld);
|
||||
wa[i - 1] = sin(fi * argld);
|
||||
wa[i - 2] = cosf(fi * argld);
|
||||
wa[i - 1] = sinf(fi * argld);
|
||||
}
|
||||
is += ido;
|
||||
}
|
||||
|
|
@ -1306,7 +1306,7 @@ static void cffti1_ps(int n, float *wa, int *ifac)
|
|||
int k1, j, ii;
|
||||
|
||||
int nf = decompose(n, ifac, ntryh);
|
||||
float argh = (2 * M_PI) / (float)n;
|
||||
float argh = (2 * M_PIf) / (float)n;
|
||||
int i = 1;
|
||||
int l1 = 1;
|
||||
for (k1 = 1; k1 <= nf; k1++) {
|
||||
|
|
@ -1326,8 +1326,8 @@ static void cffti1_ps(int n, float *wa, int *ifac)
|
|||
for (ii = 4; ii <= idot; ii += 2) {
|
||||
i += 2;
|
||||
fi += 1;
|
||||
wa[i - 1] = cos(fi * argld);
|
||||
wa[i] = sin(fi * argld);
|
||||
wa[i - 1] = cosf(fi * argld);
|
||||
wa[i] = sinf(fi * argld);
|
||||
}
|
||||
if (ip > 5) {
|
||||
wa[i1 - 1] = wa[i - 1];
|
||||
|
|
@ -1440,11 +1440,11 @@ static PFFFT_Setup *new_setup_simd(int N, pffft_transform_t transform)
|
|||
int i = k / SIMD_SZ;
|
||||
int j = k % SIMD_SZ;
|
||||
for (m = 0; m < SIMD_SZ - 1; ++m) {
|
||||
float A = -2 * M_PI * (m + 1) * k / N;
|
||||
float A = -2 * M_PIf * (m + 1) * k / N;
|
||||
s->e[(2 * (i * 3 + m) + 0) * SIMD_SZ + j] =
|
||||
cos(A);
|
||||
cosf(A);
|
||||
s->e[(2 * (i * 3 + m) + 1) * SIMD_SZ + j] =
|
||||
sin(A);
|
||||
sinf(A);
|
||||
}
|
||||
}
|
||||
rffti1_ps(N / SIMD_SZ, s->twiddle, s->ifac);
|
||||
|
|
@ -1453,11 +1453,11 @@ static PFFFT_Setup *new_setup_simd(int N, pffft_transform_t transform)
|
|||
int i = k / SIMD_SZ;
|
||||
int j = k % SIMD_SZ;
|
||||
for (m = 0; m < SIMD_SZ - 1; ++m) {
|
||||
float A = -2 * M_PI * (m + 1) * k / N;
|
||||
float A = -2 * M_PIf * (m + 1) * k / N;
|
||||
s->e[(2 * (i * 3 + m) + 0) * SIMD_SZ + j] =
|
||||
cos(A);
|
||||
cosf(A);
|
||||
s->e[(2 * (i * 3 + m) + 1) * SIMD_SZ + j] =
|
||||
sin(A);
|
||||
sinf(A);
|
||||
}
|
||||
}
|
||||
cffti1_ps(N / SIMD_SZ, s->twiddle, s->ifac);
|
||||
|
|
@ -1765,7 +1765,7 @@ static NEVER_INLINE(void) pffft_real_finalize(int Ncvec, const v4sf * in,
|
|||
v4sf_union cr, ci, *uout = (v4sf_union *) out;
|
||||
v4sf save = in[7], zero = VZERO();
|
||||
float xr0, xi0, xr1, xi1, xr2, xi2, xr3, xi3;
|
||||
static const float s = M_SQRT2 / 2;
|
||||
static const float s = M_SQRT2f / 2;
|
||||
|
||||
cr.v = in[0];
|
||||
ci.v = in[Ncvec * 2 - 1];
|
||||
|
|
@ -1871,7 +1871,7 @@ static NEVER_INLINE(void) pffft_real_preprocess(int Ncvec, const v4sf * in,
|
|||
|
||||
v4sf_union Xr, Xi, *uout = (v4sf_union *) out;
|
||||
float cr0, ci0, cr1, ci1, cr2, ci2, cr3, ci3;
|
||||
static const float s = M_SQRT2;
|
||||
static const float s = M_SQRT2f;
|
||||
assert(in != out);
|
||||
for (k = 0; k < 4; ++k) {
|
||||
Xr.f[k] = ((float *)in)[8 * k];
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ static void capture_destroy(void *d)
|
|||
|
||||
static void recalculate_delay(struct impl *impl)
|
||||
{
|
||||
uint32_t target = impl->rate * impl->target_delay, cdelay, pdelay;
|
||||
uint32_t target = (uint32_t)(impl->rate * impl->target_delay), cdelay, pdelay;
|
||||
uint32_t delay, w;
|
||||
struct pw_time pwt;
|
||||
|
||||
|
|
@ -435,7 +435,7 @@ static void param_format_changed(struct impl *impl, const struct spa_pod *param,
|
|||
static void recalculate_buffer(struct impl *impl)
|
||||
{
|
||||
if (impl->target_delay > 0.0f && impl->channels > 0 && impl->rate > 0) {
|
||||
uint32_t delay = impl->rate * impl->target_delay;
|
||||
uint32_t delay = (uint32_t)(impl->rate * impl->target_delay);
|
||||
void *data;
|
||||
|
||||
impl->buffer_size = (delay + (1u<<15)) * 4;
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ struct impl {
|
|||
|
||||
struct spa_dll dll;
|
||||
float max_error;
|
||||
float corr;
|
||||
double corr;
|
||||
|
||||
uint64_t next_time;
|
||||
unsigned int have_sync:1;
|
||||
|
|
@ -244,7 +244,7 @@ static void on_timeout(void *d, uint64_t expirations)
|
|||
pw_log_debug("timeout %"PRIu64, duration);
|
||||
|
||||
current_time = impl->next_time;
|
||||
impl->next_time += duration / impl->corr * 1e9 / rate;
|
||||
impl->next_time += (uint64_t)(duration / impl->corr * 1e9 / rate);
|
||||
avail = spa_ringbuffer_get_read_index(&impl->ring, &index);
|
||||
|
||||
if (SPA_LIKELY(pos)) {
|
||||
|
|
@ -376,7 +376,7 @@ static void update_rate(struct impl *impl, uint32_t filled)
|
|||
|
||||
if (!impl->driving) {
|
||||
SPA_FLAG_SET(impl->rate_match->flags, SPA_IO_RATE_MATCH_FLAG_ACTIVE);
|
||||
impl->rate_match->rate = 1.0f / impl->corr;
|
||||
impl->rate_match->rate = 1.0 / impl->corr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -868,7 +868,7 @@ int format_info_to_spec(const struct format_info *info, struct sample_spec *ss,
|
|||
if (spa_json_is_float(val, len)) {
|
||||
if (spa_json_parse_float(val, len, &f) <= 0)
|
||||
return -EINVAL;
|
||||
ss->channels = f;
|
||||
ss->channels = (uint8_t)f;
|
||||
} else if (spa_json_is_array(val, len)) {
|
||||
return -ENOTSUP;
|
||||
} else if (spa_json_is_object(val, len)) {
|
||||
|
|
|
|||
|
|
@ -636,7 +636,7 @@ int message_put(struct message *m, ...)
|
|||
write_dict(m, va_arg(va, struct spa_dict*), true);
|
||||
break;
|
||||
case TAG_VOLUME:
|
||||
write_volume(m, va_arg(va, double));
|
||||
write_volume(m, (float)va_arg(va, double));
|
||||
break;
|
||||
case TAG_FORMAT_INFO:
|
||||
write_format_info(m, va_arg(va, struct format_info*));
|
||||
|
|
|
|||
|
|
@ -4559,7 +4559,7 @@ static int do_update_stream_sample_rate(struct client *client, uint32_t command,
|
|||
|
||||
stream->rate = rate;
|
||||
|
||||
corr = (double)rate/(double)stream->ss.rate;
|
||||
corr = (float)rate/(float)stream->ss.rate;
|
||||
pw_stream_set_control(stream->stream, SPA_PROP_rate, 1, &corr, NULL);
|
||||
|
||||
return reply_simple_ack(client, tag);
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ int volume_parse_param(const struct spa_pod *param, struct volume_info *info, bo
|
|||
{
|
||||
float step;
|
||||
if (spa_pod_get_float(&prop->value, &step) >= 0)
|
||||
info->steps = 0x10000u * step;
|
||||
info->steps = (uint32_t)(0x10000u * step);
|
||||
break;
|
||||
}
|
||||
case SPA_PROP_channelMap:
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ static void update_rate(struct impl *impl, uint32_t filled)
|
|||
error = (float)impl->target_latency - (float)(current_latency);
|
||||
error = SPA_CLAMP(error, -impl->max_error, impl->max_error);
|
||||
|
||||
corr = spa_dll_update(&impl->dll, error);
|
||||
corr = (float)spa_dll_update(&impl->dll, error);
|
||||
pw_log_debug("error:%f corr:%f current:%u target:%u",
|
||||
error, corr,
|
||||
current_latency, impl->target_latency);
|
||||
|
|
@ -853,7 +853,7 @@ do_stream_sync_volumes(struct spa_loop *loop,
|
|||
float soft_vols[SPA_AUDIO_MAX_CHANNELS];
|
||||
|
||||
for (i = 0; i < impl->volume.channels; i++) {
|
||||
vols[i] = pa_sw_volume_to_linear(impl->volume.values[i]);
|
||||
vols[i] = (float)pa_sw_volume_to_linear(impl->volume.values[i]);
|
||||
soft_vols[i] = 1.0f;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1639,7 +1639,7 @@ static void stream_props_changed(struct impl *impl, uint32_t id, const struct sp
|
|||
soft_vols[i] = 1.0f;
|
||||
}
|
||||
volume /= n_vols;
|
||||
volume = SPA_CLAMPF(cbrt(volume) * 30 - 30, VOLUME_MIN, VOLUME_MAX);
|
||||
volume = SPA_CLAMPF(cbrtf(volume) * 30 - 30, VOLUME_MIN, VOLUME_MAX);
|
||||
impl->volume = volume;
|
||||
|
||||
rtsp_send_volume(impl);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ static void rtp_audio_process_playback(void *data)
|
|||
error = (float)target_buffer - (float)avail;
|
||||
error = SPA_CLAMP(error, -impl->max_error, impl->max_error);
|
||||
|
||||
corr = spa_dll_update(&impl->dll, error);
|
||||
corr = (float)spa_dll_update(&impl->dll, error);
|
||||
|
||||
pw_log_trace("avail:%u target:%u error:%f corr:%f", avail,
|
||||
target_buffer, error, corr);
|
||||
|
|
@ -321,7 +321,7 @@ static void rtp_audio_process_capture(void *data)
|
|||
uint32_t rate = pos->clock.rate.denom;
|
||||
timestamp = pos->clock.position * impl->rate / rate;
|
||||
next_nsec = pos->clock.next_nsec;
|
||||
quantum = pos->clock.duration * SPA_NSEC_PER_SEC / (rate * pos->clock.rate_diff);
|
||||
quantum = (uint64_t)(pos->clock.duration * SPA_NSEC_PER_SEC / (rate * pos->clock.rate_diff));
|
||||
} else {
|
||||
timestamp = expected_timestamp;
|
||||
next_nsec = 0;
|
||||
|
|
|
|||
|
|
@ -206,10 +206,10 @@ static int rtp_midi_receive_midi(struct impl *impl, uint8_t *packet, uint32_t ti
|
|||
}
|
||||
pw_log_trace("%f %f %f %f", t, estimated, diff, impl->corr);
|
||||
|
||||
timestamp = t * impl->rate;
|
||||
timestamp = (uint32_t)(t * impl->rate);
|
||||
|
||||
impl->last_timestamp = ts;
|
||||
impl->last_time = t;
|
||||
impl->last_timestamp = (float)ts;
|
||||
impl->last_time = (float)t;
|
||||
}
|
||||
|
||||
filled = spa_ringbuffer_get_write_index(&impl->ring, &write);
|
||||
|
|
@ -248,7 +248,7 @@ static int rtp_midi_receive_midi(struct impl *impl, uint8_t *packet, uint32_t ti
|
|||
else
|
||||
offs += parse_varlen(&packet[offs], end - offs, &delta);
|
||||
|
||||
timestamp += delta * impl->corr;
|
||||
timestamp += (uint32_t)(delta * impl->corr);
|
||||
spa_pod_builder_control(&b, timestamp, SPA_CONTROL_Midi);
|
||||
|
||||
size = get_midi_size(&packet[offs], end - offs);
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ static void rtp_opus_process_playback(void *data)
|
|||
error = (float)target_buffer - (float)avail;
|
||||
error = SPA_CLAMP(error, -impl->max_error, impl->max_error);
|
||||
|
||||
corr = spa_dll_update(&impl->dll, error);
|
||||
corr = (float)spa_dll_update(&impl->dll, error);
|
||||
|
||||
pw_log_trace("avail:%u target:%u error:%f corr:%f", avail,
|
||||
target_buffer, error, corr);
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ static void parse_audio_info(const struct pw_properties *props, struct spa_audio
|
|||
|
||||
static uint32_t msec_to_samples(struct impl *impl, float msec)
|
||||
{
|
||||
return msec * impl->rate / 1000;
|
||||
return (uint32_t)(msec * impl->rate / 1000);
|
||||
}
|
||||
static float samples_to_msec(struct impl *impl, uint32_t samples)
|
||||
{
|
||||
|
|
@ -509,7 +509,7 @@ struct rtp_stream *rtp_stream_new(struct pw_core *core,
|
|||
/* We're not expecting odd ptimes, so this modulo should be 0 */
|
||||
if (fmodf(impl->target_buffer, ptime != 0)) {
|
||||
pw_log_warn("sess.latency.msec should be an integer multiple of rtp.ptime");
|
||||
impl->target_buffer = (impl->target_buffer / ptime) * impl->psamples;
|
||||
impl->target_buffer = (uint32_t)((impl->target_buffer / ptime) * impl->psamples);
|
||||
}
|
||||
|
||||
pw_properties_setf(props, PW_KEY_NODE_RATE, "1/%d", impl->rate);
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ static void vban_audio_process_playback(void *data)
|
|||
error = (float)target_buffer - (float)avail;
|
||||
error = SPA_CLAMP(error, -impl->max_error, impl->max_error);
|
||||
|
||||
corr = spa_dll_update(&impl->dll, error);
|
||||
corr = (float)spa_dll_update(&impl->dll, error);
|
||||
|
||||
pw_log_debug("avail:%u target:%u error:%f corr:%f", avail,
|
||||
target_buffer, error, corr);
|
||||
|
|
|
|||
|
|
@ -358,8 +358,8 @@ struct vban_stream *vban_stream_new(struct pw_core *core,
|
|||
if (!spa_atof(str, &max_ptime))
|
||||
max_ptime = DEFAULT_MAX_PTIME;
|
||||
|
||||
min_samples = min_ptime * impl->rate / 1000;
|
||||
max_samples = SPA_MIN(256, max_ptime * impl->rate / 1000);
|
||||
min_samples = (uint32_t)(min_ptime * impl->rate / 1000);
|
||||
max_samples = SPA_MIN(256u, (uint32_t)(max_ptime * impl->rate / 1000));
|
||||
|
||||
float ptime = 0;
|
||||
if ((str = pw_properties_get(props, "vban.ptime")) != NULL)
|
||||
|
|
@ -367,7 +367,7 @@ struct vban_stream *vban_stream_new(struct pw_core *core,
|
|||
ptime = 0.0;
|
||||
|
||||
if (ptime) {
|
||||
impl->psamples = ptime * impl->rate / 1000;
|
||||
impl->psamples = (uint32_t)(ptime * impl->rate / 1000);
|
||||
} else {
|
||||
impl->psamples = impl->mtu / impl->stride;
|
||||
impl->psamples = SPA_CLAMP(impl->psamples, min_samples, max_samples);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue