我已经以gstreamer 链接的例子4为例,并适应于从摄像机接收视频流rtsp。我补充了以下几点:
g_object_set(data->pipeline,"latency",0,NULL);
g_object_set(data->pipeline,"autovideosink", NULL);
g_object_set (data->pipeline, "ring-buffer-max-size", (guint64) 1024 * 50, NULL);在文件教程中的函数gst_native_set_uri -4.c中,以减少视频延迟。我的问题是,当我第一次按“开始”按钮时,必须等待2-3秒才能查看视频流。有办法减少这一次吗?
谢谢
发布于 2022-02-06 20:18:26
您可以尝试在app_function之前添加此回调函数:
static void source_setup (GstElement *pipeline, GstElement *source, void* unused_data) {
gchar* source_path = gst_object_get_path_string(GST_OBJECT_CAST(source));
if (!strcmp(source_path, "/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstRTSPSrc:source")) {
g_object_set(GST_OBJECT_CAST(source), "latency", 0, NULL);
}
g_free(source_path);
}在app_function中,在管道创建之后添加:
g_signal_connect (data->pipeline, "source-setup", G_CALLBACK (source_setup), NULL);当创建源时,如果路径匹配playbin0/uridecodebin0/rtspsrc0 0,则此回调将设置为0。不过,对于更复杂的情况,这一点可能会得到改进。没有用java进行测试。
https://stackoverflow.com/questions/70951635
复制相似问题