From 56565213f361380714404bd449a4ce76290bdbd9 Mon Sep 17 00:00:00 2001 From: igorshevach Date: Sun, 26 Jun 2016 15:38:29 +0300 Subject: [PATCH] keep playlist snapshot history (currently only when debugging --- packager/bin/monitor_packager.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packager/bin/monitor_packager.sh b/packager/bin/monitor_packager.sh index 733f12a8..b4398b1b 100644 --- a/packager/bin/monitor_packager.sh +++ b/packager/bin/monitor_packager.sh @@ -178,12 +178,17 @@ lookupTSFile $chunk [ "$media" = "v" ] && index=0 || index=1 + dts_pat="dts="; dts_duration_pat="duration_time=" + #dts_pat="dts_time="; dts_duration_pat="duration=" + #NB: 9090 is packager initial offset for dts line=`ffprobe "$urlPrefix/$chunk" -show_packets -select_streams $media | \ - awk 'BEGIN{ offset=length("dts_time=")+1; dur_offset=length("duration_time=")+1} \ - /duration_time=/ { duration_time=substr($0,dur_offset);} \ - /dts_time=/ { last=substr($0,offset); if(!first){first=last}} \ - END{ last+=duration_time; print first" "last" "(last-first)}'` - medias[index]="$media $line" + awk -v dtspat=$dts_pat -v dts_durationpat=$dts_duration_pat \ + 'BEGIN{ offset=length(dtspat)+1; dur_offset=length(dts_durationpat)+1} \ + $0 ~ dts_durationpat { duration_time=substr($0,dur_offset);} \ + $0 ~ dtspat { last=substr($0,offset); if(!first){first=last} } \ + END{ last=((last+8589934592)-9090)%8589934592; first=((first+8589934592)-9090)%8589934592; last+=duration_time; print first" "last" "(last-first)}'` + + medias[index]="$media $line" #>> $outfile # echo -e "$endLine" >> $outfile done;