gst-plugins-good:moved into main for pisi 2.0
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
From 4cd9255f0a8a9e15d81561f00f02d275b5095f70 Mon Sep 17 00:00:00 2001
|
||||
From: Oleksij Rempel (Alexey Fisher) <bug-track@fisher-privat.net>
|
||||
Date: Thu, 01 Mar 2012 13:15:29 +0000
|
||||
Subject: v4l2src: fix v4l2_munmap() for compressed formats
|
||||
|
||||
Make sure we always call munmap() with the same size we called mmap()
|
||||
with before.
|
||||
|
||||
Current v4l2src uses the same structure for VIDIOC_QUERYBUF, VIDIOC_QBUF
|
||||
and v4l2_munmap calls. The problem is that the video buffer size (length)
|
||||
may vary for compressed or emulated bufs. VIDIOC_QBUF will change it if
|
||||
we pass the pointer of a v4l2_buffer. This is why we should avoid using
|
||||
same variable for mmap and video buffers.
|
||||
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=671126
|
||||
---
|
||||
(limited to 'sys/v4l2')
|
||||
|
||||
diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c
|
||||
index b81c6a4..51419ff 100644
|
||||
--- a/sys/v4l2/gstv4l2bufferpool.c
|
||||
+++ b/sys/v4l2/gstv4l2bufferpool.c
|
||||
@@ -106,9 +106,9 @@ gst_v4l2_buffer_finalize (GstV4l2Buffer * buffer)
|
||||
if (!resuscitated) {
|
||||
GST_LOG_OBJECT (pool->v4l2elem,
|
||||
"buffer %p (data %p, len %u) not recovered, unmapping",
|
||||
- buffer, GST_BUFFER_DATA (buffer), buffer->vbuffer.length);
|
||||
+ buffer, GST_BUFFER_DATA (buffer), buffer->mmap_length);
|
||||
gst_mini_object_unref (GST_MINI_OBJECT (pool));
|
||||
- v4l2_munmap ((void *) GST_BUFFER_DATA (buffer), buffer->vbuffer.length);
|
||||
+ v4l2_munmap ((void *) GST_BUFFER_DATA (buffer), buffer->mmap_length);
|
||||
|
||||
GST_MINI_OBJECT_CLASS (v4l2buffer_parent_class)->finalize (GST_MINI_OBJECT
|
||||
(buffer));
|
||||
@@ -183,6 +183,7 @@ gst_v4l2_buffer_new (GstV4l2BufferPool * pool, guint index, GstCaps * caps)
|
||||
GST_LOG_OBJECT (pool->v4l2elem, " length: %u", ret->vbuffer.length);
|
||||
GST_LOG_OBJECT (pool->v4l2elem, " input: %u", ret->vbuffer.input);
|
||||
|
||||
+ ret->mmap_length = ret->vbuffer.length;
|
||||
data = (guint8 *) v4l2_mmap (0, ret->vbuffer.length,
|
||||
PROT_READ | PROT_WRITE, MAP_SHARED, pool->video_fd,
|
||||
ret->vbuffer.m.offset);
|
||||
diff --git a/sys/v4l2/gstv4l2bufferpool.h b/sys/v4l2/gstv4l2bufferpool.h
|
||||
index caad9ac..36ea323 100644
|
||||
--- a/sys/v4l2/gstv4l2bufferpool.h
|
||||
+++ b/sys/v4l2/gstv4l2bufferpool.h
|
||||
@@ -70,6 +70,9 @@ struct _GstV4l2Buffer {
|
||||
GstBuffer buffer;
|
||||
|
||||
struct v4l2_buffer vbuffer;
|
||||
+ /* warning: the size of mmap buffer and
|
||||
+ * the actual frame-buffer can be different. */
|
||||
+ size_t mmap_length;
|
||||
|
||||
/* FIXME: have GstV4l2Src* instead, as this has GstV4l2BufferPool* */
|
||||
/* FIXME: do we really want to fix this if GstV4l2Buffer/Pool is shared
|
||||
--
|
||||
cgit v0.9.0.2-2-gbebe
|
||||
Reference in New Issue
Block a user