Check playing pipeline method2
This commit is contained in:
parent
3f50111715
commit
0969be1226
@ -155,7 +155,7 @@ void PipelineManager::get_fps_buffer_probe() {
|
||||
gst_object_unref(sink_pad);
|
||||
}
|
||||
|
||||
void PipelineManager::playing_pipeline(int num_sources, char** url_camera) {
|
||||
bool PipelineManager::playing_pipeline(int num_sources, char** url_camera) {
|
||||
/* Set the pipeline to "playing" state */
|
||||
|
||||
g_print("Now playing... \n");
|
||||
@ -167,18 +167,28 @@ void PipelineManager::playing_pipeline(int num_sources, char** url_camera) {
|
||||
GST_DEBUG_GRAPH_SHOW_ALL,
|
||||
sink_manager->output_sink.c_str());
|
||||
gst_element_set_state(pipeline, GST_STATE_PLAYING);
|
||||
GstStateChangeReturn ret =
|
||||
gst_element_set_state(pipeline, GST_STATE_PLAYING);
|
||||
if(ret == GST_STATE_CHANGE_FAILURE) {
|
||||
g_printerr("Unable to set pipeline to playing.\n");
|
||||
gst_object_unref(pipeline);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void PipelineManager::check_playing_pipeline() {
|
||||
bool PipelineManager::check_playing_pipeline() {
|
||||
// Verify pipeline state (add this immediately after starting)
|
||||
GstState state;
|
||||
GstStateChangeReturn ret =
|
||||
gst_element_get_state(pipeline, &state, NULL, GST_CLOCK_TIME_NONE);
|
||||
if (ret == GST_STATE_CHANGE_FAILURE) {
|
||||
g_printerr("Failed to start pipeline!\n");
|
||||
return false;
|
||||
} else {
|
||||
g_print("Pipeline state: %d (1=NULL, 2=READY, 3=PAUSED, 4=PLAYING)\n",
|
||||
state);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -312,9 +322,15 @@ bool PipelineManager::create_pipeline_elements(int num_sources,
|
||||
get_fps_buffer_probe();
|
||||
get_fps_probe();
|
||||
get_fps_osd();
|
||||
playing_pipeline(num_sources, url_camera);
|
||||
status_playing = playing_pipeline(num_sources, url_camera);
|
||||
if (status_playing == false) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
check_playing_pipeline();
|
||||
status_playing = check_playing_pipeline();
|
||||
if (status_playing == false) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
rtsp_streaming_manager->start_rtsp_streaming();
|
||||
|
||||
|
||||
@ -47,7 +47,8 @@ class PipelineManager {
|
||||
int create_pipeline();
|
||||
bool create_pipeline_elements(int, char **);
|
||||
bool setup_pipeline();
|
||||
void playing_pipeline(int, char **);
|
||||
bool playing_pipeline(int, char **);
|
||||
bool status_playing;
|
||||
void set_cuda_device();
|
||||
static guint64 frame_count_osd_sink;
|
||||
static guint64 frame_count_fps_probe;
|
||||
@ -69,6 +70,6 @@ class PipelineManager {
|
||||
void get_fps_buffer_probe();
|
||||
void get_fps_probe();
|
||||
void get_fps_osd();
|
||||
void check_playing_pipeline();
|
||||
bool check_playing_pipeline();
|
||||
~PipelineManager();
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user