Replace check for stream_chunk < 0 by state == NONE.
authorAndre Noll <maan@systemlinux.org>
Sat, 24 Jul 2010 16:46:25 +0000 (18:46 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 31 Oct 2010 11:06:56 +0000 (12:06 +0100)
The two conditions are equivalent but the latter form is more readable.

vss.c

diff --git a/vss.c b/vss.c
index 7980ccc..5c66c98 100644 (file)
--- a/vss.c
+++ b/vss.c
@@ -324,7 +324,7 @@ static int setup_next_fec_group(struct fec_client *fc, struct vss_task *vsst)
        unsigned slice_bytes;
        uint32_t max_data_size;
 
-       if (fc->first_stream_chunk < 0) {
+       if (fc->state == FEC_STATE_NONE) {
                ret = initialize_fec_client(fc, vsst);
                if (ret < 0)
                        return ret;
@@ -418,7 +418,7 @@ static int setup_next_fec_group(struct fec_client *fc, struct vss_task *vsst)
 
 static int compute_next_fec_slice(struct fec_client *fc, struct vss_task *vsst)
 {
-       if (fc->first_stream_chunk < 0 || fc->current_slice_num
+       if (fc->state == FEC_STATE_NONE || fc->current_slice_num
                        == fc->fcp->slices_per_group + fc->num_extra_slices) {
                int ret = setup_next_fec_group(fc, vsst);
                if (ret == 0)
@@ -499,7 +499,7 @@ static int next_slice_is_due(struct fec_client *fc, struct timeval *diff)
        struct timeval tmp, next;
        int ret;
 
-       if (fc->first_stream_chunk < 0)
+       if (fc->state == FEC_STATE_NONE)
                return 1;
        tv_scale(fc->current_slice_num, &fc->group.slice_duration, &tmp);
        tv_add(&tmp, &fc->group.start, &next);
@@ -727,10 +727,8 @@ static void vss_pre_select(struct sched *s, struct task *t)
                for (i = 0; senders[i].name; i++)
                        if (senders[i].shutdown_clients)
                                senders[i].shutdown_clients();
-               list_for_each_entry_safe(fc, tmp, &fec_client_list, node) {
-                       fc->first_stream_chunk = -1;
+               list_for_each_entry_safe(fc, tmp, &fec_client_list, node)
                        fc->state = FEC_STATE_NONE;
-               }
                mmd->stream_start.tv_sec = 0;
                mmd->stream_start.tv_usec = 0;
        }
@@ -881,8 +879,6 @@ static void vss_send(struct vss_task *vsst)
                case FEC_STATE_DISABLED:
                        continue;
                case FEC_STATE_NONE:
-                       fc->first_stream_chunk = -1; /* need setup */
-                       /* fall through */
                case FEC_STATE_READY_TO_RUN:
                        break;
                }