Skip to content

Commit 4642d85

Browse files
committed
Set sample args in the CI, improve logging
1 parent eeba042 commit 4642d85

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

.github/workflows/samples.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ jobs:
5959
- name: kvssink_gstreamer_sample
6060
args: sample.mp4
6161
- name: kvssink_intermittent_sample # There is no file source option for this sample (will use gst videotestsrc).
62+
args: DEFAULT_STREAM testsrc 120 # <stream_name> <gst-videotestsrc> <sample_duration_seconds>
6263
runner:
6364
- id: macos-13
6465
image: macos-13
@@ -435,6 +436,7 @@ jobs:
435436
- name: kvssink_gstreamer_sample
436437
args: sample.mp4
437438
- name: kvssink_intermittent_sample # There is no file source option for this sample (will use gst videotestsrc).
439+
args: DEFAULT_STREAM testsrc 120 # <stream_name> <gst-videotestsrc> <sample_duration_seconds>
438440
image:
439441
- Ubuntu-22.04
440442
- Ubuntu-24.04

samples/kvssink_intermittent_sample.cpp

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ void sigint_handler(int sigint) {
5353
}
5454
}
5555

56+
bool check_element(GstElement* element, const char* name) {
57+
if (!element) {
58+
LOG_ERROR("[KVS sample] Failed to create element: " << name);
59+
return false;
60+
}
61+
return true;
62+
}
63+
5664
static gboolean bus_call(GstBus *bus, GstMessage *msg, gpointer data) {
5765
GMainLoop *loop = (GMainLoop *) ((CustomData *)data)->main_loop;
5866
GstElement *pipeline = (GstElement *) ((CustomData *)data)->pipeline;
@@ -280,17 +288,17 @@ int main(int argc, char *argv[]) {
280288

281289

282290
/* Check that GStreamer elements were all successfully created */
283-
284-
if (!kvssink) {
285-
LOG_ERROR("[KVS sample] Failed to create kvssink element");
291+
if (!check_element(pipeline, "pipeline") ||
292+
!check_element(source, "source") ||
293+
!check_element(clock_overlay, "clock_overlay") ||
294+
!check_element(video_convert, "video_convert") ||
295+
!check_element(source_filter, "source_filter") ||
296+
!check_element(encoder, "encoder") ||
297+
!check_element(sink_filter, "sink_filter") ||
298+
!check_element(kvssink, "kvssink")) {
286299
return -1;
287300
}
288-
289-
if (!pipeline || !source || !clock_overlay || !video_convert || !source_filter || !encoder || !sink_filter) {
290-
LOG_ERROR("[KVS sample] Not all GStreamer elements could be created.");
291-
return -1;
292-
}
293-
301+
294302
// Populate data struct.
295303
customData.main_loop = main_loop;
296304
customData.pipeline = pipeline;

0 commit comments

Comments
 (0)