【问题标题】:running Gstreamer video embedded in GTK window under Weston在 Weston 下运行嵌入在 GTK 窗口中的 Gstreamer 视频
【发布时间】:2019-09-08 20:34:08
【问题描述】:

我正在测试 Gstreamer Waylandsink 示例,这是一个嵌入在 Weston 之上运行的 GTK 窗口中的 Gstreamer 测试视频: https://github.com/GStreamer/gst-plugins-bad/tree/master/tests/examples/waylandsink

更多关于我的问题的描述还有回溯: http://gstreamer-devel.966125.n4.nabble.com/Waylandsink-segmentation-fault-td4691887.html http://gstreamer-devel.966125.n4.nabble.com/GstVideoOverlay-td4691869.html http://gstreamer-devel.966125.n4.nabble.com/gst-video-overlay-set-render-rectangle-td4691801.html

窗口正确打开并正在运行视频示例,但在按钮上 点击(按钮NULL),我想擦除我创建的视频渲染区域。根据 gst_video_overlay_set_render_rectangle 方法的文档,它应该关闭渲染区域: https://gstreamer.freedesktop.org/documentation/video/gstvideooverlay.html?gi-language=c

因此我添加了这段代码:

null_clicked_cb (GtkButton * button, DemoApp * d)
    {
    GtkAllocation allocation;
      gtk_widget_get_allocation(d->video_widget,&allocation);
      GstWaylandSink *sink = GST_WAYLAND_SINK (d->overlay);
      GstVideoOverlay* overlay;
      overlay = d->overlay;
      gst_video_overlay_set_render_rectangle (overlay, allocation.x,allocation.y, -1, -1);        
}

我正在使用以下值提供方法:x 26 y 60 width -1 height -1 在 Weston 下,我随机遇到了以下错误之一: Gdk 消息:从​​显示器读取事件时出错:协议错误 Gdk 消息:错误 32(断管)发送到 Wayland 显示器 gdk-message:错误刷新显示

我在 Wayland Gnome shell 中遇到了这个错误:

0:00:02.355175744 25457 0x5641c5dd4150 ERROR               fdmemory
gstfdmemory.c:127:gst_fd_mem_map: 0x7f9edc00b680: fd 17: mmap failed: Cannot
allocate memory
0:00:02.355213222 25457 0x5641c5dd4150 ERROR            waylandsink
wlshmallocator.c:78:gst_wl_shm_allocator_alloc:<wlshmallocator0> GstFdMemory
map failed
0:00:02.355238267 25457 0x5641c5dd4150 WARN              GST_BUFFER
gstbuffer.c:907:gst_buffer_new_allocate: failed to allocate
5680698421285089536 bytes

(waylandexample:25457): GStreamer-CRITICAL **: 22:03:17.493:
gst_buffer_memset: assertion 'GST_IS_BUFFER (buffer)' failed

(waylandexample:25457): GStreamer-CRITICAL **: 22:03:17.493:
gst_buffer_peek_memory: assertion 'GST_IS_BUFFER (buffer)' failed

有人知道问题出在哪里吗?

谢谢

【问题讨论】:

    标签: c linux gtk gstreamer wayland


    【解决方案1】:

    我终于设法摆脱了使用方法时弹出的错误消息: gst_video_overlay_set_render_rectangle() 它仅在使用 playbin 和 sink waylandsink 时有效,如果我将管道与 videotestsrc 一起使用,它会在此方法处停止,从而产生之前提到的错误。 不幸的是,即使我认为我清除了所有渲染子窗口,清除了单个视频的屏幕以全屏渲染(实际上是“全屏”作为视频,但黑色子窗口的问题(导致仅部分渲染全屏视频)仍然存在在单个 GTK 窗口中运行) 我假设在剩余的三个窗口句柄上调用 gst_video_overlay_set_render_rectangle() 将清除该区域不幸的是黑色矩形随机保留在渲染其他视频的某些区域上。 我将整个按钮单击方法与我在 cmets 中隐藏(清除、禁用或我应该如何命名)的所有尝试封装在一起。

    static void button_press_event(GtkWidget *widget, GdkEventButton *event, DemoApp * d) {
    
    if (destroy == FALSE) {
       gtk_widget_get_allocation(d->video_widget1, &allocation);
        GstStateChangeReturn state;
        //state = gst_element_set_state(d->pipeline0, GST_STATE_NULL);
        //g_print("pipeline state:%d\r\n", state);
        state = gst_element_set_state(d->pipeline1, GST_STATE_NULL);
        g_print("pipeline state:%d\r\n", state);
        state = gst_element_set_state(d->pipeline2, GST_STATE_NULL);
        g_print("pipeline state:%d\r\n", state);
        state = gst_element_set_state(d->pipeline3, GST_STATE_NULL);
        g_print("pipeline state:%d\r\n", state);
       /*
        gboolean result = gst_video_overlay_set_render_rectangle(d->overlay1, -1,
                -1, -1, -1);
         */
        gboolean result = FALSE;
    
        gtk_widget_get_allocation(d->video_widget0, &allocation);
    
        result = gst_video_overlay_set_render_rectangle(d->overlay0, allocation.x,
                allocation.y, -1, -1);
        g_print("x=%d,y=%d,width=%d,height=%d, result=%d\r\n", allocation.x, allocation.y, allocation.width, allocation.height, result);
    
        gtk_widget_get_allocation(d->video_widget1, &allocation);
        result = FALSE;
        result = gst_video_overlay_set_render_rectangle(d->overlay1, allocation.x,
                allocation.y, -1, -1);
        g_print("x=%d,y=%d,width=%d,height=%d, result=%d\r\n", allocation.x, allocation.y, allocation.width, allocation.height, result);
       // gst_object_unref(d->overlay1);
    
        gtk_widget_get_allocation(d->video_widget2, &allocation);
        result = FALSE;
        result = gst_video_overlay_set_render_rectangle(d->overlay2, allocation.x,
                allocation.y, -1, -1);
        g_print("x=%d,y=%d,width=%d,height=%d, result=%d\r\n", allocation.x, allocation.y, allocation.width, allocation.height, result);
        //gst_object_unref(d->overlay2);
    
    
        gtk_widget_get_allocation(d->video_widget3, &allocation);
        result = FALSE;
        result = gst_video_overlay_set_render_rectangle(d->overlay3, allocation.x,
                allocation.y, -1, -1);
        g_print("x=%d,y=%d,width=%d,height=%d, result=%d\r\n", allocation.x, allocation.y, allocation.width, allocation.height, result);
        //gst_object_unref(d->overlay3);
        /*
                gst_video_overlay_expose(d->overlay0);
                gst_video_overlay_expose(d->overlay1);
                gst_video_overlay_expose(d->overlay2);
                gst_video_overlay_expose(d->overlay3);
         */
        /*
        gst_video_overlay_set_window_handle(d->overlay1, (guintptr) 0);
        gst_video_overlay_set_window_handle(d->overlay2, (guintptr) 0);
        gst_video_overlay_set_window_handle(d->overlay2, (guintptr) 0);
         */
        gtk_widget_set_visible(d->video_widget1, FALSE);
        gtk_widget_set_visible(d->video_widget2, FALSE);
        gtk_widget_set_visible(d->video_widget3, FALSE);
    
        //gst_video_overlay_expose(d->overlay1);
    
        //g_print("result=%d\r\n", result);
        int width = gtk_widget_get_allocated_width(d->videoElementsGrid);
        int height = gtk_widget_get_allocated_height(d->videoElementsGrid);
        gtk_widget_set_size_request(d->video_widget0, width, height);
        gtk_widget_get_allocation(d->video_widget0, &allocation);
        struct wl_surface *window_handle = gdk_wayland_window_get_wl_surface(gtk_widget_get_window(d->video_widget0));
        wl_surface_damage_buffer(window_handle,allocation.x,allocation.y,width,height);
        //gst_element_set_state(d->pipeline0, GST_STATE_PLAYING);
        destroy = TRUE;
    } else {
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-02
      相关资源
      最近更新 更多