From: Andre Noll Date: Sun, 7 Mar 2010 15:34:40 +0000 (+0100) Subject: Merge branch 'maint' X-Git-Tag: v0.4.2~26 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=eecc102ad0abeb0335fe994bb72031a15b9090d7;hp=-c Merge branch 'maint' --- eecc102ad0abeb0335fe994bb72031a15b9090d7 diff --combined vss.c index 1a038f06,b63a1fcb..d0126453 --- a/vss.c +++ b/vss.c @@@ -11,9 -11,7 +11,9 @@@ * senders. */ +#include #include +#include #include "para.h" #include "error.h" @@@ -290,19 -288,20 +290,20 @@@ static int setup_next_fec_group(struct g->num = 0; g->start = *now; } else { + struct timeval tmp; + if (g->first_chunk + g->num_chunks >= mmd->afd.afhi.chunks_total) + return 0; /* * Start and duration of this group depend only on the previous * group. Compute the new group start as g->start += g->duration. */ - struct timeval tmp = g->start; + tmp = g->start; tv_add(&tmp, &g->duration, &g->start); k = fc->fcp->data_slices_per_group + fc->num_extra_slices; set_group_timing(fc, g); g->first_chunk += g->num_chunks; g->num++; } - if (g->first_chunk >= mmd->afd.afhi.chunks_total) - return 0; if (need_audio_header(fc, vsst)) { ret = num_slices(vsst->header_len, fc, &g->num_header_slices); if (ret < 0) @@@ -500,7 -499,8 +501,7 @@@ static void compute_slice_timeout(struc 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,12 -636,16 +637,12 @@@ static void vss_eof(struct vss_task *vs 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++; @@@ -677,13 -681,6 +678,13 @@@ static int need_to_request_new_audio_fi 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. * @@@ -728,7 -725,6 +729,7 @@@ static void vss_pre_select(struct sche 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"); @@@ -798,6 -794,7 +799,6 @@@ static void recv_afs_result(struct vss_ 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; @@@ -883,9 -880,11 +884,9 @@@ static void vss_send(struct vss_task *v 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 @@@ -972,6 -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;