comparison src/cs/services/audio/audio_sr_update.c @ 0:4e78acac3d88

src/{condat,cs,gpf,nucleus}: import from Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:23:26 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4e78acac3d88
1 /****************************************************************************/
2 /* */
3 /* File Name: audio_sr_update.c */
4 /* */
5 /* Purpose: This file contains all the functions used to manage the */
6 /* update of a word for the speech recognition module. */
7 /* */
8 /* Version 0.1 */
9 /* */
10 /* Date Modification */
11 /* ------------------------------------ */
12 /* 21 Nov. 2001 Create */
13 /* */
14 /* Author */
15 /* Francois Mazard - Stephanie Gerthoux */
16 /* */
17 /* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
18 /****************************************************************************/
19
20 #include "rv/rv_defined_swe.h"
21 #ifdef RVM_AUDIO_MAIN_SWE
22 #ifndef _WINDOWS
23 #include "config/swconfig.cfg"
24 #include "config/sys.cfg"
25 #include "config/chipset.cfg"
26 #endif
27
28 /* include the usefull L1 header */
29 #include "l1_confg.h"
30
31 #if (SPEECH_RECO)
32 #include "rv/rv_general.h"
33 #include "rvm/rvm_gen.h"
34 #include "audio/audio_features_i.h"
35 #include "audio/audio_ffs_i.h"
36 #include "audio/audio_api.h"
37 #include "audio/audio_structs_i.h"
38 #include "audio/audio_var_i.h"
39 #include "audio/audio_messages_i.h"
40 #include "rvf/rvf_target.h"
41 #include "audio/audio_const_i.h"
42 #include "audio/audio_error_hdlr_i.h"
43 #include "audio/audio_macro_i.h"
44
45 /* include the usefull L1 header */
46 #define BOOL_FLAG
47 #define CHAR_FLAG
48 #include "l1_types.h"
49 #include "l1audio_cust.h"
50 #include "l1audio_msgty.h"
51 #include "l1audio_signa.h"
52
53 /********************************************************************************/
54 /* */
55 /* Function Name: audio_sr_update_convert_parameter */
56 /* */
57 /* Purpose: Convert the speech reco update parameters from the entity to */
58 /* the l1 parameters */
59 /* */
60 /* Input Parameters: */
61 /* entity speech reco update message */
62 /* */
63 /* Output Parameters: */
64 /* layer 1 speech update message */
65 /* */
66 /* Note: */
67 /* None. */
68 /* */
69 /* Revision History: */
70 /* None. */
71 /* */
72 /********************************************************************************/
73 void audio_sr_update_convert_parameter( T_AUDIO_SR_UPDATE_START *entity_parameter,
74 void *l1_parameter)
75 {
76 T_RVF_MB_STATUS mb_status;
77
78 if (p_audio_gbl_var->speech_reco.sr_update.vocabulary_size <=
79 AUDIO_SR_UPDATE_UPDATECHECK_THRESHOLD)
80 {
81 ((T_MMI_SR_UPDATE_REQ*)l1_parameter)->database_id = 0;
82 ((T_MMI_SR_UPDATE_REQ*)l1_parameter)->word_index =
83 p_audio_gbl_var->speech_reco.sr_update.model_index;
84
85 /* Check if the speech sample must be saved */
86 if (entity_parameter->record_speech != AUDIO_SR_NO_RECORD_SPEECH)
87 {
88 ((T_MMI_SR_UPDATE_REQ*)l1_parameter)->speech = TRUE;
89 /* Allocate the RAM buffer for the speech samples */
90 mb_status = rvf_get_buf (p_audio_gbl_var->mb_audio_ffs,
91 (SC_SR_MMI_2_L1_SPEECH_SIZE * sizeof(UINT16)),
92 (T_RVF_BUFFER **) (&(p_audio_gbl_var->speech_reco.sr_update.p_speech_address)));
93
94 ((T_MMI_SR_UPDATE_REQ*)l1_parameter)->speech_address =
95 (UWORD16 *)p_audio_gbl_var->speech_reco.sr_update.p_speech_address;
96
97 AUDIO_SEND_TRACE_PARAM(" AUDIO SR UPDATE: speech buffer allocate for update",
98 ((T_MMI_SR_UPDATE_REQ*)l1_parameter)->speech_address,
99 RV_TRACE_LEVEL_DEBUG_LOW);
100
101 /* If insufficient resource, then report a memory error and abort. */
102 if (mb_status == RVF_RED)
103 {
104 audio_sr_error_trace(AUDIO_ENTITY_NO_MEMORY);
105 }
106 }
107 else
108 {
109 ((T_MMI_SR_UPDATE_REQ*)l1_parameter)->speech = FALSE;
110 }
111 }
112 else
113 {
114 ((T_MMI_SR_UPDATE_CHECK_REQ*)l1_parameter)->database_id = 0;
115 ((T_MMI_SR_UPDATE_CHECK_REQ*)l1_parameter)->word_index =
116 p_audio_gbl_var->speech_reco.sr_update.model_index;
117
118 /* Check if the speech sample must be saved */
119 if (entity_parameter->record_speech != AUDIO_SR_NO_RECORD_SPEECH)
120 {
121 ((T_MMI_SR_UPDATE_CHECK_REQ*)l1_parameter)->speech = TRUE;
122 /* Allocate the RAM buffer for the speech samples */
123 mb_status = rvf_get_buf (p_audio_gbl_var->mb_audio_ffs,
124 (SC_SR_MMI_2_L1_SPEECH_SIZE * sizeof(UINT16)),
125 (T_RVF_BUFFER **) (&(p_audio_gbl_var->speech_reco.sr_update.p_speech_address)));
126
127 ((T_MMI_SR_UPDATE_CHECK_REQ*)l1_parameter)->speech_address =
128 (UWORD16 *)p_audio_gbl_var->speech_reco.sr_update.p_speech_address;
129
130 AUDIO_SEND_TRACE_PARAM(" AUDIO SR UPDATE: speech buffer allocate for update check",
131 ((T_MMI_SR_UPDATE_CHECK_REQ*)l1_parameter)->speech_address,
132 RV_TRACE_LEVEL_DEBUG_LOW);
133
134 /* If insufficient resource, then report a memory error and abort. */
135 if (mb_status == RVF_RED)
136 {
137 audio_sr_error_trace(AUDIO_ENTITY_NO_MEMORY);
138 }
139 }
140 else
141 {
142 ((T_MMI_SR_UPDATE_CHECK_REQ*)l1_parameter)->speech = FALSE;
143 }
144 /* Allocate the RAM buffer for the model */
145 mb_status = rvf_get_buf (p_audio_gbl_var->mb_audio_ffs,
146 (SC_SR_MMI_DB_MODEL_SIZE * sizeof(UINT16)),
147 (T_RVF_BUFFER **) (&(p_audio_gbl_var->speech_reco.sr_update.p_model_address)));
148
149 ((T_MMI_SR_UPDATE_CHECK_REQ*)l1_parameter)->model_address =
150 (UWORD16 *)p_audio_gbl_var->speech_reco.sr_update.p_model_address;
151
152 AUDIO_SEND_TRACE_PARAM(" AUDIO SR UPDATE: model buffer allocate for update check",
153 ((T_MMI_SR_UPDATE_CHECK_REQ*)l1_parameter)->model_address,
154 RV_TRACE_LEVEL_DEBUG_LOW);
155
156 /* If insufficient resource, then report a memory error and abort. */
157 if (mb_status == RVF_RED)
158 {
159 audio_sr_error_trace(AUDIO_ENTITY_NO_MEMORY);
160 }
161
162 /* put the vocabulary size in the L1 message */
163 ((T_MMI_SR_UPDATE_CHECK_REQ*)l1_parameter)->vocabulary_size =
164 p_audio_gbl_var->speech_reco.sr_update.vocabulary_size;
165 } /* model threshold */
166 }
167
168 /********************************************************************************/
169 /* */
170 /* Function Name: audio_sr_update_send_status */
171 /* */
172 /* Purpose: This function sends the speech reco update status to the */
173 /* entity. */
174 /* */
175 /* Input Parameters: */
176 /* status, */
177 /* return path */
178 /* */
179 /* Output Parameters: */
180 /* None. */
181 /* */
182 /* Note: */
183 /* None. */
184 /* */
185 /* Revision History: */
186 /* None. */
187 /* */
188 /********************************************************************************/
189 void audio_sr_update_send_status (T_AUDIO_RET status, T_RV_RETURN return_path)
190 {
191 void *p_send_message = NULL;
192 T_RVF_MB_STATUS mb_status = RVF_RED;
193
194 while (mb_status == RVF_RED)
195 {
196 /* allocate the message buffer */
197 mb_status = rvf_get_buf (p_audio_gbl_var->mb_external,
198 sizeof (T_AUDIO_SR_UPDATE_STATUS),
199 (T_RVF_BUFFER **) (&p_send_message));
200
201 /* If insufficient resources, then report a memory error and abort. */
202 /* and wait until more ressource is given */
203 if (mb_status == RVF_RED)
204 {
205 audio_sr_error_trace(AUDIO_ENTITY_NO_MEMORY);
206 rvf_delay(RVF_MS_TO_TICKS(1000));
207 }
208 }
209
210 /*fill the header of the message */
211 ((T_AUDIO_SR_UPDATE_STATUS *)(p_send_message))->os_hdr.msg_id = AUDIO_SR_UPDATE_STATUS_MSG;
212
213 if (status > 0)
214 {
215 status = (INT8)((-2) - status);
216 }
217
218 /* fill the status parameters */
219 ((T_AUDIO_SR_UPDATE_STATUS *)(p_send_message))->status = status;
220
221 if (return_path.callback_func == NULL)
222 {
223 /* send the message to the entity */
224 rvf_send_msg (return_path.addr_id,
225 p_send_message);
226 }
227 else
228 {
229 /* call the callback function */
230 (*return_path.callback_func)((void *)(p_send_message));
231 rvf_free_buf((T_RVF_BUFFER *)p_send_message);
232 }
233 }
234
235 /********************************************************************************/
236 /* */
237 /* Function Name: audio_sr_update_manager */
238 /* */
239 /* Purpose: This function is called to manage a speech reco update */
240 /* process. */
241 /* */
242 /* Input Parameters: */
243 /* Audio Speech reco update parameters, */
244 /* */
245 /* Output Parameters: */
246 /* None. */
247 /* */
248 /* Note: */
249 /* None. */
250 /* */
251 /* Revision History: */
252 /* None. */
253 /* */
254 /********************************************************************************/
255 void audio_sr_update_manager (T_RV_HDR *p_message)
256 {
257 /* Declare local variables. */
258 void *p_send_message;
259 T_RV_RET status;
260
261 /**************** audio_sr_update_manager function begins *********************/
262 switch(p_audio_gbl_var->speech_reco.sr_update.state)
263 {
264 case AUDIO_SR_UPDATE_IDLE:
265 {
266 switch(p_message->msg_id)
267 {
268 case AUDIO_SR_UPDATE_START_REQ:
269 {
270 /* save the task id of the entity */
271 p_audio_gbl_var->speech_reco.sr_update.task_id =
272 ((T_AUDIO_SR_UPDATE_START*)(p_message))->os_hdr.src_addr_id;
273
274 /* save the return path */
275 p_audio_gbl_var->speech_reco.sr_update.return_path.callback_func =
276 ((T_AUDIO_SR_UPDATE_START*)(p_message))->return_path.callback_func;
277 p_audio_gbl_var->speech_reco.sr_update.return_path.addr_id =
278 ((T_AUDIO_SR_UPDATE_START*)(p_message))->return_path.addr_id;
279
280 /* save the message parameters */
281 p_audio_gbl_var->speech_reco.sr_update.record_speech =
282 ((T_AUDIO_SR_UPDATE_START*)(p_message))->record_speech;
283 p_audio_gbl_var->speech_reco.sr_update.vocabulary_size =
284 ((T_AUDIO_SR_UPDATE_START*)(p_message))->vocabulary_size;
285 p_audio_gbl_var->speech_reco.sr_update.model_index =
286 ((T_AUDIO_SR_UPDATE_START*)(p_message))->model_index;
287 p_audio_gbl_var->speech_reco.sr_update.p_database =
288 ((T_AUDIO_SR_UPDATE_START*)(p_message))->p_database;
289
290 /* allocate the buffer for the message to the L1 */
291 if (p_audio_gbl_var->speech_reco.sr_update.vocabulary_size >
292 AUDIO_SR_UPDATE_UPDATECHECK_THRESHOLD)
293 {
294 p_send_message = audio_allocate_l1_message(sizeof(T_MMI_SR_UPDATE_CHECK_REQ));
295 }
296 else
297 {
298 p_send_message = audio_allocate_l1_message(sizeof(T_MMI_SR_UPDATE_REQ));
299 }
300 if ( p_send_message != NULL)
301 {
302 /* Convert the entity parameters to the audio L1 parameters */
303 audio_sr_update_convert_parameter((T_AUDIO_SR_UPDATE_START *)p_message,
304 p_send_message);
305
306 /* send the start command to the audio L1 */
307 if (p_audio_gbl_var->speech_reco.sr_update.vocabulary_size >
308 AUDIO_SR_UPDATE_UPDATECHECK_THRESHOLD)
309 {
310 audio_send_l1_message(MMI_SR_UPDATE_CHECK_START_REQ, p_send_message);
311 }
312 else
313 {
314 audio_send_l1_message(MMI_SR_UPDATE_START_REQ, p_send_message);
315 }
316 }
317
318 /* change to the state AUDIO_SR_UPDATE_WAIT_START_CONFIRMATION */
319 p_audio_gbl_var->speech_reco.sr_update.state = AUDIO_SR_UPDATE_WAIT_START_CON;
320 break;
321 }
322
323 case AUDIO_SR_UPDATE_STOP_REQ:
324 {
325 /* event error - send an error message*/
326 audio_sr_update_send_status (AUDIO_ERROR, ((T_AUDIO_SR_UPDATE_STOP *)(p_message))->return_path);
327
328 audio_sr_error_trace(AUDIO_ERROR_STOP_EVENT);
329 break;
330 }
331 }
332 break;
333 } /* case AUDIO_SR_UPDATE_IDLE */
334
335 case AUDIO_SR_UPDATE_WAIT_START_CON:
336 {
337 switch(p_message->msg_id)
338 {
339 case MMI_SR_UPDATE_START_CON:
340 case MMI_SR_UPDATE_CHECK_START_CON:
341 {
342 /* change to the state AUDIO_SR_UPDATE_WAIT_STOP_COMMAND */
343 p_audio_gbl_var->speech_reco.sr_update.state = AUDIO_SR_UPDATE_WAIT_STOP_COMMAND;
344 break;
345 }
346 case AUDIO_SR_UPDATE_STOP_REQ:
347 /*.Before stopping this task, control that */
348 /* stop task id caller = SR update task id */
349 {
350 if ( p_audio_gbl_var->speech_reco.sr_update.task_id ==
351 ((T_AUDIO_SR_UPDATE_STOP*)(p_message))->os_hdr.src_addr_id)
352 {
353 /* save the return path */
354 p_audio_gbl_var->speech_reco.sr_update.return_path.callback_func =
355 ((T_AUDIO_SR_UPDATE_STOP*)(p_message))->return_path.callback_func;
356 p_audio_gbl_var->speech_reco.sr_update.return_path.addr_id =
357 ((T_AUDIO_SR_UPDATE_STOP*)(p_message))->return_path.addr_id;
358
359 /* change to the state AUDIO_SR_UPDATE_WAIT_STOP_CONFIRMATION */
360 p_audio_gbl_var->speech_reco.sr_update.state = AUDIO_SR_UPDATE_WAIT_START_CON_TO_STOP;
361 }
362 else
363 {
364 /* A stop request from an other task is sent during a start connection */
365 /* event error - send an error message */
366 audio_sr_update_send_status (AUDIO_ERROR, ((T_AUDIO_SR_UPDATE_STOP *)(p_message))->return_path);
367
368 audio_sr_error_trace(AUDIO_ERROR_STOP_EVENT);
369 }
370 break;
371 }
372 case AUDIO_SR_UPDATE_START_REQ:
373 {
374 /* Free the database buffer */
375 rvf_free_buf( (T_RVF_BUFFER *)(((T_AUDIO_SR_UPDATE_START *)(p_message))->p_database) );
376
377 /* event error - send an error message*/
378 audio_sr_update_send_status (AUDIO_ERROR, ((T_AUDIO_SR_UPDATE_START *)(p_message))->return_path);
379
380 audio_sr_error_trace(AUDIO_ERROR_START_EVENT);
381 break;
382 }
383 }
384 break;
385 } /* case AUDIO_SR_UPDATE_WAIT_START_CON */
386
387 case AUDIO_SR_UPDATE_WAIT_START_CON_TO_STOP:
388 {
389 switch(p_message->msg_id)
390 {
391 case MMI_SR_UPDATE_START_CON:
392 case MMI_SR_UPDATE_CHECK_START_CON:
393 {
394 /* send the stop command to the audio L1 */
395 /* allocate the buffer for the message to the L1 */
396 p_send_message = audio_allocate_l1_message(0);
397 if ( p_send_message != NULL)
398 {
399 /* send the stop command to the audio L1 */
400 if (p_audio_gbl_var->speech_reco.sr_update.vocabulary_size >
401 AUDIO_SR_UPDATE_UPDATECHECK_THRESHOLD)
402 {
403 audio_send_l1_message(MMI_SR_UPDATE_CHECK_STOP_REQ, p_send_message);
404 }
405 else
406 {
407 audio_send_l1_message(MMI_SR_UPDATE_STOP_REQ, p_send_message);
408 }
409
410 }
411
412 /* change to the state AUDIO_SR_UPDATE_WAIT_STOP_CON */
413 p_audio_gbl_var->speech_reco.sr_update.state = AUDIO_SR_UPDATE_WAIT_STOP_CON;
414 break;
415 }
416 case AUDIO_SR_UPDATE_START_REQ:
417 {
418 /* Free the database buffer */
419 rvf_free_buf( (T_RVF_BUFFER *)(((T_AUDIO_SR_UPDATE_START *)(p_message))->p_database) );
420
421 /* event error - send an error message*/
422 audio_sr_update_send_status (AUDIO_ERROR, ((T_AUDIO_SR_UPDATE_START *)(p_message))->return_path);
423
424 audio_sr_error_trace(AUDIO_ERROR_START_EVENT);
425 break;
426 }
427 case AUDIO_SR_UPDATE_STOP_REQ:
428 {
429 /* event error - send an error message*/
430 audio_sr_update_send_status (AUDIO_ERROR, ((T_AUDIO_SR_UPDATE_STOP *)(p_message))->return_path);
431
432 audio_sr_error_trace(AUDIO_ERROR_STOP_EVENT);
433 break;
434 }
435 }
436 break;
437 }
438
439 case AUDIO_SR_UPDATE_WAIT_STOP_COMMAND:
440 {
441 switch(p_message->msg_id)
442 {
443 case MMI_SR_UPDATE_STOP_CON:
444 case MMI_SR_UPDATE_CHECK_STOP_CON:
445 {
446 /* Deallocate the speech buffer if it was used */
447 if (p_audio_gbl_var->speech_reco.sr_update.record_speech != AUDIO_SR_NO_RECORD_SPEECH)
448 {
449 status = rvf_free_buf(p_audio_gbl_var->speech_reco.sr_update.p_speech_address);
450 if (status != RVF_GREEN)
451 {
452 AUDIO_SEND_TRACE("AUDIO SR UPDATE: A wrong speech buffer is deallocated",
453 RV_TRACE_LEVEL_ERROR);
454 }
455 }
456
457 if (p_audio_gbl_var->speech_reco.sr_update.vocabulary_size >
458 AUDIO_SR_UPDATE_UPDATECHECK_THRESHOLD)
459 {
460 /* deallocate the model buffer if it was in update check */
461 status = rvf_free_buf(p_audio_gbl_var->speech_reco.sr_update.p_model_address);
462 if (status != RVF_GREEN)
463 {
464 AUDIO_SEND_TRACE("AUDIO SR UPDATE: A wrong model buffer is deallocated",
465 RV_TRACE_LEVEL_ERROR);
466 }
467
468 /* Free the database buffer */
469 rvf_free_buf( p_audio_gbl_var->speech_reco.sr_update.p_database );
470
471 audio_sr_update_send_status (((T_MMI_SR_UPDATE_CHECK_STOP_CON *)p_message)->error_id,
472 p_audio_gbl_var->speech_reco.sr_update.return_path);
473 }
474 else
475 {
476 /* Free the database buffer */
477 rvf_free_buf( p_audio_gbl_var->speech_reco.sr_update.p_database );
478
479 audio_sr_update_send_status (((T_MMI_SR_UPDATE_STOP_CON *)p_message)->error_id,
480 p_audio_gbl_var->speech_reco.sr_update.return_path);
481 }
482
483 /* change to the state AUDIO_SR_UPDATE_IDLE */
484 p_audio_gbl_var->speech_reco.sr_update.state = AUDIO_SR_UPDATE_IDLE;
485 break;
486 }
487
488 case AUDIO_SR_UPDATE_STOP_REQ:
489 {
490 /*.Before stopping this task, control that */
491 /* stop task id caller = SR update task id */
492 if ( p_audio_gbl_var->speech_reco.sr_update.task_id ==
493 ((T_AUDIO_SR_UPDATE_STOP*)(p_message))->os_hdr.src_addr_id)
494 {
495 /* save the return path */
496 p_audio_gbl_var->speech_reco.sr_update.return_path.callback_func =
497 ((T_AUDIO_SR_UPDATE_STOP*)(p_message))->return_path.callback_func;
498 p_audio_gbl_var->speech_reco.sr_update.return_path.addr_id =
499 ((T_AUDIO_SR_UPDATE_STOP*)(p_message))->return_path.addr_id;
500
501 /* send the stop command to the audio L1 */
502 /* allocate the buffer for the message to the L1 */
503 p_send_message = audio_allocate_l1_message(0);
504 if ( p_send_message != NULL)
505 {
506 /* allocate the buffer for the message to the L1 */
507 if (p_audio_gbl_var->speech_reco.sr_update.vocabulary_size >
508 AUDIO_SR_UPDATE_UPDATECHECK_THRESHOLD)
509 {
510 /* send the start command to the audio L1 */
511 audio_send_l1_message(MMI_SR_UPDATE_CHECK_STOP_REQ, p_send_message);
512 }
513 else
514 {
515 /* send the start command to the audio L1 */
516 audio_send_l1_message(MMI_SR_UPDATE_STOP_REQ, p_send_message);
517 }
518 }
519
520 /* change to the state AUDIO_SR_UPDATE_WAIT_STOP_CONFIRMATION */
521 p_audio_gbl_var->speech_reco.sr_update.state = AUDIO_SR_UPDATE_WAIT_STOP_CON;
522 }
523 else
524 {
525 /* A stop request from an other task is sent during a start connection */
526 /* event error - send an error message */
527 audio_sr_update_send_status (AUDIO_ERROR, ((T_AUDIO_SR_UPDATE_STOP *)(p_message))->return_path);
528
529 audio_sr_error_trace(AUDIO_ERROR_STOP_EVENT);
530 }
531 break;
532 }
533
534 case AUDIO_SR_UPDATE_START_REQ:
535 {
536 /* Free the database buffer */
537 rvf_free_buf( (T_RVF_BUFFER *)(((T_AUDIO_SR_UPDATE_START *)(p_message))->p_database) );
538
539 /* event error - send an error message*/
540 audio_sr_update_send_status (AUDIO_ERROR,
541 ((T_AUDIO_SR_UPDATE_START *)(p_message))->return_path);
542
543 audio_sr_error_trace(AUDIO_ERROR_START_EVENT);
544 break;
545 }
546 }
547 break;
548 } /* case AUDIO_SR_UPDATE_WAIT_STOP_COMMAND */
549
550 case AUDIO_SR_UPDATE_WAIT_STOP_CON:
551 {
552 switch(p_message->msg_id)
553 {
554 case MMI_SR_UPDATE_STOP_CON:
555 case MMI_SR_UPDATE_CHECK_STOP_CON:
556 {
557 /* Deallocate the speech buffer if it was used */
558 if (p_audio_gbl_var->speech_reco.sr_update.record_speech != AUDIO_SR_NO_RECORD_SPEECH)
559 {
560 status = rvf_free_buf(p_audio_gbl_var->speech_reco.sr_update.p_speech_address);
561 if (status != RVF_GREEN)
562 {
563 AUDIO_SEND_TRACE("AUDIO SR UPDATE: A wrong speech buffer is deallocated",
564 RV_TRACE_LEVEL_ERROR);
565 }
566 }
567 if (p_audio_gbl_var->speech_reco.sr_update.vocabulary_size >
568 AUDIO_SR_UPDATE_UPDATECHECK_THRESHOLD)
569 {
570 /* deallocate the model buffer if it was in update check */
571 status = rvf_free_buf(p_audio_gbl_var->speech_reco.sr_update.p_model_address);
572 if (status != RVF_GREEN)
573 {
574 AUDIO_SEND_TRACE("AUDIO SR UPDATE: A wrong model buffer is deallocated",
575 RV_TRACE_LEVEL_ERROR);
576 }
577
578 /* Free the database buffer */
579 rvf_free_buf( p_audio_gbl_var->speech_reco.sr_update.p_database );
580
581 audio_sr_update_send_status (((T_MMI_SR_UPDATE_CHECK_STOP_CON *)p_message)->error_id,
582 p_audio_gbl_var->speech_reco.sr_update.return_path);
583 }
584 else
585 {
586 /* Free the database buffer */
587 rvf_free_buf( p_audio_gbl_var->speech_reco.sr_update.p_database );
588
589 audio_sr_update_send_status (((T_MMI_SR_UPDATE_STOP_CON *)p_message)->error_id,
590 p_audio_gbl_var->speech_reco.sr_update.return_path);
591 }
592
593 /* change to the state AUDIO_SR_UPDATE_IDLE */
594 p_audio_gbl_var->speech_reco.sr_update.state = AUDIO_SR_UPDATE_IDLE;
595 break;
596 }
597 case AUDIO_SR_UPDATE_STOP_REQ:
598 {
599 /* event error - send an error message*/
600 audio_sr_update_send_status (AUDIO_ERROR, ((T_AUDIO_SR_UPDATE_STOP *)(p_message))->return_path);
601
602 audio_sr_error_trace(AUDIO_ERROR_STOP_EVENT);
603 break;
604 }
605 case AUDIO_SR_UPDATE_START_REQ:
606 {
607 /* Free the database buffer */
608 rvf_free_buf( (T_RVF_BUFFER *)(((T_AUDIO_SR_UPDATE_START *)(p_message))->p_database) );
609
610 /* event error - send an error message*/
611 audio_sr_update_send_status (AUDIO_ERROR, ((T_AUDIO_SR_UPDATE_START *)(p_message))->return_path);
612
613 audio_sr_error_trace(AUDIO_ERROR_START_EVENT);
614 break;
615 }
616 }
617 break;
618 } /* case AUDIO_SR_UPDATE_WAIT_STOP_CON */
619 } /* switch(p_audio_gbl_var->speech_reco.state) */
620 } /*********************** End of audio_sr_update_manager function **********************/
621 #endif /* #if (SPEECH_RECO) */
622 #endif /* #ifdef RVM_AUDIO_MAIN_SWE */