mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -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
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue