Commit a3e4ded8 authored by paalmm's avatar paalmm

updates: fixed MPEG-ts bugs and implemented support for XML,rtmp and tcp

parent 6610d523
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -499,11 +499,7 @@ sub my_recv_a_chunk ...@@ -499,11 +499,7 @@ sub my_recv_a_chunk
$calculated_timestamp += $chunk_timestamp_delta; $calculated_timestamp += $chunk_timestamp_delta;
check_if_extended($chunk_timestamp_delta); #checks if time stmap is extended. -PMM check_if_extended($chunk_timestamp_delta); #checks if time stmap is extended. -PMM
my $chunk_msg_length = dec(substr($chunk_header, 3, 3)); my $chunk_msg_length = dec(substr($chunk_header, 3, 3));
print "msg lengt $chunk_msg_length \n" if $debug_flag; print "msg length $chunk_msg_length \n" if $debug_flag;
if ($chunk_msg_length > 100000 ){
$chunk_msg_length = $chunk_size ;
}
;
set_rtmp_chunk_msg_length($chunk_id, $chunk_msg_length); set_rtmp_chunk_msg_length($chunk_id, $chunk_msg_length);
my $chunk_msg_type_id = dec(substr($chunk_header, 6, 1)); my $chunk_msg_type_id = dec(substr($chunk_header, 6, 1));
$chunk_msg_type_id = -1 unless defined $chunk_msg_type_id; $chunk_msg_type_id = -1 unless defined $chunk_msg_type_id;
...@@ -730,6 +726,7 @@ sub my_recv_a_msg ...@@ -730,6 +726,7 @@ sub my_recv_a_msg
if ($rtmp_msg_type_id == 8) if ($rtmp_msg_type_id == 8)
{ {
$rtmp_msg_type_name = 'Audio'; $rtmp_msg_type_name = 'Audio';
} }
elsif ($rtmp_msg_type_id == 9) elsif ($rtmp_msg_type_id == 9)
{ {
...@@ -807,6 +804,7 @@ sub my_recv_nostop ...@@ -807,6 +804,7 @@ sub my_recv_nostop
$how_many_bytes_recieved_noreport += $how_many_bytes_recieved; $how_many_bytes_recieved_noreport += $how_many_bytes_recieved;
$rtmp_stats{'bytes_recieved'} += $how_many_bytes_recieved; $rtmp_stats{'bytes_recieved'} += $how_many_bytes_recieved;
} }
if ( $how_many_bytes_recieved_noack >= get_rtmp_window() ) if ( $how_many_bytes_recieved_noack >= get_rtmp_window() )
{ {
dprint("send acknowlege to server."); dprint("send acknowlege to server.");
...@@ -835,6 +833,7 @@ sub my_recv_nostop ...@@ -835,6 +833,7 @@ sub my_recv_nostop
if ($span >= $last || $span >= $period) if ($span >= $last || $span >= $period)
{ {
#endtime = time(); #endtime = time();
#&save_to_file($how_many_btyes_recieved_noreport, $recieved_binary);
last; last;
#span = $endtime - $start_time; #span = $endtime - $start_time;
...@@ -1266,9 +1265,9 @@ sub rtmp_jitter_stats{ ...@@ -1266,9 +1265,9 @@ sub rtmp_jitter_stats{
my ($chunk_timestamp_delta,$chunk_id) = @_; my ($chunk_timestamp_delta,$chunk_id) = @_;
$chunk_timestamp_delta = int($chunk_timestamp_delta); $chunk_timestamp_delta = int($chunk_timestamp_delta);
$real_time_rtmp = time(); $real_time_rtmp = time();
++$rtmp_jitter_stats{$chunk_id}{'num_packets'}; ++$rtmp_jitter_stats{$chunk_id}{'num_msg'};
#we dont want the first packet messing up with our stats. #we dont want the first packet messing up with our stats.
if ($rtmp_jitter_stats{$chunk_id}{'num_packets'} != 1 ){ if ($rtmp_jitter_stats{$chunk_id}{'num_msg'} != 1 ){
if(($rtmp_jitter_stats{$chunk_id}{'type'} eq "Video" || $rtmp_jitter_stats{$chunk_id}{'type'} eq "Audio") and $first_av_packet != 1 ){ if(($rtmp_jitter_stats{$chunk_id}{'type'} eq "Video" || $rtmp_jitter_stats{$chunk_id}{'type'} eq "Audio") and $first_av_packet != 1 ){
$first_av_packet = 1; $first_av_packet = 1;
$rtmp_stats{'set_up'} = (time() - $start_time)*(10**3); $rtmp_stats{'set_up'} = (time() - $start_time)*(10**3);
...@@ -1284,18 +1283,25 @@ sub rtmp_jitter_stats{ ...@@ -1284,18 +1283,25 @@ sub rtmp_jitter_stats{
} }
$rtmp_jitter_stats{$chunk_id}{'jitter_sum'} += $jitter_rtmp; $rtmp_jitter_stats{$chunk_id}{'jitter_sum'} += $jitter_rtmp;
$rtmp_jitter_stats{$chunk_id}{'jitter_square'} += $jitter_rtmp**2; $rtmp_jitter_stats{$chunk_id}{'jitter_square'} += $jitter_rtmp**2;
#$rtmp_jitter_stats{$chunk_id}{'sdv'};
#print "avg jitter ", $rtmp_jitter_stats{$chunk_id}{'avg'}, "\n" if $debug_flag !=0;
} }
else { else {
$rtmp_jitter_stats{$chunk_id}{'jitter_min'} = 400000; $rtmp_jitter_stats{$chunk_id}{'jitter_min'} = 400000;
$rtmp_jitter_stats{$chunk_id}{'jitter_max'} = 0; $rtmp_jitter_stats{$chunk_id}{'jitter_max'} = 0;
$rtmp_jitter_stats{$chunk_id}{'jitter_sum'} = 0; $rtmp_jitter_stats{$chunk_id}{'jitter_sum'} = 0;
$rtmp_jitter_stats{$chunk_id}{'jitter_avg'} = 0; $rtmp_jitter_stats{$chunk_id}{'jitter_avg'} = 0;
#$rtmp_jitter_stats{$chunk_id}{'jitter_sdv'} = 0;
} }
$real_last_time_rtmp{$chunk_id} = $real_time_rtmp; $real_last_time_rtmp{$chunk_id} = $real_time_rtmp;
} }
sub restart_stream_on_error{ sub restart_stream_on_error{
die "Connection failed...try agian\n"; die "Connection failed...try agian\n";
# sleep(2);
# my ($rtmp,$period,$last,$debug,$swfurl,$pageurl,$flash_version) = &get_rtmp_vars();
# my $reconnect = 1;
# &rtmp_eat_stream($rtmp,$period,$last,$reconnect,$debug,$swfurl,$pageurl,$flash_version);
} }
...@@ -1308,8 +1314,8 @@ sub init_stats_rtmp { ...@@ -1308,8 +1314,8 @@ sub init_stats_rtmp {
sub get_rtmp_data{ sub get_rtmp_data{
my $span = time() - $start_time; my $span = time() - $start_time;
foreach my $chunk_id (keys %rtmp_jitter_stats) { foreach my $chunk_id (keys %rtmp_jitter_stats) {
$rtmp_jitter_stats{$chunk_id}{'jitter_avg'} = avg($rtmp_jitter_stats{$chunk_id}{'jitter_sum'},$rtmp_jitter_stats{$chunk_id}{'num_packets'}); $rtmp_jitter_stats{$chunk_id}{'jitter_avg'} = avg($rtmp_jitter_stats{$chunk_id}{'jitter_sum'},$rtmp_jitter_stats{$chunk_id}{'num_msg'});
$rtmp_jitter_stats{$chunk_id}{'jitter_sdv'} = sdv($rtmp_jitter_stats{$chunk_id}{'num_packets'},$rtmp_jitter_stats{$chunk_id}{'jitter_sum'},$rtmp_jitter_stats{$chunk_id}{'jitter_square'}); $rtmp_jitter_stats{$chunk_id}{'jitter_sdv'} = sdv($rtmp_jitter_stats{$chunk_id}{'num_msg'},$rtmp_jitter_stats{$chunk_id}{'jitter_sum'},$rtmp_jitter_stats{$chunk_id}{'jitter_square'});
} }
$rtmp_stats{'rtmp_msg'} = $msgcount; $rtmp_stats{'rtmp_msg'} = $msgcount;
$rtmp_stats{'chunk_size'} = get_rtmp_client_chunk_size(); $rtmp_stats{'chunk_size'} = get_rtmp_client_chunk_size();
......
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