How to deal with the issue of green screen when playing RTSP video stream and changing the status to GSTVNet PLAYING, and the screen turns green for one second before starting to play.
/* Build pipeline */
data->pipeline = gst_parse_launch ("playbin3", &error);
if (error) {
gchar *message =
g_strdup_printf ("Unable to build pipeline: %s", error->message);
g_clear_error (&error);
set_ui_message (message, data);
g_free (message);
return NULL;
}
// Add jitterbuffer and other elements
data->jitterbuffer = gst_element_factory_make("rtpjitterbuffer", "jitterbuffer");
if (!data->jitterbuffer) {
GST_ERROR("Failed to create jitterbuffer element.");
g_main_context_pop_thread_default(data->context);
g_main_context_unref(data->context);
return NULL;
}
configure_jitterbuffer(data->jitterbuffer);
gst_bin_add(GST_BIN(data->pipeline), data->jitterbuffer);
gst_element_sync_state_with_parent(data->jitterbuffer);
GstElement *queue = gst_element_factory_make("queue", "queue");
if (!queue) {
GST_ERROR("Failed to create queue element.");
g_main_context_pop_thread_default(data->context);
g_main_context_unref(data->context);
return NULL;
}
g_object_set(queue, "leaky", 1, NULL);
GstElement *video_sink = gst_element_factory_make("glimagesink", "video-sink");
if (!video_sink) {
GST_ERROR("Failed to create video sink element.");
g_main_context_pop_thread_default(data->context);
g_main_context_unref(data->context);
return NULL;
}
g_object_set(video_sink, "sync", FALSE, NULL);
g_object_set(data->pipeline, "video-sink", video_sink, NULL);
g_object_set(data->pipeline, "audio-sink", gst_element_factory_make("fakesink", NULL), NULL);