Skip to content

make Audio_Record_Playback more deterministic for offline CI#411

Open
smuppand wants to merge 1 commit intoqualcomm-linux:mainfrom
smuppand:gstreamer
Open

make Audio_Record_Playback more deterministic for offline CI#411
smuppand wants to merge 1 commit intoqualcomm-linux:mainfrom
smuppand:gstreamer

Conversation

@smuppand
Copy link
Copy Markdown
Contributor

Improve Audio_Record_Playback stability and result reporting for CI runs. Enhancements to address as part of #408

This update keeps backward compatibility for user-provided clip sources, but makes the default path more reliable by preferring locally generated OGG/MP3 sample clips when no clip path or clip URL is explicitly requested.

It also tightens result handling for dependent pulsesrc playback cases. When running in all mode, playback_pulsesrc_wav and playback_pulsesrc_flac now fail if the corresponding pulsesrc recording
in the same run did not produce a valid file, instead of being marked as skip. This makes the final summary reflect the actual end-to-end failure more accurately.

Changes included:

  • prefer offline-generated OGG/MP3 clips for default CI flow
  • preserve existing --clip-path / --clip-url behavior for backward compatibility
  • track whether external clips were explicitly requested
  • pass explicit provisioning context from run.sh into provisioning helper
  • mark dependent pulsesrc playback cases as FAIL in all mode when the
    prerequisite recording failed in the same run

Why:

  • reduce network dependency in CI
  • avoid misleading SKIP results for same-run prerequisite failures
  • make overlay/base comparisons easier by producing clearer verdicts

… overrides

Update audio clip provisioning to prefer locally generated GStreamer
sample clips for OGG and MP3 when no external clip source is explicitly
requested, making CI runs less dependent on network availability.

This keeps backward compatibility by preserving existing --clip-path,
--clip-url, AUDIO_CLIP_PATH, and AUDIO_CLIP_URL behavior. The run.sh
changes now track whether an external source was explicitly requested and
pass that state into provision_test_files(), while the provisioning
logic can still fall back to user-provided clips or downloads when
requested.

Signed-off-by: Srikanth Muppandam <smuppand@qti.qualcomm.com>
@smuppand smuppand requested review from Vkenjam and bhargav0610 April 19, 2026 12:48
@smuppand
Copy link
Copy Markdown
Contributor Author

@nitinn22 to review

have_ogg=0
have_mp3=0

mark_existing_samples() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These helper functions are defined inside provision_test_files(). This works in many shells, but it’s less common/less readable and can confuse tooling (and redefines functions on each call). Consider moving them to top-level (or at least prefix their names) to keep the script maintainable.


mark_existing_samples() {
if [ -f "$sample_ogg" ]; then
size="$(gstreamer_file_size_bytes "$sample_ogg")"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

size is reused for both OGG and MP3 checks. It’s fine, but might be clearer to use ogg_size / mp3_size so logs and debugging are easier to follow.


if gstreamer_validate_log "$test_log" "provision_sample_ogg"; then
if [ -f "$sample_ogg" ] && [ -s "$sample_ogg" ]; then
size="$(gstreamer_file_size_bytes "$sample_ogg")"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

size is reused for both OGG and MP3 checks. It’s fine, but might be clearer to use ogg_size / mp3_size so logs and debugging are easier to follow.

test_log="$outdir/provision_sample_ogg.log"
: >"$test_log"

pipeline="audiotestsrc wave=sine freq=440 volume=1.0 num-buffers=$num_buffers ! audioconvert ! vorbisenc ! oggmux ! filesink location=$sample_ogg"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding audioresample (in addition to audioconvert) before encoding for robustness across platforms:
... ! audioconvert ! audioresample ! vorbisenc ...
Some setups may require resampling/negotiation to avoid caps issues

test_log="$outdir/provision_sample_mp3.log"
: >"$test_log"

pipeline="audiotestsrc wave=sine freq=440 volume=1.0 num-buffers=$num_buffers ! audioconvert ! lamemp3enc target=bitrate cbr=true bitrate=128 ! filesink location=$sample_mp3"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lamemp3enc property support can vary across plugin versions. If this is expected to run across multiple distro/plugin versions, consider either:

keeping the pipeline minimal (lamemp3enc ! filesink ...) and letting defaults apply, or
checking/guarding the properties (if your helper lib supports querying element properties), or at least logging a clear warning if gst-launch fails due to invalid property

log_info "Using user-provided clip path: $clip_path"

if [ "$have_ogg" -eq 0 ] && [ -f "$clip_path/sample_audio.ogg" ]; then
cp "$clip_path/sample_audio.ogg" "$sample_ogg" 2>/dev/null || true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy failures are fully suppressed (2>/dev/null || true), which can make debugging hard (permissions, missing files, etc.)

fi

if [ "$have_mp3" -eq 0 ] && [ -f "$clip_path/sample_audio.mp3" ]; then
cp "$clip_path/sample_audio.mp3" "$sample_mp3" 2>/dev/null || true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy failures are fully suppressed (2>/dev/null || true), which can make debugging hard (permissions, missing files, etc.)

log_info "Generating local OGG sample from audiotestsrc..."
log_info "Pipeline: $pipeline"

if gstreamer_run_gstlaunch_timeout "$((duration_secs + 10))" "$pipeline" >>"$test_log" 2>&1; then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assumes duration_secs is numeric. If parsing guarantees numeric earlier, all good. If not, consider defensive validation or defaulting:
: "${duration_secs:=10}" and numeric check before arithmetic.

log_info "Generating local MP3 sample from audiotestsrc..."
log_info "Pipeline: $pipeline"

if gstreamer_run_gstlaunch_timeout "$((duration_secs + 10))" "$pipeline" >>"$test_log" 2>&1; then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assumes duration_secs is numeric. If parsing guarantees numeric earlier, all good. If not, consider defensive validation or defaulting:
: "${duration_secs:=10}" and numeric check before arithmetic.

@nitinn22
Copy link
Copy Markdown
Contributor

nitinn22 commented Apr 19, 2026

Main suggestions are around avoiding silent copy failures and improving portability/robustness of the generation pipelines (audioresample, encoder property compatibility). Also, if a LAVA job can be posted with these encode followed by decode and full suite working fine would be perfect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants