diff --git a/gst/rtp/gstrtpgstdepay.c b/gst/rtp/gstrtpgstdepay.c
index 6dc5e51..074f7e0 100644
--- a/gst/rtp/gstrtpgstdepay.c
+++ b/gst/rtp/gstrtpgstdepay.c
@@ -158,8 +158,12 @@ gst_rtp_gst_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
   capsenc = gst_structure_get_string (structure, "caps");
   if (capsenc) {
     gsize out_len;
-
-    capsstr = (gchar *) g_base64_decode (capsenc, &out_len);
+    gchar *capsenctmp;
+    capsenctmp = malloc(strlen(capsenc)+2);
+    strcpy(capsenctmp, capsenc);
+    strcat(capsenctmp, "==");
+    capsstr = (gchar *) g_base64_decode (capsenctmp, &out_len);
+    free(capsenctmp);
     outcaps = gst_caps_from_string (capsstr);
     g_free (capsstr);
 
diff --git a/gst/rtp/gstrtpgstpay.c b/gst/rtp/gstrtpgstpay.c
index e6e23de..ffb183d 100644
--- a/gst/rtp/gstrtpgstpay.c
+++ b/gst/rtp/gstrtpgstpay.c
@@ -115,6 +115,10 @@ gst_rtp_gst_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
 
   capsstr = gst_caps_to_string (caps);
   capsenc = g_base64_encode ((guchar *) capsstr, strlen (capsstr));
+  while (capsenc[strlen(capsenc)-1]=='=')
+  {
+    capsenc[strlen(capsenc)-1]='\0';
+  }
   g_free (capsstr);
 
   gst_basertppayload_set_options (payload, "application", TRUE, "X-GST", 90000);
