enum afs_socket_status afsss;
/** The memory mapped audio file. */
char *map;
+ /** The size of the memory mapping. */
+ size_t mapsize;
/** Used by the scheduler. */
struct task *task;
/** Pointer to the header of the mapped audio file. */
set_eof_barrier(vsst);
afh_free_header(vsst->header_buf, mmd->afd.audio_format_id);
vsst->header_buf = NULL;
- para_munmap(vsst->map, mmd->size);
+ para_munmap(vsst->map, vsst->mapsize);
vsst->map = NULL;
mmd->chunks_sent = 0;
//mmd->offset = 0;
mmd->afd.afhi.chunk_tv.tv_usec = 0;
free(mmd->afd.afhi.chunk_table);
mmd->afd.afhi.chunk_table = NULL;
- mmd->size = 0;
+ vsst->mapsize = 0;
mmd->events++;
}
ret = -ERRNO_TO_PARA_ERROR(errno);
goto err;
}
- mmd->size = statbuf.st_size;
- ret = para_mmap(mmd->size, PROT_READ, MAP_PRIVATE | MAP_POPULATE,
+ ret = para_mmap(statbuf.st_size, PROT_READ, MAP_PRIVATE | MAP_POPULATE,
passed_fd, 0, &vsst->map);
if (ret < 0)
goto err;
+ vsst->mapsize = statbuf.st_size;
close(passed_fd);
mmd->chunks_sent = 0;
mmd->current_chunk = 0;
mmd->num_played++;
mmd->new_vss_status_flags &= (~VSS_NEXT);
afh_get_header(&mmd->afd.afhi, mmd->afd.audio_format_id,
- vsst->map, mmd->size, &vsst->header_buf, &vsst->header_len);
+ vsst->map, vsst->mapsize, &vsst->header_buf, &vsst->header_len);
return;
err:
free(mmd->afd.afhi.chunk_table);
*/
if (mmd->current_chunk > 0) { /* chunk 0 might be on the heap */
buf += len;
- for (i = 0; i < 5 && buf < vsst->map + mmd->size; i++) {
+ for (i = 0; i < 5 && buf < vsst->map + vsst->mapsize; i++) {
__a_unused volatile char x = *buf;
buf += 4096;
}