Commit 8800a16a authored by Olav Kvittem's avatar Olav Kvittem

option -wait for join

parent 956129b4
......@@ -38,14 +38,13 @@ use XML::DOM;
use XML::Twig;
#use mpegpackets;
$DEFAULT_PORT = 1955;
my $timeout=1 ; # frac seconds to wait for receiving packets
#my oh my,more globals
my ($rtmp,$period,$last,$debug,$swfurl,$pageurl,$flash_version,$reconnect);
require "newgetopt.pl";
@opts=('list', 'man','fullformat', 'net', 'rtp', 'mpeg', 'pcap', 'crude', 'bins=s', 'log', 'nperiod=s', 'period=s', 'last=s', 'packets=s', 'src=s', 'flow_key=s', 'flow_no=s', 'flow_min=s', 'nohead', 'dump=s', 'format=s', 'id=s', 'sum=s', 'ttl', 'rtt=s', 'codec=s', 'log', 'verbose', 'v', 'h', 'debug', 'av','xml=s', 'rtmp','tcp', 'port=s','swfurl=s','pageurl=s','flashversion=s','new','q','exclude=s','report=s', 'filename','test','ipv6','p=s','name=s','tcp_t');
@opts=('list', 'man','fullformat', 'net', 'rtp', 'mpeg', 'pcap', 'crude', 'bins=s', 'log', 'nperiod=s', 'period=s', 'last=s', 'packets=s', 'src=s', 'flow_key=s', 'flow_no=s', 'flow_min=s', 'nohead', 'dump=s', 'format=s', 'id=s', 'sum=s', 'ttl', 'rtt=s', 'codec=s', 'log', 'verbose', 'v', 'h', 'debug', 'av','xml=s', 'rtmp','tcp', 'port=s','swfurl=s','pageurl=s','flashversion=s','new','q','exclude=s','report=s', 'filename','test','ipv6','p=s','name=s','tcp_t','wait=s');
&NGetOpt(@opts) || die pod2usage(1);
die pod2usage(1) if $opt_h;
......@@ -55,6 +54,11 @@ my $codec = $opt_codec || 'G.711';
my $rtt = $opt_rtt || 10; # ms round trip time of the connection
pod2usage(-verbose => 2 ) if $opt_man;
my $initial_wait= $opt_wait || 3 ; # frac seconds to wait initially
my $waittime=$initial_wait;
my $next_wait=0.1 ; # frac seconds to wait for receiving between packets
my @streams=@ARGV;
if ($opt_bins){
......@@ -624,6 +628,7 @@ sub eat_stream {
my $packet;
last if ! $uninterrupted || $endstream;
if ($select->can_read($timeout) && ($packet = $rtp->recv())){
my $timeout=$next_wait;
my $ssrc = $packet->ssrc();
$cur_id=$packet->source_ip . ", $address:$port";
......@@ -686,6 +691,7 @@ sub eat_stream {
if ($select->can_read($timeout) && $mc->recv($packet, 1560)) {
last if ! $uninterrupted || $endstream;
my $timeout=$next_wait;
$n_packets++;
my $ssrc = $mc->peerhost;
my $cur_id = $mc->peerhost . ":" . $mc->peerport . "->$address:$port";
......@@ -697,6 +703,7 @@ sub eat_stream {
next if $opt_src and $opt_src ne $cur_id;
$tc=[gettimeofday]; # current flow time
if( $t0){
$elapsed=tv_interval ( $t0, $tc);
} else {
......@@ -3927,6 +3934,8 @@ usage="$0 [option]... [file...|ip/|:port]...
=item B<-packets> packets - exit after packets
=item B<-wait> seconds - wait for initial join ($initial_wait)
=item B<-src source> - limit stats to given source
=item B<-flow_key> flow key - limit stats to this flow(src_ip:src_port->dest_ip:dest_port)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment