mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-30 21:37:53 -04:00
spa: plugins: libcamera: Drop rate dependent calculations
The clock has SPA_IO_CLOCK_FLAG_NO_RATE set unconditionally and the rate is usally 0/0. So all the rate calculations produce NaN and are not necessary. Drop them. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
This commit is contained in:
parent
e2f2b9a273
commit
c8f81fcdbb
1 changed files with 8 additions and 16 deletions
|
|
@ -1060,20 +1060,12 @@ void handle_completed_request(struct impl *impl, libcamera::Request *request)
|
||||||
const FrameMetadata &fmd = buffer->metadata();
|
const FrameMetadata &fmd = buffer->metadata();
|
||||||
|
|
||||||
if (impl->clock) {
|
if (impl->clock) {
|
||||||
double target = (double)port->info.rate.num / port->info.rate.denom;
|
/*
|
||||||
double corr;
|
* The clock has SPA_IO_CLOCK_FLAG_NO_RATE set, so there is no
|
||||||
|
* need to update any rate specific fields.
|
||||||
if (impl->dll.bw == 0.0) {
|
* As libcamera uses CLOCK_MONOTONIC internally, there is no
|
||||||
spa_dll_set_bw(&impl->dll, SPA_DLL_BW_MAX, port->info.rate.denom, port->info.rate.denom);
|
* need to adjust the timestamps.
|
||||||
impl->clock->next_nsec = fmd.timestamp;
|
*/
|
||||||
corr = 1.0;
|
|
||||||
} else {
|
|
||||||
double diff = ((double)impl->clock->next_nsec - (double)fmd.timestamp) / SPA_NSEC_PER_SEC;
|
|
||||||
double error = port->info.rate.denom * (diff - target);
|
|
||||||
corr = spa_dll_update(&impl->dll, SPA_CLAMPD(error, -128., 128.));
|
|
||||||
}
|
|
||||||
/* FIXME, we should follow the driver clock and target_ values.
|
|
||||||
* for now we ignore and use our own. */
|
|
||||||
impl->clock->target_rate = port->rate;
|
impl->clock->target_rate = port->rate;
|
||||||
impl->clock->target_duration = 1;
|
impl->clock->target_duration = 1;
|
||||||
|
|
||||||
|
|
@ -1082,8 +1074,8 @@ void handle_completed_request(struct impl *impl, libcamera::Request *request)
|
||||||
impl->clock->position = fmd.sequence;
|
impl->clock->position = fmd.sequence;
|
||||||
impl->clock->duration = 1;
|
impl->clock->duration = 1;
|
||||||
impl->clock->delay = 0;
|
impl->clock->delay = 0;
|
||||||
impl->clock->rate_diff = corr;
|
impl->clock->rate_diff = 1.0;
|
||||||
impl->clock->next_nsec += (uint64_t) (target * SPA_NSEC_PER_SEC * corr);
|
impl->clock->next_nsec = fmd.timestamp+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->h) {
|
if (b->h) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue