clang optimizations and improved error handling

This commit is contained in:
Maik Jurischka
2025-12-19 07:42:24 +01:00
parent 43c172c03f
commit 108c56ab06
5 changed files with 29 additions and 29 deletions

View File

@@ -74,7 +74,7 @@ bool GStreamerPipeline::start() {
// Set callbacks
std::cout << "[DEBUG] Setting appsrc callbacks..." << std::endl;
GstAppSrcCallbacks callbacks;
GstAppSrcCallbacks callbacks = {};
callbacks.need_data = onNeedData;
callbacks.enough_data = onEnoughData;
callbacks.seek_data = nullptr;
@@ -82,7 +82,7 @@ bool GStreamerPipeline::start() {
// Start the pipeline
std::cout << "[DEBUG] Setting pipeline state to PLAYING..." << std::endl;
GstStateChangeReturn ret = gst_element_set_state(pipeline_, GST_STATE_PLAYING);
const GstStateChangeReturn ret = gst_element_set_state(pipeline_, GST_STATE_PLAYING);
if (ret == GST_STATE_CHANGE_FAILURE) {
std::cerr << "[ERROR] Failed to set pipeline state to PLAYING" << std::endl;
gst_object_unref(appsrc_);
@@ -194,7 +194,7 @@ bool GStreamerPipeline::pushBuffer(const uint8_t* data, const size_t size, const
gst_buffer_unmap(buffer, &map);
// Push buffer to pipeline
GstFlowReturn ret = gst_app_src_push_buffer(GST_APP_SRC(appsrc_), buffer);
const GstFlowReturn ret = gst_app_src_push_buffer(GST_APP_SRC(appsrc_), buffer);
if (ret != GST_FLOW_OK) {
std::cerr << "[ERROR] Failed to push buffer to pipeline, flow return: " << ret << std::endl;
return false;