Skip to content

Commit

Permalink
Merge branch '1.0.0' of https://github.com/kaltura/liveDVR into 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Gad Yaari committed Jun 26, 2016
2 parents 50872e9 + 5656521 commit 5877c3d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
3 changes: 2 additions & 1 deletion common/config/config.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"humanReadable" : false,
"keyFrameSearchOffsetMs" : 1,
"discontinuityMode" : true,
"segmentDuration" : 10000
"segmentDuration" : 10000,
"enablePlaylistHistory": false
}
}
34 changes: 22 additions & 12 deletions packager/bin/monitor_packager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,16 @@ function lookupTSFile {
# result: seg-1466803160985-12000-146680317-f1-v1.ts -> seg 1466803160985 12000 146680317 f1 v1.ts
# take 3 last tokens
local n=${#items[@]}
[[ "$1" =~ "-a1" ]] && audio=1 || audio=0
[[ "$audio" -eq "1" ]] && pattern="(.*)-${items[$n-4]}-${items[$n-3]}-${items[$n-2]}-${items[$n-1]}" || pattern="(.*)-${items[$n-3]}-${items[$n-2]}-${items[$n-1]}"
found=`grep -iEo "$pattern" $outfile`

found=`grep -iEo "(.*)${items[$n-3]}-${items[$n-2]}-${items[$n-1]}" $outfile`
# if debug info on chunk name is present then validate
local retval=${#found}
if (( $retval > 0 && $n > 4 ))
[[ "$audio" -eq "1" ]] && fieldsCnt=5 || fieldsCnt=4
if (( $retval > 0 && $n > $fieldsCnt ))
then
#echo "n=$n found=$found"
dbgInfoCmp "$1" "$found"
fi
#echo "found=$found"
Expand All @@ -141,10 +145,13 @@ function analyzeChunk {

#grep "$chunk" $outfile &> /dev/null && return

lookupTSFile $chunk
warning=`lookupTSFile $chunk`

retval=$?

#echo "analyzeChunk chunk=$chunk retval=$retval"

[ -n "$warning" ] && echo $warning >> $outfile

[ "$retval" -eq "0" ] || return
Expand All @@ -171,17 +178,21 @@ function analyzeChunk {

[ "$media" = "v" ] && index=0 || index=1

#echo -e "\ncount:\tdts:\n$partitionLine" >> $outfile

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"
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 -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;

if [ -n "${medias[0]}" ]
then
video=(${medias[0]})
Expand All @@ -204,8 +215,7 @@ function analyzeChunk {
#there's no double processing in bash...
[ `echo "$chunkStartEndTSDiff >= $threshold" | bc` = "1" ] || [ `echo "$chunkStartEndTSDiff >= $threshold" | bc` = "1" ] && warning="$warning bad alignment WARNING: $chunkStartEndTSDiff"


echo "$chunkStartDTSDiff $chunkStartEndTSDiff `echo "${video[3]} - ${audio[3]}" | bc` errors: $warning" >> $outfile;
echo "diffs: $chunkStartDTSDiff $chunkStartEndTSDiff `echo "${video[3]} - ${audio[3]}" | bc` errors: $warning" >> $outfile;
else
echo "${video[1]} ${video[2]} ${video[3]} errors: $warning" >> $outfile;
fi
Expand Down

0 comments on commit 5877c3d

Please sign in to comment.