Skip to content

Commit

Permalink
Check return value of gstreamer_init
Browse files Browse the repository at this point in the history
  • Loading branch information
sirknightj committed Aug 22, 2023
1 parent 7842b4c commit 8df715a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 8 additions & 2 deletions samples/kvs_gstreamer_sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,10 @@ int main(int argc, char* argv[]) {
LOG_DEBUG("Attempt to upload file: " << data.file_list[i].path);

// control will return after gstreamer_init after file eos or any GST_ERROR was put on the bus.
gstreamer_init(argc, argv, &data);
if (gstreamer_init(argc, argv, &data) != 0) {
LOG_ERROR("Failed to initialize gstreamer");
return 1;
}

// check if any stream error occurred.
stream_status = data.stream_status.load();
Expand Down Expand Up @@ -1208,7 +1211,10 @@ int main(int argc, char* argv[]) {

} else {
// non file uploading scenario
gstreamer_init(argc, argv, &data);
if (gstreamer_init(argc, argv, &data) != 0) {
LOG_ERROR("Failed to initialize gstreamer");
return 1;
}
if (STATUS_SUCCEEDED(stream_status)) {
// if stream_status is success after eos, send out remaining frames.
data.kinesis_video_stream->stopSync();
Expand Down
8 changes: 6 additions & 2 deletions samples/kvssink_gstreamer_sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,9 @@ int main(int argc, char *argv[]) {
LOG_DEBUG("Attempt to upload file: " << data_global.file_list[i].path);

// control will return after gstreamer_init after file eos or any GST_ERROR was put on the bus.
gstreamer_init(argc, argv, &data_global);
if (gstreamer_init(argc, argv, &data_global) != 0) {
return 1;
}

// check if any stream error occurred.
stream_status = data_global.stream_status.load();
Expand Down Expand Up @@ -860,7 +862,9 @@ int main(int argc, char *argv[]) {

} else {
// non file uploading scenario
gstreamer_init(argc, argv, &data_global);
if (gstreamer_init(argc, argv, &data_global) != 0) {
return 1;
}
stream_status = data_global.stream_status.load();
if (STATUS_SUCCEEDED(stream_status)) {
LOG_INFO("Stream succeeded");
Expand Down

0 comments on commit 8df715a

Please sign in to comment.