Skip to content

Commit 93f6153

Browse files
committed
Updated lib gstreamer sh utils file to support logs based post processing
Signed-off-by: Nitin Nakka <nitinn@qti.qualcomm.com>
1 parent 79fd143 commit 93f6153

1 file changed

Lines changed: 70 additions & 0 deletions

File tree

Runner/utils/lib_gstreamer.sh

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,3 +498,73 @@ gstreamer_build_playback_pipeline() {
498498
printf '%s\n' "filesrc location=${file} ! ${dec} ! audioconvert ! audioresample ! ${sinkElem}"
499499
return 0
500500
}
501+
502+
# -------------------- GStreamer error log checker --------------------
503+
# gstreamer_check_errors <logfile>
504+
# Returns: 0 if no critical errors found, 1 if errors found
505+
# Checks for common GStreamer ERROR patterns that indicate failure
506+
gstreamer_check_errors() {
507+
logfile="$1"
508+
509+
[ -f "$logfile" ] || return 0
510+
511+
# Check for critical ERROR messages
512+
if grep -q -E "^ERROR:|ERROR: from element|Internal data stream error|streaming stopped, reason not-negotiated|Could not open|No such file|Permission denied|Failed to|Cannot" "$logfile" 2>/dev/null; then
513+
return 1
514+
fi
515+
516+
# Check for pipeline preroll failures
517+
if grep -q -E "pipeline doesn't want to preroll|pipeline doesn't want to play" "$logfile" 2>/dev/null; then
518+
return 1
519+
fi
520+
521+
# Check for state change failures
522+
if grep -q -E "failed to change state|state change failed" "$logfile" 2>/dev/null; then
523+
return 1
524+
fi
525+
526+
return 0
527+
}
528+
529+
# -------------------- GStreamer log validation with detailed reporting --------------------
530+
# gstreamer_validate_log <logfile> <testname>
531+
# Returns: 0 if validation passes, 1 if errors found
532+
# Logs detailed error information if errors are detected
533+
gstreamer_validate_log() {
534+
logfile="$1"
535+
testname="${2:-test}"
536+
537+
[ -f "$logfile" ] || {
538+
log_warn "$testname: Log file not found: $logfile"
539+
return 1
540+
}
541+
542+
if ! gstreamer_check_errors "$logfile"; then
543+
log_fail "$testname: GStreamer errors detected in log"
544+
545+
# Extract and log specific error messages
546+
if grep -q "ERROR:" "$logfile" 2>/dev/null; then
547+
log_fail "Error messages found:"
548+
grep "ERROR:" "$logfile" 2>/dev/null | head -n 5 | while IFS= read -r line; do
549+
log_fail " $line"
550+
done
551+
fi
552+
553+
# Check for specific failure reasons
554+
if grep -q "not-negotiated" "$logfile" 2>/dev/null; then
555+
log_fail " Reason: Format negotiation failed (caps mismatch)"
556+
fi
557+
558+
if grep -q "Could not open" "$logfile" 2>/dev/null; then
559+
log_fail " Reason: File or device access failed"
560+
fi
561+
562+
if grep -q "No such file" "$logfile" 2>/dev/null; then
563+
log_fail " Reason: File not found"
564+
fi
565+
566+
return 1
567+
fi
568+
569+
return 0
570+
}

0 commit comments

Comments
 (0)