From a4f0b87d5c4bbe1de5e7cf223d107afbae126110 Mon Sep 17 00:00:00 2001
From: Song Bing <b06498@freescale.com>
Date: Mon, 8 Jun 2015 17:06:22 +0800
Subject: [PATCH] glfilter: Lost frame rate info when fixate caps
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Lost frame rate info when fixate caps. It will cause
down stream element fail, such avimux.

Upstream Status: Waiting for review.

https://bugzilla.gnome.org/show_bug.cgi?id=750545
Signed-off-by: Lyon Wang <lyon.wang@freescale.com>
---
 gst-libs/gst/gl/gstglfilter.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/gst-libs/gst/gl/gstglfilter.c b/gst-libs/gst/gl/gstglfilter.c
index d25bb72988f1..6840f4ca97a7 100644
--- a/gst-libs/gst/gl/gstglfilter.c
+++ b/gst-libs/gst/gl/gstglfilter.c
@@ -247,7 +247,8 @@ gst_gl_filter_fixate_caps (GstBaseTransform * bt,
     GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
 {
   GstStructure *ins, *outs;
-  const GValue *from_par, *to_par;
+  const GValue *from_par, *to_par, *from_fps;
+  gint framerate_num, framerate_den;
   GValue fpar = { 0, }, tpar = {
   0,};
 
@@ -260,6 +261,16 @@ gst_gl_filter_fixate_caps (GstBaseTransform * bt,
   ins = gst_caps_get_structure (caps, 0);
   outs = gst_caps_get_structure (othercaps, 0);
 
+  /* replace frame rate */
+  from_fps = gst_structure_get_value (ins, "framerate");
+  if (from_fps) {
+      gst_structure_set_value (outs, "framerate", from_fps);
+  } else {
+    if (gst_structure_get_fraction (ins, "framerate", &framerate_num, &framerate_den))
+      gst_structure_set (outs, "framerate", GST_TYPE_FRACTION, framerate_num, framerate_den,
+          NULL);
+  }
+
   from_par = gst_structure_get_value (ins, "pixel-aspect-ratio");
   to_par = gst_structure_get_value (outs, "pixel-aspect-ratio");
 
