diff --git a/spa/plugins/libcamera/libcamera-source.cpp b/spa/plugins/libcamera/libcamera-source.cpp index fba3d8b0b..97c3fc025 100644 --- a/spa/plugins/libcamera/libcamera-source.cpp +++ b/spa/plugins/libcamera/libcamera-source.cpp @@ -1060,20 +1060,12 @@ void handle_completed_request(struct impl *impl, libcamera::Request *request) const FrameMetadata &fmd = buffer->metadata(); if (impl->clock) { - double target = (double)port->info.rate.num / port->info.rate.denom; - double corr; - - if (impl->dll.bw == 0.0) { - spa_dll_set_bw(&impl->dll, SPA_DLL_BW_MAX, port->info.rate.denom, port->info.rate.denom); - 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. */ + /* + * The clock has SPA_IO_CLOCK_FLAG_NO_RATE set, so there is no + * need to update any rate specific fields. + * As libcamera uses CLOCK_MONOTONIC internally, there is no + * need to adjust the timestamps. + */ impl->clock->target_rate = port->rate; 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->duration = 1; impl->clock->delay = 0; - impl->clock->rate_diff = corr; - impl->clock->next_nsec += (uint64_t) (target * SPA_NSEC_PER_SEC * corr); + impl->clock->rate_diff = 1.0; + impl->clock->next_nsec = fmd.timestamp+1; } if (b->h) {