Commit 264f7d22 authored by Olav Kvittem's avatar Olav Kvittem

crude format change, rtmp module perl defined cleanup

parent 173179d4
...@@ -755,7 +755,7 @@ sub eat_stream { ...@@ -755,7 +755,7 @@ sub eat_stream {
my $tx0; my $tx0;
if (($fid, $seq, $src, $dst, $tx, $rx, $size)= if (($fid, $seq, $src, $dst, $tx, $rx, $size)=
/ID=(\d+)\s+SEQ=(\d+)\s+SRC=([\d.:]+)\s+DST=([\d.:]+)\s+Tx=([\d.,]+)\s+Rx=([\d.,]+)\s+SIZE=(\d+)/){ /ID=(\d+)\s+SEQ=(\d+)\s+SRC=([\d.:]+)\s+DST=([\d.:]+)\s+Tx=([\d.,]+)\s+Rx=([\d.,]+)\s+.*SIZE=(\d+)/){
$flow_key="$src->$dst"; $flow_key="$src->$dst";
$flow_pkts{$flow_key}++; $flow_pkts{$flow_key}++;
......
...@@ -948,7 +948,7 @@ sub get_rtmp_timer ...@@ -948,7 +948,7 @@ sub get_rtmp_timer
my $output; my $output;
my ($sec, $microsec) = gettimeofday; my ($sec, $microsec) = gettimeofday;
my $now_time = $sec . substr($microsec, 0, 3); my $now_time = $sec . substr($microsec, 0, 3);
our @rtmp_timer_start unless defined @rtmp_timer_start; our @rtmp_timer_start unless @rtmp_timer_start;
if (defined $rtmp_timer_start[$chunk_id]) if (defined $rtmp_timer_start[$chunk_id])
{ {
my $rtmp_timestamp = $now_time - $rtmp_timer_start[$chunk_id]; my $rtmp_timestamp = $now_time - $rtmp_timer_start[$chunk_id];
...@@ -981,7 +981,7 @@ sub reset_rtmp_timer ...@@ -981,7 +981,7 @@ sub reset_rtmp_timer
my ($sec, $microsec) = gettimeofday; my ($sec, $microsec) = gettimeofday;
my $now_time = $sec . substr($microsec, 0, 3); my $now_time = $sec . substr($microsec, 0, 3);
our @rtmp_timer_start unless defined @rtmp_timer_start; our @rtmp_timer_start unless @rtmp_timer_start;
$rtmp_timer_start[$chunk_id] = $now_time; $rtmp_timer_start[$chunk_id] = $now_time;
return 1; return 1;
} }
...@@ -995,7 +995,7 @@ sub set_rtmp_chunk_msg_length ...@@ -995,7 +995,7 @@ sub set_rtmp_chunk_msg_length
my ($chunk_id, $chunk_message_length) = @_; my ($chunk_id, $chunk_message_length) = @_;
return unless $chunk_id =~ /^[1-9][\d]*$/ and $chunk_message_length =~ /^[0-9][\d]*$/; return unless $chunk_id =~ /^[1-9][\d]*$/ and $chunk_message_length =~ /^[0-9][\d]*$/;
our @rtmp_msg_length unless defined @rtmp_msg_length; our @rtmp_msg_length unless @rtmp_msg_length;
$rtmp_msg_length[$chunk_id] = $chunk_message_length; $rtmp_msg_length[$chunk_id] = $chunk_message_length;
return 1; return 1;
} }
...@@ -1009,7 +1009,7 @@ sub get_rtmp_chunk_msg_length ...@@ -1009,7 +1009,7 @@ sub get_rtmp_chunk_msg_length
{ {
my ($chunk_id) = @_; my ($chunk_id) = @_;
return unless $chunk_id =~ /^[1-9][\d]*$/; return unless $chunk_id =~ /^[1-9][\d]*$/;
print 'get msg length before set.' unless defined @rtmp_msg_length; print 'get msg length before set.' unless @rtmp_msg_length;
return $rtmp_msg_length[$chunk_id]; return $rtmp_msg_length[$chunk_id];
} }
...@@ -1021,7 +1021,7 @@ sub set_rtmp_chunk_msg_type_id ...@@ -1021,7 +1021,7 @@ sub set_rtmp_chunk_msg_type_id
{ {
my ($chunk_id, $chunk_message_type_id) = @_; my ($chunk_id, $chunk_message_type_id) = @_;
return unless $chunk_id and $chunk_message_type_id =~ /^[1-9][\d]*$/; return unless $chunk_id and $chunk_message_type_id =~ /^[1-9][\d]*$/;
our @rtmp_msg_type_id unless defined @rtmp_msg_type_id; our @rtmp_msg_type_id unless @rtmp_msg_type_id;
$rtmp_msg_type_id[$chunk_id] = $chunk_message_type_id; $rtmp_msg_type_id[$chunk_id] = $chunk_message_type_id;
return 1; return 1;
} }
...@@ -1034,7 +1034,7 @@ sub get_rtmp_chunk_msg_type_id ...@@ -1034,7 +1034,7 @@ sub get_rtmp_chunk_msg_type_id
{ {
my ($chunk_id) = @_; my ($chunk_id) = @_;
return unless $chunk_id =~ /^[1-9][\d]*$/; return unless $chunk_id =~ /^[1-9][\d]*$/;
print 'get msg type id before set.' unless defined @rtmp_msg_type_id; print 'get msg type id before set.' unless @rtmp_msg_type_id;
return $rtmp_msg_type_id[$chunk_id]; return $rtmp_msg_type_id[$chunk_id];
} }
...@@ -1047,7 +1047,7 @@ sub set_rtmp_chunk_msg_stream_id ...@@ -1047,7 +1047,7 @@ sub set_rtmp_chunk_msg_stream_id
my ($chunk_id, $chunk_message_stream_id) = @_; my ($chunk_id, $chunk_message_stream_id) = @_;
return unless $chunk_id =~ /^[1-9][\d]*$/ and $chunk_message_stream_id =~ /^[1-9][\d]*$/; return unless $chunk_id =~ /^[1-9][\d]*$/ and $chunk_message_stream_id =~ /^[1-9][\d]*$/;
our @rtmp_msg_stream_id unless defined @rtmp_msg_stream_id; our @rtmp_msg_stream_id unless @rtmp_msg_stream_id;
$rtmp_msg_stream_id[$chunk_id] = $chunk_message_stream_id; $rtmp_msg_stream_id[$chunk_id] = $chunk_message_stream_id;
return 1; return 1;
} }
...@@ -1060,7 +1060,7 @@ sub get_rtmp_chunk_msg_stream_id ...@@ -1060,7 +1060,7 @@ sub get_rtmp_chunk_msg_stream_id
{ {
my ($chunk_id) = @_; my ($chunk_id) = @_;
return unless $chunk_id =~ /^[1-9][\d]*$/; return unless $chunk_id =~ /^[1-9][\d]*$/;
print 'get msg stream id before set.' unless defined @rtmp_msg_stream_id; print 'get msg stream id before set.' unless @rtmp_msg_stream_id;
return $rtmp_msg_stream_id[$chunk_id]; return $rtmp_msg_stream_id[$chunk_id];
} }
...@@ -1102,7 +1102,7 @@ sub get_rtmp_client_chunk_size ...@@ -1102,7 +1102,7 @@ sub get_rtmp_client_chunk_size
sub reset_rtmp_msg sub reset_rtmp_msg
{ {
print "reset rtmp msg before set it.\n" unless defined @rtmp_msg; print "reset rtmp msg before set it.\n" unless @rtmp_msg;
my ($chunk_id) = @_; my ($chunk_id) = @_;
$rtmp_msg[$chunk_id] = ''; $rtmp_msg[$chunk_id] = '';
} }
...@@ -1114,7 +1114,7 @@ sub reset_rtmp_msg ...@@ -1114,7 +1114,7 @@ sub reset_rtmp_msg
sub put_rtmp_msg sub put_rtmp_msg
{ {
my ($chunk_id, $string) = @_; my ($chunk_id, $string) = @_;
our @rtmp_msg unless defined @rtmp_msg; our @rtmp_msg unless @rtmp_msg;
$rtmp_msg[$chunk_id] .= $string; $rtmp_msg[$chunk_id] .= $string;
} }
...@@ -1124,7 +1124,7 @@ sub put_rtmp_msg ...@@ -1124,7 +1124,7 @@ sub put_rtmp_msg
sub get_rtmp_msg sub get_rtmp_msg
{ {
print "get rtmp msg before set it.\n" unless defined @rtmp_msg; print "get rtmp msg before set it.\n" unless @rtmp_msg;
my ($chunk_id) = @_; my ($chunk_id) = @_;
return $rtmp_msg[$chunk_id]; return $rtmp_msg[$chunk_id];
} }
......
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