c - Gstreamer 过滤器错误导致 GST_FLOW_FLUSHING
问题描述
我正在尝试使用一个appsink,它设置为一个视频文件的uri(h264视频文件,宽度= 720,高度= 480,帧率= 30/1),将视频缓冲区传递给另一个位于GstRTSPServer管道下的appsrc在 C/C++ 中,通过 apprc 发出的需要数据信号回调。这是我设想的计算机架构
[![在此处输入图像描述][1]][1]
需求数据回调如下
static void
need_data (GstElement *appsrc, guint unused, Context *ctx)
{
GstFlowReturn ret;
GstSample *sample = gst_app_sink_pull_sample (GST_APP_SINK(ctx->glblapp->videosink));
if (sample != NULL) {
GstBuffer *buffer = gst_sample_get_buffer(sample);
// increment the timestamp every 1/30 second
GST_BUFFER_PTS(buffer) = ctx->timestamp;
GST_BUFFER_DURATION (buffer) = gst_util_uint64_scale_int (1, GST_SECOND, 30);
ctx->timestamp += GST_BUFFER_DURATION (buffer);
g_signal_emit_by_name(appsrc, "push-buffer", buffer, &ret);
counter++;
g_print("Value of counter: %d \n", counter);
if (ret != GST_FLOW_OK) {
// something wrong, stop pushing
g_printerr("push-buffer: GST_FLOW != OK, return value is %d\n", ret);
g_main_loop_quit (loop);
}
}
}
对于我的appsrc,我已将其设置为
gst_rtsp_media_factory_set_launch (factory,
"( appsrc name=src0 ! h264parse ! rtph264pay name=pay0 pt=96 )");
当我在 CLI 中输入以下命令时,该应用程序似乎无法显示任何视频
gst-launch-1.0 rtspsrc location=rtsp://192.168.x.x:8554/test latency=600 ! decodebin ! autovideosink
需要数据命令循环似乎在一定程度上起作用。我有一个计数器来跟踪它被调用了多少次......应用程序似乎总是在 600 次左右失败,并且返回错误是 -2 或 GST_FLOW_FLUSHING(这表明 Pad 正在冲洗)
所以我想知道我的 RTSP 服务器启动过滤器错误吗?还是有其他原因?需要一些启示
解决方案
推荐阅读
- python - 来自熊猫数据框的有序字典
- javascript - 是否(现在)可以使用 window.print() 打印多个副本
- date - 如何从 Civil.Datetime 中获取 time.Time
- .net - 如何为网络服务器上的 signalR 集线器提供控制台应用程序(本地系统)身份验证
- ios - 在 UIAlertController 下获取最顶层的视图控制器
- angular - 可观察的
不工作 - cloudflare - 按美国各州屏蔽用户
- haskell - 在列表中存储类型字段
- r - 根据第二个数据框中的日期范围对数据框中的数据进行分组在R中
- javascript - 将输入值检索到 formData 对象中的问题