Skip to content

Commit b9495b0

Browse files
serhiy-katsyuba-intellgirdwood
authored andcommitted
kpb: Simplify math
Given: x = a + b - (a - c), reduce to: x = c + b Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
1 parent 2ef976c commit b9495b0

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

src/audio/kpb.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,11 +1730,9 @@ static enum task_state kpb_draining_task(void *arg)
17301730
uint64_t draining_time_ms;
17311731
uint64_t drain_interval = draining_data->drain_interval;
17321732
uint64_t next_copy_time = 0;
1733-
uint64_t current_time;
17341733
size_t period_bytes = 0;
17351734
size_t period_bytes_limit = draining_data->pb_limit;
17361735
uint64_t period_copy_start;
1737-
size_t time_taken;
17381736
size_t *rt_stream_update = &draining_data->buffered_while_draining;
17391737
struct comp_data *kpb = comp_get_drvdata(draining_data->dev);
17401738
bool sync_mode_on = draining_data->sync_mode_on;
@@ -1836,12 +1834,8 @@ static enum task_state kpb_draining_task(void *arg)
18361834
comp_copy(comp_buffer_get_sink_component(sink));
18371835
}
18381836

1839-
if (sync_mode_on && period_bytes >= period_bytes_limit) {
1840-
current_time = sof_cycle_get_64();
1841-
time_taken = current_time - period_copy_start;
1842-
next_copy_time = current_time + drain_interval -
1843-
time_taken;
1844-
}
1837+
if (sync_mode_on && period_bytes >= period_bytes_limit)
1838+
next_copy_time = period_copy_start + drain_interval;
18451839

18461840
if (drain_req == 0) {
18471841
/* We have finished draining of requested data however

0 commit comments

Comments
 (0)