char *opt_output = "delay_stats";
unsigned opt_count_sec = 0;
unsigned opt_def_bandwidth = 200;
-unsigned opt_def_period_msec = 10;
+unsigned opt_def_period_msec = 0;
int opt_granularity_usec = MIN_GRANULARITY;
int ac_sockfd[AC_NUM];
set_rt_prio(90-stream->ac);
- if (opt_packet_size) {
- packet_size = opt_packet_size;
+ if (stream->packet_size) {
+ packet_size = stream->packet_size;
period_usec = SEC_TO_USEC*packet_size*8/stream->bandwidth_bps;
- } else {
+ } else if (stream->period_usec) {
period_usec = stream->period_usec;
packet_size = (long long)stream->bandwidth_bps/8 * period_usec/SEC_TO_USEC;
+ } else {
+ char buf[200];
+ stream_to_text(buf, sizeof(buf), stream, 0);
+ fprintf(stderr, "Neither packet size nor period was specified for a stream %s\n", buf);
+ exit(1);
}
stream->packet_size = packet_size;
stream->period_usec = period_usec;
sp->bandwidth_bps = bw*Kbit;
- long period;
+ long period = 0;
+ long packet_size = 0;
if (*params == '@') {
params++;
period = strtol(params, &next_char, 10);
return params;
params = next_char;
}
- else
- period = opt_def_period_msec;
+ else {
+ if (*params == '/') {
+ params++;
+ packet_size = strtol(params, &next_char, 10);
+ if (packet_size == 0)
+ return params;
+ params = next_char;
+ } else {
+ packet_size = opt_packet_size;
+ period = opt_def_period_msec;
+ }
+ }
sp->period_usec = period*MSEC_TO_USEC;
+ sp->packet_size = packet_size;
+
+
if (*params != '\0' && *params != ',')
return params;
fprintf(stderr, "Usage: %s [ options ] server_addr\n\n", argv[0]);
fprintf(stderr, "Options:\n");
fprintf(stderr, " -B default bandwidth for -b option [kbit]\n");
- fprintf(stderr, " -b bandwidth of streams (VO|VI|BE|BK)[:<kbit>][@<msec>][,...]\n");
+ fprintf(stderr, " -b bandwidth of streams (VO|VI|BE|BK)[:<kbit>][@<msec> or /<bytes>][,...]\n");
fprintf(stderr, " -c count (number of seconds to run)\n");
fprintf(stderr, " -g histogram granularity [usec]\n");
fprintf(stderr, " -j send jitter (0-100) [%%]\n");
fprintf(stderr, " -o output filename (.dat will be appended)\n");
- fprintf(stderr, " -s size of data payload in packets [bytes]\n");
+ fprintf(stderr, " -s size of data payload in packets [bytes] (default: %d)\n", opt_packet_size);
fprintf(stderr, " -T default period for -b option [msec]\n");
exit(1);
}
}
+ if (opt_packet_size && opt_def_period_msec) {
+ fprintf(stderr, "Error: Nonzero -T and -s can't be used together!.\n");
+ exit(1);
+ }
+
if (optind < argc) {
server_addr = argv[optind];
} else {