waylandsink: Rollback video info changes when copying
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Thu, 23 Nov 2017 03:27:04 +0000 (22:27 -0500)
committerNicolas Dufresne <nicolas.dufresne@collabora.com>
Sat, 25 Nov 2017 19:59:03 +0000 (14:59 -0500)
We change the video info base on the received buffer. We need to
rollback these changes whenever we want to copy into our internal
pool of buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=790057

ext/wayland/gstwaylandsink.c

index e02b0cc..dd40bd1 100644 (file)
@@ -631,6 +631,7 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer)
   GstWlBuffer *wlbuffer;
   GstVideoMeta *vmeta;
   GstVideoFormat format;
+  GstVideoInfo old_vinfo;
   GstMemory *mem;
   struct wl_buffer *wbuf = NULL;
 
@@ -676,6 +677,7 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer)
   /* update video info from video meta */
   mem = gst_buffer_peek_memory (buffer, 0);
 
+  old_vinfo = sink->video_info;
   vmeta = gst_buffer_get_video_meta (buffer);
   if (vmeta) {
     gint i;
@@ -713,6 +715,9 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer)
       GstVideoFrame src, dst;
       GstVideoInfo src_info = sink->video_info;
 
+      /* rollback video info changes */
+      sink->video_info = old_vinfo;
+
       /* we don't know how to create a wl_buffer directly from the provided
        * memory, so we have to copy the data to shm memory that we know how
        * to handle... */