Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

SWCODEC: More recording simplifications and less UI hanging in some cases using queue_send.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11781 a1c6a512-1295-4272-9138-f99709370657

+16 -37
+16 -37
firmware/pcm_record.c
··· 62 62 /** General recording state **/ 63 63 static bool is_recording; /* We are recording */ 64 64 static bool is_paused; /* We have paused */ 65 - static bool is_stopping; /* We are currently stopping */ 66 65 static unsigned long errors; /* An error has occured */ 67 66 static unsigned long warnings; /* Warning */ 68 67 ··· 237 236 PCMREC_OPTIONS, /* set recording options */ 238 237 PCMREC_START, /* start recording */ 239 238 PCMREC_STOP, /* stop the current recording */ 240 - PCMREC_FINISH_STOP, /* finish the stopping recording */ 241 239 PCMREC_PAUSE, /* pause the current recording */ 242 240 PCMREC_RESUME, /* resume the current recording */ 243 241 PCMREC_NEW_FILE, /* start new file */ ··· 1038 1036 1039 1037 if (start) 1040 1038 { 1039 + char buf[MAX_PATH]; /* place to copy in case we're full */ 1040 + 1041 1041 if (!(flags & CHUNKF_PRERECORD)) 1042 1042 { 1043 1043 /* get stats on data added to start - sort of a prerecord operation */ ··· 1070 1070 if (fnq_add_fn == pcmrec_fnq_add_filename && pcmrec_fnq_is_full()) 1071 1071 { 1072 1072 logf("fnq full"); 1073 + /* make a local copy of filename and let sender go as this 1074 + flush will hang the screen for a bit otherwise */ 1075 + strncpy(buf, filename, MAX_PATH); 1076 + filename = buf; 1077 + queue_reply(&pcmrec_queue, NULL); 1073 1078 pcmrec_flush(-1); 1074 1079 } 1075 1080 ··· 1115 1120 1116 1121 is_recording = false; 1117 1122 is_paused = false; 1118 - is_stopping = false; 1119 1123 1120 1124 buffer = audio_get_recording_buffer(&rec_buffer_size); 1121 1125 ··· 1183 1187 /* apply pcm settings to hardware */ 1184 1188 pcm_apply_settings(true); 1185 1189 1190 + queue_reply(&pcmrec_queue, NULL); /* Release sender */ 1191 + 1186 1192 if (audio_load_encoder(enc_config.afmt)) 1187 1193 { 1188 1194 /* start DMA transfer */ ··· 1195 1201 logf("set rec opt: enc load failed"); 1196 1202 errors |= PCMREC_E_LOAD_ENCODER; 1197 1203 } 1198 - 1199 1204 } /* pcmrec_set_recording_options */ 1200 1205 1201 1206 /* PCMREC_START/PCMREC_NEW_FILE - start recording (not gapless) ··· 1306 1311 if (!is_recording) 1307 1312 { 1308 1313 logf("not recording"); 1309 - goto not_recording_or_stopping; 1310 - } 1311 - else if (is_stopping) 1312 - { 1313 - logf("already stopping"); 1314 - goto not_recording_or_stopping; 1314 + goto not_recording; 1315 1315 } 1316 1316 1317 - is_stopping = true; 1318 - dma_lock = true; /* lock dma write position */ 1319 - queue_post(&pcmrec_queue, PCMREC_FINISH_STOP, NULL); 1317 + dma_lock = true; /* lock dma write position */ 1318 + queue_reply(&pcmrec_queue, NULL); 1320 1319 1321 - not_recording_or_stopping: 1322 - logf("pcmrec_stop done"); 1323 - } /* pcmrec_stop */ 1324 - 1325 - /* PCMREC_FINISH_STOP */ 1326 - static void pcmrec_finish_stop(void) 1327 - { 1328 - logf("pcmrec_finish_stop"); 1329 - 1330 - if (!is_stopping) 1331 - { 1332 - logf("not stopping"); 1333 - goto not_stopping; 1334 - } 1335 - 1336 1320 /* flush all available data first to avoid overflow while waiting 1337 1321 for encoding to finish */ 1338 1322 pcmrec_flush(-1); ··· 1367 1351 1368 1352 is_recording = false; 1369 1353 is_paused = false; 1370 - is_stopping = false; 1371 1354 dma_lock = pre_record_ticks == 0; 1372 1355 1373 - not_stopping: 1374 - logf("pcmrec_finish_stop done"); 1375 - } /* pcmrec_finish_stop */ 1356 + not_recording: 1357 + logf("pcmrec_stop done"); 1358 + } /* pcmrec_stop */ 1376 1359 1377 1360 /* PCMREC_PAUSE */ 1378 1361 static void pcmrec_pause(void) ··· 1430 1413 1431 1414 while(1) 1432 1415 { 1433 - if (is_recording && !is_stopping) 1416 + if (is_recording) 1434 1417 { 1435 1418 /* Poll periodically to flush data */ 1436 1419 queue_wait_w_tmo(&pcmrec_queue, &ev, HZ/5); ··· 1469 1452 1470 1453 case PCMREC_STOP: 1471 1454 pcmrec_stop(); 1472 - break; 1473 - 1474 - case PCMREC_FINISH_STOP: 1475 - pcmrec_finish_stop(); 1476 1455 break; 1477 1456 1478 1457 case PCMREC_PAUSE: