kpb: record history buffer update while draining

This patch enables draining task to know how
much data was buffered since draining task
has been started.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This commit is contained in:
Marcin Rajwa 2019-07-25 23:56:19 +02:00 committed by Janusz Jankowski
parent 39f24fbc2a
commit 0683635252
2 changed files with 5 additions and 0 deletions

View File

@ -626,6 +626,7 @@ static int kpb_buffer_data(struct comp_dev *dev, struct comp_buffer *source,
size_t timeout = platform_timer_get(platform_timer) +
clock_ms_to_ticks(PLATFORM_DEFAULT_CLOCK, 1);
enum kpb_state state_preserved = kpb->state;
struct dd *draining_data = &kpb->draining_task_data;
tracev_kpb("kpb_buffer_data()");
@ -634,6 +635,9 @@ static int kpb_buffer_data(struct comp_dev *dev, struct comp_buffer *source,
kpb->state = KPB_STATE_BUFFERING;
if (kpb->state == KPB_STATE_DRAINING)
draining_data->buffered_while_draining += size_to_copy;
/* Let's store audio stream data in internal history buffer */
while (size_to_copy) {
/* Reset was requested, it's time to stop buffering and finish

View File

@ -105,6 +105,7 @@ struct dd {
uint8_t is_draining_active;
enum kpb_state *state;
size_t sample_width;
size_t buffered_while_draining;
};
#ifdef UNIT_TEST