Commit 83dd2758 authored by paalmm's avatar paalmm

fixed empty .pcap file bug

parent b25e39a3
......@@ -1299,13 +1299,15 @@ sub xml_dump {
$packets_dupXML->addText(&format_numbers($dup{$f}));
$packets_lateXML->addText(&format_numbers($late{$f}));
$packets_lostXML->addText(&format_numbers($nloss{$f}));
my $n=$npkt{$f}; $n=1 if $npkt{$f} <1; # divide by zero protection
my $n=$npkt{$f}; $n=1 if $npkt{$f} < 1; # divide by zero protection
my $njitter = $njitter{$f}; $njitter =1 if $njitter{$f} < 1;
$packets_sizeXML->addText(&format_numbers($sumbyte{$f}/$n));
#adds values
$MOS_XML->addText(&format_numbers(&mos_r($codec, $rtt, avg( $sumgap{$f}, $ngap{$f}) / 1000,
avg($sumjitter{$f}, $njitter{$f})/1000,
100*$nloss{$f}/$npkt{$f})));
avg($sumjitter{$f}, $njitter)/1000,
100*$nloss{$f}/$n)));
$rtp_timestamp->addText(&format_numbers($ntimeerr{$f}));
$rtp_dup->addText(&format_numbers($dup{$f}));
$rtp_late->addText(&format_numbers($late{$f}));
......@@ -1314,8 +1316,8 @@ sub xml_dump {
$rtp_avg->addText(&format_numbers( avg( $sumloss{$f}, $nloss{$f}) ));
$rtp_sdv->addText(&format_numbers( sdv($lost{$f}, $sumloss{$f},$ssumloss{$f})));
$rtp_jitter_numb->addText(&format_numbers($njitter{$f}));
$rtp_jitter_avgXML->addText(&format_numbers($sumjitter{$f}/$njitter{$f}/1000));
$rtp_jitter_sdvXML->addText(&format_numbers($sumjitter{$f}/$njitter{$f}/1000));
$rtp_jitter_avgXML->addText(&format_numbers($sumjitter{$f}/$njitter/1000));
$rtp_jitter_sdvXML->addText(&format_numbers($sumjitter{$f}/$njitter/1000));
$rtp_jitter_minXML->addText(&format_numbers($minjitter{$f}/1000));
$rtp_jitter_maxXML->addText(&format_numbers($maxjitter{$f}/1000));
$rtp_jitter_rfc->addText(&format_numbers($maxjitter{$f}/1000));
......@@ -1743,6 +1745,8 @@ sub print_out {
my $id=$f;
my $source=$f;
next if $npkt{$f} < $opt_flow_min;
my $n=$npkt{$f}; $n=1 if $npkt{$f} < 1; # divide by zero protection
my $njitter = $njitter{$f}; $njitter =1 if $njitter{$f} < 1;
$source=$source{$f} if ! $opt_v && $source{$f} ne "" && !$file_flag;
$source=$opt_id if $opt_id;
my $jitter_stat= $opt_rtp || $opt_crude;
......@@ -1778,10 +1782,11 @@ sub print_out {
}
my @output = (@dwell_head);
my $mos;
print "$npkt{$f} \n";
if ($jitter_stat){
$mos=&mos_r($codec, $rtt, avg( $sumgap{$f}, $ngap{$f}) / 1000,
avg($sumjitter{$f}, $njitter{$f})/1000,
100*$nloss{$f}/$npkt{$f} );
avg($sumjitter{$f}, $njitter)/1000,
100*$nloss{$f}/$n );
}
if ($opt_v) {
#Prints header
......@@ -1991,7 +1996,7 @@ sub print_out {
my $n=$npkt{$f}; $n=1 if $npkt{$f} <1; # divide by zero protection
if ($jitter_stat){
@jitterstat= (&lesbars($sumjitter{$f}/$njitter{$f}/1000),
@jitterstat= (&lesbars($sumjitter{$f}/$njitter/1000),
&lesbars(sdv($njitter{$f}, $sumjitter{$f}, $ssjitter{$f})/1000),
&lesbars($minjitter{$f}/1000),
&lesbars($maxjitter{$f}/1000));
......
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