[xvimagesink] fix deadlock issue 77/37777/1 tizen_3.0.2015.q2_common accepted/tizen/common/20150407.102102 accepted/tizen/mobile/20150408.015834 accepted/tizen/tv/20150407.082606 accepted/tizen/wearable/20150407.063142 submit/tizen/20150406.013932
authorHyunil Park <hyunil46.park@samsung.com>
Mon, 6 Apr 2015 01:16:25 +0000 (10:16 +0900)
committerHyunil Park <hyunil46.park@samsung.com>
Mon, 6 Apr 2015 01:16:25 +0000 (10:16 +0900)
Change-Id: I6dfbe63e77da8519274a26bc44f75f9094ba0313
Signed-off-by: Hyunil Park <hyunil46.park@samsung.com>
packaging/gst-plugins-base.spec
sys/xvimage/xv_types.h [changed mode: 0644->0755]
sys/xvimage/xvcontext.c [changed mode: 0644->0755]
sys/xvimage/xvimageallocator.c [changed mode: 0644->0755]
sys/xvimage/xvimagesink.c

index 8161444..e052f13 100644 (file)
@@ -4,7 +4,7 @@
 
 Name:           gst-plugins-base
 Version:        1.4.1
-Release:        4
+Release:        5
 License:        LGPL-2.1+ and GPL-2.0+
 Summary:        GStreamer Streaming-Media Framework Plug-Ins
 Url:            http://gstreamer.freedesktop.org/
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index 6d06994..0dc34ab
@@ -458,7 +458,8 @@ gst_xvimage_allocator_alloc (GstXvImageAllocator * allocator, gint im_format,
           "unexpected XShm image size (got %d, expected %d)",
           mem->xvimage->data_size, expected_size);
     }
-
+    GST_INFO("expected XShm image size (got %d, expected %d)",
+          mem->xvimage->data_size, expected_size);
     /* Be verbose about our XvImage stride */
     {
       guint plane;
@@ -709,15 +710,13 @@ gst_xvimage_memory_render (GstXvImageMemory * mem, GstVideoRectangle * src_crop,
     GST_WARNING("putimage error : ret %d, error_caught %d, displaying buffer count %d",
                 ret, error_caught, context->displaying_buffer_count);
 
-  /* release gem handle */
-  img_data = (XV_DATA_PTR) gst_xvimage_memory_get_xvimage(mem)->data;
-  if (img_data && img_data->BufType == XV_BUF_TYPE_DMABUF) {
+    /* release gem handle */
+    img_data = (XV_DATA_PTR) gst_xvimage_memory_get_xvimage(mem)->data;
     unsigned int gem_name[XV_BUF_PLANE_NUM] = { 0, };
     gem_name[0] = img_data->YBuf;
     gem_name[1] = img_data->CbBuf;
     gem_name[2] = img_data->CrBuf;
     gst_xvcontext_remove_displaying_buffer(context, gem_name);
-     }
   }
 
   /* Reset error handler */
index 44b76bb..91e025f 100755 (executable)
@@ -518,7 +518,7 @@ gst_xvimagesink_pixmap_render(GstXvImageMemory * mem, GstVideoRectangle * src_in
 
     /* release gem handle */
        img_data = (XV_DATA_PTR) gst_xvimage_memory_get_xvimage(mem)->data;
-       if (img_data && img_data->BufType == XV_BUF_TYPE_DMABUF) {
+       if (img_data) {
          unsigned int gem_name[XV_BUF_PLANE_NUM] = { 0, };
          gem_name[0] = img_data->YBuf;
          gem_name[1] = img_data->CbBuf;
@@ -1317,7 +1317,10 @@ gst_xvimagesink_handle_xevents (GstXvImageSink * xvimagesink)
           gem_name[0] = cme->data.l[0];
           gem_name[1] = cme->data.l[1];
 
+                 g_mutex_unlock (&xvimagesink->context->lock);
           gst_xvcontext_remove_displaying_buffer(xvimagesink->context, gem_name);
+                 g_mutex_lock (&xvimagesink->context->lock);
+
           break;
         }
 #endif /* GST_EXT_XV_ENHANCEMENT */
@@ -1480,7 +1483,7 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
   gst_xvcontext_set_colorimetry (context, &info.colorimetry);
 
   size = info.size;
-
+  GST_INFO ("info.size = %d ",size);
   /* get aspect ratio from caps if it's present, and
    * convert video width and height to a display width and height
    * using wd / hd = wv / hv * PARv / PARd */
@@ -1783,6 +1786,7 @@ gst_xvimagesink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
     GST_CAT_LOG_OBJECT (GST_CAT_PERFORMANCE, xvimagesink,
         "slow copy buffer %p into bufferpool buffer %p", buf, to_put);
 #ifdef GST_EXT_XV_ENHANCEMENT
+    g_mutex_lock (&xvimagesink->flow_lock);
     switch (GST_VIDEO_INFO_FORMAT(&xvimagesink->info)) {
       /* Cases for specified formats of Samsung extension */
      case GST_VIDEO_FORMAT_SN12:
@@ -1861,8 +1865,7 @@ gst_xvimagesink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
            }
            /* set current buffer */
            gst_xvimage_memory_set_buffer((GstXvImageMemory*)gst_buffer_peek_memory(to_put, 0), buf);
-
-         if (img_data && img_data->BufType == XV_BUF_TYPE_DMABUF)
+           if (img_data)
              gst_xvcontext_add_displaying_buffer(xvimagesink->context, img_data, gst_xvimage_memory_get_buffer(img_mem));
 
         } else {
@@ -1874,6 +1877,7 @@ gst_xvimagesink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
 
        } else {
           GST_WARNING_OBJECT( xvimagesink, "xvimage->data is NULL. skip xvimage put..." );
+          g_mutex_lock (&xvimagesink->flow_lock);
           return GST_FLOW_OK;
         }
         break;
@@ -1896,10 +1900,10 @@ gst_xvimagesink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
         break;
       }
     }
+       g_mutex_unlock (&xvimagesink->flow_lock);
 #else /* GST_EXT_XV_ENHANCEMENT */
     if (!gst_video_frame_map (&src, &xvimagesink->info, buf, GST_MAP_READ))
       goto invalid_buffer;
-
     if (!gst_video_frame_map (&dest, &xvimagesink->info, to_put, GST_MAP_WRITE)) {
       gst_video_frame_unmap (&src);
       goto invalid_buffer;
@@ -1942,6 +1946,9 @@ invalid_buffer:
   {
     /* No Window available to put our image into */
     GST_WARNING_OBJECT (xvimagesink, "could not map image");
+#ifdef GST_EXT_XV_ENHANCEMENT
+         g_mutex_unlock (&xvimagesink->flow_lock);
+#endif
     res = GST_FLOW_OK;
     goto done;
   }