X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=vss.c;h=d0126453122f7df011240090f6f3885880eb2ede;hp=b63a1fcb84616cfa050cd6843050f2440da5db2b;hb=eecc102ad0abeb0335fe994bb72031a15b9090d7;hpb=c52d8d08b47bc556cb5149bbb376d7d27a0b7cbc diff --git a/vss.c b/vss.c index b63a1fcb..d0126453 100644 --- a/vss.c +++ b/vss.c @@ -11,7 +11,9 @@ * senders. */ +#include #include +#include #include "para.h" #include "error.h" @@ -499,8 +501,7 @@ static void compute_slice_timeout(struct timeval *timeout) static void set_eof_barrier(struct vss_task *vsst) { struct fec_client *fc; - struct timeval timeout = mmd->afd.afhi.eof_tv, - *chunk_tv = vss_chunk_time(); + struct timeval timeout = {1, 0}, *chunk_tv = vss_chunk_time(); if (!chunk_tv) goto out; @@ -636,16 +637,12 @@ static void vss_eof(struct vss_task *vsst) para_munmap(vsst->map, mmd->size); vsst->map = NULL; mmd->chunks_sent = 0; - mmd->offset = 0; + //mmd->offset = 0; mmd->afd.afhi.seconds_total = 0; mmd->afd.afhi.chunk_tv.tv_sec = 0; mmd->afd.afhi.chunk_tv.tv_usec = 0; free(mmd->afd.afhi.chunk_table); mmd->afd.afhi.chunk_table = NULL; - free(mmd->afd.afhi.info_string); - mmd->afd.afhi.info_string = make_message("%s:\n%s:\n%s:\n", status_item_list[SI_AUDIO_FILE_INFO], - status_item_list[SI_TAGINFO1], status_item_list[SI_TAGINFO2]); - make_empty_status_items(mmd->afd.verbose_ls_output); mmd->mtime = 0; mmd->size = 0; mmd->events++; @@ -681,6 +678,13 @@ static int need_to_request_new_audio_file(struct vss_task *vsst) return 1; } +static void set_mmd_offset(void) +{ + struct timeval offset; + tv_scale(mmd->current_chunk, &mmd->afd.afhi.chunk_tv, &offset); + mmd->offset = tv2ms(&offset); +} + /** * Compute the timeout for the main select-loop of the scheduler. * @@ -725,6 +729,7 @@ static void vss_pre_select(struct sched *s, struct task *t) mmd->chunks_sent = 0; mmd->current_chunk = mmd->repos_request; mmd->new_vss_status_flags &= ~VSS_REPOS; + set_mmd_offset(); } if (need_to_request_new_audio_file(vsst)) { PARA_DEBUG_LOG("ready and playing, but no audio file\n"); @@ -794,7 +799,6 @@ static void recv_afs_result(struct vss_task *vsst) if (passed_fd < 0) goto err; shmid = afs_data; - free(mmd->afd.afhi.info_string); ret = load_afd(shmid, &mmd->afd); if (ret < 0) goto err; @@ -880,11 +884,9 @@ static void vss_send(struct vss_task *vsst) size_t len; if (!mmd->chunks_sent) { - struct timeval tmp; mmd->stream_start = *now; - tv_scale(mmd->current_chunk, &mmd->afd.afhi.chunk_tv, &tmp); - mmd->offset = tv2ms(&tmp); mmd->events++; + set_mmd_offset(); } /* * We call the send function also in case of empty chunks as @@ -971,7 +973,6 @@ void init_vss_task(int afs_socket) free(hn); free(home); mmd->sender_cmd_data.cmd_num = -1; - make_empty_status_items(mmd->afd.verbose_ls_output); if (conf.autoplay_given) { struct timeval tmp; mmd->vss_status_flags |= VSS_PLAYING;