@@ -79,19 +79,21 @@ static void audio_render_task(void *pvParameter)
79
79
xEventGroupSetBits (user_event_group , AUDIO_RENDER_CLR_BIT );
80
80
}
81
81
82
+ taskYIELD ();
83
+
82
84
if (start ) {
83
85
uint32_t remain = sizeof (buff_data ) - xRingbufferGetCurFreeSize (audio_buff );
84
86
85
- if (remain >= FFT_BLOCK_SIZE ) {
87
+ if (remain >= FFT_BLOCK_SIZE * 2 ) {
86
88
delay = 0 ;
87
89
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 );
89
91
} else if (remain > 0 ) {
90
92
delay = 0 ;
91
93
92
94
data = (uint8_t * )xRingbufferReceiveUpTo (audio_buff , & size , portMAX_DELAY , remain );
93
95
} else {
94
- if (++ delay < 32 ) {
96
+ if (++ delay < 16 ) {
95
97
vTaskDelay (1 / portTICK_RATE_MS );
96
98
} else {
97
99
delay = 0 ;
@@ -104,7 +106,7 @@ static void audio_render_task(void *pvParameter)
104
106
continue ;
105
107
}
106
108
} else {
107
- if (xRingbufferGetCurFreeSize (audio_buff ) > FFT_BLOCK_SIZE ) {
109
+ if (xRingbufferGetCurFreeSize (audio_buff ) > FFT_BLOCK_SIZE * 2 ) {
108
110
vTaskDelay (1 / portTICK_RATE_MS );
109
111
} else {
110
112
start = true;
@@ -135,7 +137,7 @@ static void audio_render_task(void *pvParameter)
135
137
136
138
#ifdef CONFIG_ENABLE_VFX
137
139
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 )) {
139
141
vRingbufferReturnItem (audio_buff , (void * )data );
140
142
continue ;
141
143
}
0 commit comments