Revision 5f0575fb streamer.c

View differences:

streamer.c
43 43

  
44 44
static const char *my_iface = NULL;
45 45
static int port = 6666;
46
static int srv_port;
46
static int srv_port = 0;
47 47
static const char *srv_ip = "";
48 48
static int period = 40;
49 49
static int chunks_per_second = 25;
......
53 53
static int outbuff_size = 50;
54 54
static const char *fname = "/dev/stdin";
55 55
static const char *output_config ="";
56
static bool loop_input = false;
56 57
static const char *net_helper_config = "";
57 58
static const char *topo_config = "";
58 59
unsigned char msgTypes[] = {MSG_TYPE_CHUNK,MSG_TYPE_SIGNALLING};
59 60
bool chunk_log = false;
61
static int number_offer_thread = 1;
60 62
static int randomize_start = 0;
61 63
int start_id = -1;
62 64
int end_id = -1;
......
94 96
    "\t[-b size]: set the peer Chunk Buffer size.\n"
95 97
    "\t           This is also the chunk trading window size.\n"
96 98
    "\t[-o size]: set the Output Buffer size.\n"
97
    "\t[-c chunks]: set the number of chunks a peer can send per seconds.\n"
98
    "\t             it controls the upload capacity of peer as well.\n"
99
    "\t[-c thread]: set the number of signalling threads a peer can send per seconds.\n"
99 100
    "\t[-M peers]: neighbourhood target size.\n"
100 101
    "\t[-t config]: topology config.\n"
101 102
    "\t[-P port]: local UDP port to be used by the peer.\n"
......
119 120
    "Special Source Peer options\n"
120 121
    "\t[-m chunks]: set the number of copies the source injects in the overlay.\n"
121 122
    "\t[-f filename]: name of the video stream file to transmit.\n"
123
    "\t[-l]: loop the video stream.\n"
122 124
    "\t[-S]: set initial chunk_id (source only).\n"
123 125
    "\t[-s]: set start_id from which to start output.\n"
124 126
    "\t[-e]: set end_id at which to end output.\n"
......
228 230
      case 'o':
229 231
        outbuff_size = atoi(optarg);
230 232
        break;
231
        case 'c':
232
        chunks_per_second = atoi(optarg);
233
      case 'c':
234
        number_offer_thread = atoi(optarg);
233 235
        break;
234 236
      case 'm':
235 237
        multiply = atoi(optarg);
......
252 254
      case 'F':
253 255
        output_config = strdup(optarg);
254 256
        break;
257
      case 'l':
258
        loop_input = true;
259
        break;
255 260
      case 'C':
256 261
        channel_set_name(optarg);
257 262
        break;
......
398 403

  
399 404
      return -1;
400 405
    }
406
    
401 407
    topoAddNeighbour(srv, NULL, 0);
402

  
403
    loop(my_sock, 1000000 / chunks_per_second, buff_size);
408
    loop(my_sock, period * 1000, buff_size, number_offer_thread);
404 409
  } else {
405 410
    source_loop(fname, my_sock, period * 1000, multiply, buff_size);
406 411
  }
......
417 422
  return buff_size;
418 423
}
419 424

  
420
int get_chunks_per_sec()
421
{
422
  return chunks_per_second;
423
}
424

  
425 425
//capacity in bits/s, or NAN if unknown
426 426
double get_capacity()
427 427
{

Also available in: Unified diff