@@ -79,19 +79,21 @@ static void audio_render_task(void *pvParameter)
7979 xEventGroupSetBits (user_event_group , AUDIO_RENDER_CLR_BIT );
8080 }
8181
82+ taskYIELD ();
83+
8284 if (start ) {
8385 uint32_t remain = sizeof (buff_data ) - xRingbufferGetCurFreeSize (audio_buff );
8486
85- if (remain >= FFT_BLOCK_SIZE ) {
87+ if (remain >= FFT_BLOCK_SIZE * 2 ) {
8688 delay = 0 ;
8789
88- data = (uint8_t * )xRingbufferReceiveUpTo (audio_buff , & size , portMAX_DELAY , FFT_BLOCK_SIZE );
90+ data = (uint8_t * )xRingbufferReceiveUpTo (audio_buff , & size , portMAX_DELAY , FFT_BLOCK_SIZE * 2 );
8991 } else if (remain > 0 ) {
9092 delay = 0 ;
9193
9294 data = (uint8_t * )xRingbufferReceiveUpTo (audio_buff , & size , portMAX_DELAY , remain );
9395 } else {
94- if (++ delay < 32 ) {
96+ if (++ delay < 16 ) {
9597 vTaskDelay (1 / portTICK_RATE_MS );
9698 } else {
9799 delay = 0 ;
@@ -104,7 +106,7 @@ static void audio_render_task(void *pvParameter)
104106 continue ;
105107 }
106108 } else {
107- if (xRingbufferGetCurFreeSize (audio_buff ) > FFT_BLOCK_SIZE ) {
109+ if (xRingbufferGetCurFreeSize (audio_buff ) > FFT_BLOCK_SIZE * 2 ) {
108110 vTaskDelay (1 / portTICK_RATE_MS );
109111 } else {
110112 start = true;
@@ -135,7 +137,7 @@ static void audio_render_task(void *pvParameter)
135137
136138#ifdef CONFIG_ENABLE_VFX
137139 uxBits = xEventGroupGetBits (user_event_group );
138- if ((size != FFT_BLOCK_SIZE ) || !(uxBits & VFX_FFT_IDLE_BIT )) {
140+ if ((size < FFT_BLOCK_SIZE ) || !(uxBits & VFX_FFT_IDLE_BIT )) {
139141 vRingbufferReturnItem (audio_buff , (void * )data );
140142 continue ;
141143 }
0 commit comments