From bbf5b7162206ffec54d8cb9b119440da85bf582e Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Wed, 11 Dec 2024 07:49:06 -0300 Subject: [PATCH] tests: dash: Add a test to check that retries work This tries that both `souphttpsrc` and `adaptivedemux2` behave as expected when HTTP failures happen but "solve themselves". Part-of: --- .../testsuites/validate.testslist | 1 + .../dash/retry_on_failure.validatetest | 52 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 subprojects/gst-integration-testsuites/testsuites/validate/dash/retry_on_failure.validatetest diff --git a/subprojects/gst-integration-testsuites/testsuites/validate.testslist b/subprojects/gst-integration-testsuites/testsuites/validate.testslist index 9d9f213587..45a446da29 100644 --- a/subprojects/gst-integration-testsuites/testsuites/validate.testslist +++ b/subprojects/gst-integration-testsuites/testsuites/validate.testslist @@ -919,6 +919,7 @@ validate.test.aspectcropratio.set_aspect_ratio_in_paused validate.test.baseparse.single_seek validate.test.clock_sync.video_1fps validate.test.clock_sync.video_30fps +validate.test.dash.retry_on_failure validate.test.dash.seek_with_stop_between_fragments validate.test.decryptor.cenc_audio_esds_property_overrides validate.test.encodebin.encode_no_muxer diff --git a/subprojects/gst-integration-testsuites/testsuites/validate/dash/retry_on_failure.validatetest b/subprojects/gst-integration-testsuites/testsuites/validate/dash/retry_on_failure.validatetest new file mode 100644 index 0000000000..d355933be9 --- /dev/null +++ b/subprojects/gst-integration-testsuites/testsuites/validate/dash/retry_on_failure.validatetest @@ -0,0 +1,52 @@ +meta, + handles-states=true, + ignore-eos=true, + allow-errors=true, + args = { + "playbin3 name=pb video-sink=fakesink audio-sink=fakesink", + }, + expected-issues = { + # First attempt to play while the mpd is not available + "expected-issue, issue-id=\"runtime::error-on-bus\", details=\".*Service Unavailable.*\"", + "expected-issue, issue-id=\"runtime::error-on-bus\", details=\".*Got error: Internal data stream error.*\"", + "expected-issue, issue-id=\"scenario::execution-error\", details=\".*Error message happened while executing action.*\"", + # Spurious error that happens racily when tearing down the pipeline + "expected-issue, issue-id=\"runtime::error-on-bus\", details=\".*Stream doesn't contain enough.*\", sometimes=true", + + # Second attempt to play while the first chunk is not available + "expected-issue, issue-id=\"runtime::error-on-bus\", details=\".*Fragment downloading has failed consecutive times.*\"", + "expected-issue, issue-id=\"scenario::execution-error\", details=\".*Error message happened while executing action.*\"", + } + +start-http-server, working-directory="$(test_dir)/../../../medias/defaults/dash/webm/" +set-vars, http_control="$(test_dir)/http_control.py" +set-properties, pb::uri="http://127.0.0.1:$(http_server_port)/output.mpd" + +# Force the HTTP server to return 503 (Service Unavailable) for the first 3 attempts +# to download the DASH manifest (output.mpd). souphttpsrc will retry 3 times by +# default, and then fail. After these 3 failures, we get the +# "First attempt to play while the mpd is not available" expected issues +http-request, uri="http://127.0.0.1:$(http_server_port)/admin/status-rules", method=PUT, headers="application/json", + body="{\"path\": \"/output.mpd\", \"repeat\": 3, \"status_code\": 503}" +play, description="Playing will fail as souphttpsrc::retries=3 by default" + +# 1. Force HTTP 503 errors for the first media segment (chunk-stream0-00001.webm) +# 2. The manifest download will succeed (previous errors cleared) +# 3. dashdemux will start downloading media segments +# 4. The first segment download will fail 3 times (adaptivedemux retry limit) +# 5. Pipeline should fail with "Fragment downloading has failed consecutive times" +http-request, uri="http://127.0.0.1:$(http_server_port)/admin/status-rules", method=PUT, headers="application/json", + body="{\"path\": \"/chunk-stream0-00001.webm\", \"repeat\": 3, \"status_code\": 503}" + +play, description="Playing will fail as adaptivedemux retries max 3 times" + +# Make sure that if download errors happen only twice, either for the manifest or chunks, the pipeline plays +http-request, uri="http://127.0.0.1:$(http_server_port)/admin/status-rules", method=PUT, headers="application/json", + body="{\"path\": \"/output.mpd\", \"repeat\": 2, \"status_code\": 503}" +play, description="Playing now that all errors have been cleared and content is available" +set-state, state=null, playback-time=1.0 + +http-request, uri="http://127.0.0.1:$(http_server_port)/admin/status-rules", method=PUT, headers="application/json", + body="{\"path\": \"/chunk-stream0-00001.webm\", \"repeat\": 2, \"status_code\": 503}" +play, description="Playing now that all errors have been cleared and content is available" +stop, playback-time=1.0