]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Merge branch 'maint'
authorAndre Noll <maan@systemlinux.org>
Sun, 7 Mar 2010 15:34:40 +0000 (16:34 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 7 Mar 2010 15:34:40 +0000 (16:34 +0100)
1  2 
vss.c

diff --combined vss.c
index 1a038f060bd1f0e2ecfd842e9f08fd7f704f70e2,b63a1fcb84616cfa050cd6843050f2440da5db2b..d0126453122f7df011240090f6f3885880eb2ede
--- 1/vss.c
--- 2/vss.c
+++ b/vss.c
@@@ -11,9 -11,7 +11,9 @@@
   * senders.
   */
  
 +#include <regex.h>
  #include <dirent.h>
 +#include <osl.h>
  
  #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;