}
/**
- * Open the audio file with highest score.
+ * Pass the fd of the next audio file to the server process.
*
* This stores all information for streaming the "best" audio file in a shared
* memory area. The id of that area and an open file descriptor for the next
*/
static int open_next_audio_file(void)
{
- struct osl_row *aft_row;
struct audio_file_data afd;
int ret, shmid;
char buf[8];
- long score;
-again:
- PARA_NOTICE_LOG("getting next audio file\n");
- ret = score_get_best(&aft_row, &score);
+
+ ret = open_and_update_audio_file(&afd);
if (ret < 0) {
PARA_ERROR_LOG("%s\n", para_strerror(-ret));
goto no_admissible_files;
}
- ret = open_and_update_audio_file(aft_row, score, &afd);
- if (ret < 0) {
- ret = score_delete(aft_row);
- if (ret < 0) {
- PARA_ERROR_LOG("%s\n", para_strerror(-ret));
- goto no_admissible_files;
- }
- goto again;
- }
shmid = ret;
if (!write_ok(server_socket)) {
ret = -E_AFS_SOCKET;
{
uint32_t table_mask = *(uint32_t *)query->data;
int i, ret;
- struct para_buffer pb = {.buf = NULL};
+ struct para_buffer pb = {
+ .max_size = shm_get_shmmax(),
+ .private_data = &(struct afs_max_size_handler_data) {
+ .fd = fd,
+ .band = SBD_OUTPUT
+ }
+ };
close_afs_tables();
for (i = 0; i < NUM_AFS_TABLES; i++) {