Commit 1bf1e733 authored by paalmm's avatar paalmm

release av qstream 2011-11-09

parent 56c18552
......@@ -4,6 +4,7 @@
# Base Olav Kvittem
# Mpeg support Odd Rune Mykkeltveit Lykkbo, 2009-2010
# Mos values computation Gurvinder Singh, 2010-05-07
# XML, RTMP, TCP support, Pål Moen Møst, 2011.
# use Socket;
use IO::Socket qw(:DEFAULT :crlf);
......@@ -42,7 +43,7 @@ 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');
@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');
&NGetOpt(@opts) || die pod2usage(1);
die pod2usage(1) if $opt_h;
......@@ -137,6 +138,8 @@ my %dist2 = ();
$opt_period = $opt_last if not $opt_period;
$file_flag = 1 if $opt_filename;
#MPEG-TS END
......@@ -196,6 +199,7 @@ if ($opt_pcap || ($opt_tcp && !$opt_rtmp)){ # listen in parallell
&end_xml() if $opt_xml;
exit(0);
sub http_stream_client {
my $f = shift;
my $playlist = get("$f");
......@@ -226,12 +230,13 @@ sub http_stream_client {
}
}
}
}
}
}
sub get_stream {
my $uri = shift;
my $data = get("$uri");
}
##TCP impl. -PMM
sub handle_threads {
$tcp_stop = 1;
......@@ -660,7 +665,7 @@ sub eat_stream {
# my $select=IO::Select->new(Net::Pcap::fileno($pcap));
until ( ! $uninterrupted || $endstream || ($opt_packets && $n_packets > $opt_packets)
|| ! (my $pkt=Net::Pcap::next($pcap, \%hdr) ) ) {
$file_flag =1;
#$file_flag =1;
eat_pcap($f, $pcap, $pkt);
$n_packets++;
}
......@@ -1236,7 +1241,7 @@ sub xml_dump {
$stream_id_type_XML->addText($pts_stats{$f}{$pid}{'stream_id_type'});
#mpeg
$num_packets_XML->addText($mpeg_stats{$f}{$pid}{'num'});
$lost_packets_XML->addText($mpeg_stats{$f}{$pid}{'lost_packets'});
$lost_packets_XML->addText(&format_numbers($mpeg_stats{$f}{$pid}{'lost_packets'}));
$media_loss_rate_XML->addText($mpeg_stats{$f}{$pid}{'media_loss_rate'});
$delay_factor_XML->addText(&format_numbers($mpeg_stats{$f}{$pid}{'delay_factor'}));
$media_bandwidth_XML->addText($mpeg_stats{$f}{$pid}{'media_bandwidth'});
......@@ -2111,9 +2116,6 @@ sub mpeg_stats
if ($tspack->is_valid() != 1) {
print "not valid $j offsett: $offset reading: $var \n\n";
print "off @ret ...$n \n";
print "@hex_string \n\n";
next; }
......@@ -2194,7 +2196,6 @@ sub pcr_update_stats
$tm2 = $pcr_stats{$f}{'running_dpcr_mean'};
$pcr_stats{$f}{'running_dpcr_std'} = $ts + (($sample - $tm)*($sample - $tm2));
#Max/Min-checks for delta-PCR
if ($sample > $pcr_stats{$f}{'max_dpcr'}) {
$pcr_stats{$f}{'max_dpcr'} = $sample;
......@@ -2364,6 +2365,9 @@ sub init_dwell{
sub check_continuity
{
my ($f,$pid, $cc, $discont, $payload) = @_;
if (!exists $mpeg_stats{$f}{$pid}{'lost_packets'}){
$mpeg_stats{$f}{$pid}{'lost_packets'} = 0;
}
if (not exists $last_ccs{$pid}) {
return;
......@@ -3705,6 +3709,8 @@ usage="$0 [option]... [file...|ip/|:port]...
=item B<-pcap> listen to all multicast groups with pcap at the same time.
=item B<-filename> print filename as source.
=item B<-period> seconds - period in seconds between stats output
=item B<-nperiod> number of periodes
......
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