Remove fps buffer probe
This commit is contained in:
parent
a6efa389f0
commit
6126025eac
@ -141,42 +141,6 @@ void PipelineManager::check_playing_pipeline() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GstPadProbeReturn PipelineManager::buffer_probe(GstPad* pad,
|
|
||||||
GstPadProbeInfo* info,
|
|
||||||
gpointer user_data) {
|
|
||||||
(void)pad; // This explicitly marks it as unused
|
|
||||||
(void)info; // This explicitly marks it as unused
|
|
||||||
(void)user_data; // This explicitly marks it as unused
|
|
||||||
static guint64 frame_count = 0;
|
|
||||||
static auto last_time = std::chrono::steady_clock::now();
|
|
||||||
|
|
||||||
GstBuffer* buffer = GST_PAD_PROBE_INFO_BUFFER(info);
|
|
||||||
NvDsBatchMeta* batch_meta = gst_buffer_get_nvds_batch_meta(buffer);
|
|
||||||
|
|
||||||
if (batch_meta) {
|
|
||||||
for (NvDsMetaList* l = batch_meta->frame_meta_list; l != NULL;
|
|
||||||
l = l->next) {
|
|
||||||
NvDsFrameMeta* frame_meta = (NvDsFrameMeta*)l->data;
|
|
||||||
(void)frame_meta; // This explicitly marks it as unused
|
|
||||||
frame_count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate FPS
|
|
||||||
auto now = std::chrono::steady_clock::now();
|
|
||||||
auto elapsed =
|
|
||||||
std::chrono::duration_cast<std::chrono::milliseconds>(now - last_time)
|
|
||||||
.count();
|
|
||||||
|
|
||||||
if (elapsed >= 1000) {
|
|
||||||
g_print("FPS: %.2f\n", (double)frame_count * 1000 / elapsed);
|
|
||||||
frame_count = 0;
|
|
||||||
last_time = now;
|
|
||||||
}
|
|
||||||
|
|
||||||
return GST_PAD_PROBE_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PipelineManager::setup_pipeline() {
|
bool PipelineManager::setup_pipeline() {
|
||||||
/* Set up the pipeline */
|
/* Set up the pipeline */
|
||||||
/* add all elements into the pipeline */
|
/* add all elements into the pipeline */
|
||||||
@ -304,13 +268,6 @@ bool PipelineManager::create_pipeline_elements(int num_sources,
|
|||||||
message_handling->create_message_handler(pipeline, g_run_forever, loop);
|
message_handling->create_message_handler(pipeline, g_run_forever, loop);
|
||||||
setup_pipeline();
|
setup_pipeline();
|
||||||
|
|
||||||
// --- BUFFER PROBE FOR FPS ---
|
|
||||||
GstPad* sink_pad = gst_element_get_static_pad(
|
|
||||||
nv_video_convert_manager->nvvidconv, "src"); // Or any element's pad
|
|
||||||
gst_pad_add_probe(sink_pad, GST_PAD_PROBE_TYPE_BUFFER, buffer_probe, NULL,
|
|
||||||
NULL);
|
|
||||||
gst_object_unref(sink_pad);
|
|
||||||
|
|
||||||
get_fps();
|
get_fps();
|
||||||
get_fps_osd();
|
get_fps_osd();
|
||||||
playing_pipeline(num_sources, url_camera);
|
playing_pipeline(num_sources, url_camera);
|
||||||
|
|||||||
@ -49,8 +49,6 @@ class PipelineManager {
|
|||||||
bool setup_pipeline();
|
bool setup_pipeline();
|
||||||
void playing_pipeline(int, char **);
|
void playing_pipeline(int, char **);
|
||||||
void set_cuda_device();
|
void set_cuda_device();
|
||||||
static GstPadProbeReturn buffer_probe(GstPad *, GstPadProbeInfo *,
|
|
||||||
gpointer);
|
|
||||||
static gboolean event_thread_func(gpointer);
|
static gboolean event_thread_func(gpointer);
|
||||||
static gboolean check_pipeline_state(gpointer);
|
static gboolean check_pipeline_state(gpointer);
|
||||||
static GstPadProbeReturn fps_probe(GstPad *, GstPadProbeInfo *, gpointer);
|
static GstPadProbeReturn fps_probe(GstPad *, GstPadProbeInfo *, gpointer);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user