dataurisrc: Remove unnecessary else if condition
authorVineeth T M <vineeth.tm@samsung.com>
Thu, 4 Sep 2014 08:08:21 +0000 (13:38 +0530)
committerSebastian Dröge <sebastian@centricular.com>
Thu, 4 Sep 2014 08:31:56 +0000 (11:31 +0300)
In gst_data_uri_src_create(), buf cannot be NULL, hence
else if (*buf != NULL) will be invalid so removing the
else if condition and adding a check to unreference buf
in else condition, just in case

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

plugins/elements/gstdataurisrc.c

index 1fde36d..f18fae7 100644 (file)
@@ -227,21 +227,13 @@ gst_data_uri_src_create (GstBaseSrc * basesrc, guint64 offset, guint size,
    * larger than the max. available size if a segment at the end is requested */
   if (offset + size > gst_buffer_get_size (src->buffer)) {
     ret = GST_FLOW_EOS;
-  } else if (*buf != NULL) {
-    GstMapInfo src_info;
-    GstMapInfo dest_info;
-    gsize fill_size;
-
-    gst_buffer_map (src->buffer, &src_info, GST_MAP_READ);
-    gst_buffer_map (*buf, &dest_info, GST_MAP_WRITE);
-
-    fill_size = gst_buffer_fill (*buf, 0, src_info.data + offset, size);
-
-    gst_buffer_unmap (*buf, &dest_info);
-    gst_buffer_unmap (src->buffer, &src_info);
-    gst_buffer_set_size (*buf, fill_size);
-    ret = GST_FLOW_OK;
   } else {
+    /* Adding a check to unreference the buffer if *buf != NULL, 
+     * just in case a buffer is provided*/
+    if (*buf != NULL) {
+      gst_buffer_unref (*buf);
+      GST_FIXME_OBJECT (src, "Buffer is not supposed to be provided here");
+    }
     *buf =
         gst_buffer_copy_region (src->buffer, GST_BUFFER_COPY_ALL, offset, size);
     ret = GST_FLOW_OK;