From b2d30c6f4ca248ca04d00edf40027e4cf3a0152d Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 24 Jul 2010 18:46:25 +0200 Subject: [PATCH] Replace check for stream_chunk < 0 by state == NONE. The two conditions are equivalent but the latter form is more readable. --- vss.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/vss.c b/vss.c index 7980ccc8..5c66c981 100644 --- 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; } -- 2.39.5