首页 > 解决方案 > 使用 Gstreamer 与 Protobuf 版本冲突

问题描述

我有一个奇怪的问题

我正在安装protoc 3.6.1的 VM 上编译应用程序。然后它构建了一个 zip 文件,我将其 scp 到另一台机器上,我在其中解压缩并运行它。

我在该机器上运行的所有命令都不需要使用协议缓冲区。

     loop = g_main_loop_new( NULL, FALSE );
     gst_init(NULL, NULL);
     snprintf( str_pipeline, sizeof( str_pipeline ), "appsrc name=mysource ! videoconvert ! " "video/x-raw,width=1920,height=1080,format=NV12 ! vaapih264enc ! h264parse ! rtph264pay ! " "udpsink host=%s port=5600", "xxx.xx.xx.xxx");

    // Instruct GStreamer to construct the pipeline 
    pipeline = gst_parse_launch( str_pipeline, &gerror );

    if( !pipeline )
    {
       printf( "gst_parse_launch error. Cannot launch GStreamer..: %s\n", gerror->message );

      return false;
    }

    appsrc = gst_bin_get_by_name( GST_BIN( pipeline ), "mysource" );
    app_caps = gst_caps_new_simple( "video/x-raw", "format", G_TYPE_STRING, "RGB", "width", G_TYPE_INT, WIDTH, "height", G_TYPE_INT, HEIGHT, NULL );

但是,当我运行上面的代码 gstreamer 命令(特别是 gst_parse_launch() )时,这给了我这个错误 -

[libprotobuf FATAL google/protobuf/stubs/common.cc:79] This program was compiled against version 2.6.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.6.1).  Contact the program author for an update.  If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library.  (Version verification failed in "/build/mir-O8_xaj/mir-0.26.3+16.04.20170605/obj-x86_64-linux-gnu/src/protobuf/mir_protobuf.pb.cc".)

我认为 gstreamer 与 protoc 没有任何关系,但我想确认一下。gstreamer 1.0 是用 protoc 2.6.1 编译的吗?

如果不是这种情况,为什么我在解压缩的 VM 上会出现此错误?它没有安装 protoc 并且正在运行 Ubuntu 16.04。

标签: ubuntuprotocol-buffersgstreamerprotoc

解决方案


正如你所说,我可以看到,这里没有使用 protobuf。

在这种情况下,我怀疑的第一件事是你的一些随机文件指向你机器上的一些protobuf 文件,而编译。(我不知道为什么)。在这里安全的做法是卸载 protoc(所有版本)。您可以根据您的操作系统选择如何卸载。

然后尝试再次编译它。也许这可能会告诉我们一些通往天堂的道路:P

编辑1:

我已经在我的系统上尝试过这个(我已经安装了 gstreamer 和 protobuf 和 grpc)

str_pipeline ="audiotestsrc ! audioconvert ! autoaudiosink";

cout << str_pipeline << endl;

// Instruct GStreamer to construct the pipeline
pipeline = gst_parse_launch(static_cast<const gchar*>(str_pipeline), &gerror);

if (!pipeline) {
    printf("gst_parse_launch error. Cannot launch GStreamer..: %s\n",
            gerror->message);

    return false;
}

而且我没有遇到与您相同的错误。(也许你可以试试这个)

我得到的错误是:

GStreamer-CRITICAL **: gst_parse_launch_full: assertion 'error == NULL || *error == NULL' failed

推荐阅读