Skip to content

Commit 3e4bddc

Browse files
nitinn22Jeevanandan Sandan
authored andcommitted
Updated lib gstreamer sh utils file to support logs based post processing
Signed-off-by: Nitin Nakka <nitinn@qti.qualcomm.com>
1 parent d516c59 commit 3e4bddc

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

0 commit comments

Comments
 (0)