chiark / gitweb /
Correct playlist read sense
[disorder] / clients / playrtp-log
1 #! /usr/bin/perl -w
2 use strict;
3
4 our $last;
5 my %start = ();
6 my %end = ();
7 while(<>) {
8     if(/sequence (\d+) timestamp (\w+) length (\w+) end (\w+)/) {
9         my $seq = $1;
10         my $timestamp = hex($2);
11         my $length = hex($3);
12         my $end = hex($4);
13
14         if(defined $last) {
15             if($seq < $last) {
16                 print "$seq < $last\n";
17             } elsif($seq != $last + 1) {
18                 printf "%u when %u expected, missed %d\n",
19                 $seq, $last + 1, $seq - $last;
20             }
21         }
22         if(exists $start{$seq}) {
23             print "$seq: duplicate";
24         }
25         $start{$seq} = $timestamp;
26         $end{$seq} = $end;
27         if(exists $start{$seq-1}) {
28             if($end{$seq-1} != $start{$seq}) {
29                 printf "%u ends at %x but %u starts at %x (delta=%d)\n",
30                 $seq-1, $end{$seq-1}, $seq, $start{$seq},
31                 $start{$seq}-$end{$seq-1};
32             }
33         }
34
35
36         $last = $seq;
37     }
38 }