@@ -179,7 +179,10 @@ static int wov_arb_prepare(struct comp_dev *dev)
179179
180180 comp_info (dev , "wov_arb_prepare" );
181181
182- cd -> active_slot = WOV_ARB_NO_ACTIVE ;
182+ if (cd -> num_slots <= 1 )
183+ cd -> active_slot = 0 ;
184+ else
185+ cd -> active_slot = WOV_ARB_NO_ACTIVE ;
183186
184187 /* Subscribe to keyword-detected events from any WOV detector. */
185188 notifier_register (dev , NULL , NOTIFIER_ID_WOV_DETECT , arb_on_detect , 0 );
@@ -331,11 +334,20 @@ static int wov_arb_copy(struct comp_dev *dev)
331334
332335 sink_free = audio_stream_get_free_bytes (& sink -> stream );
333336
337+ uint32_t num_sources = 0 ;
338+ list_for_item (src_item , & dev -> bsource_list ) {
339+ num_sources ++ ;
340+ }
341+
342+ uint32_t eff_active_slot = cd -> active_slot ;
343+ if (eff_active_slot == WOV_ARB_NO_ACTIVE && num_sources <= 1 )
344+ eff_active_slot = 0 ;
345+
334346 /* First pass: find how many bytes the active source has available. */
335347 slot = 0 ;
336348 list_for_item (src_item , & dev -> bsource_list ) {
337349 source = list_item (src_item , struct comp_buffer , sink_list );
338- if (slot == cd -> active_slot ) {
350+ if (slot == eff_active_slot ) {
339351 active_avail = audio_stream_get_avail_bytes (& source -> stream );
340352 break ;
341353 }
@@ -352,7 +364,7 @@ static int wov_arb_copy(struct comp_dev *dev)
352364 list_for_item (src_item , & dev -> bsource_list ) {
353365 source = list_item (src_item , struct comp_buffer , sink_list );
354366
355- if (slot == cd -> active_slot && copy_bytes > 0 ) {
367+ if (slot == eff_active_slot && copy_bytes > 0 ) {
356368 uint32_t src_frame_bytes = audio_stream_frame_bytes (& source -> stream );
357369 uint32_t dst_frame_bytes = audio_stream_frame_bytes (& sink -> stream );
358370 uint32_t src_frames = copy_bytes / src_frame_bytes ;
0 commit comments