[svn r194] Some fixes on chain function. trunk
authorrosfran
Mon Dec 04 23:13:44 2006 +0000 (2006-12-04)
branchtrunk
changeset 193418267061bed
parent 192 b13b1e81f5af
child 194 244e5bd51194
[svn r194] Some fixes on chain function.
gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c
     1.1 --- a/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c	Mon Dec 04 23:07:36 2006 +0000
     1.2 +++ b/gst-plugins-nuvdemux/nuvdemux/gstnuvdemux.c	Mon Dec 04 23:13:44 2006 +0000
     1.3 @@ -1082,8 +1082,18 @@
     1.4      res = gst_pad_activate_push (sinkpad, TRUE);
     1.5      return res;
     1.6    if (gst_pad_check_pull_range (sinkpad)) {
     1.7 +    if (nuv->priv->adapter) {
     1.8 +      gst_adapter_clear (nuv->priv->adapter);
     1.9 +      g_object_unref (nuv->priv->adapter);
    1.10 +      nuv->priv->adapter = NULL;
    1.11 +    }
    1.12      res = gst_pad_activate_pull (sinkpad, TRUE);
    1.13    } else {
    1.14 +    if (nuv->priv->adapter) {
    1.15 +      gst_adapter_clear (nuv->priv->adapter);
    1.16 +    } else {
    1.17 +      nuv->priv->adapter = gst_adapter_new ();
    1.18 +    }
    1.19      res = gst_pad_activate_push (sinkpad, TRUE);
    1.20    }
    1.21    
    1.22 @@ -1203,9 +1213,15 @@
    1.23    GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (pad));
    1.24  
    1.25    GST_DEBUG_OBJECT (nuv, " gst_nuv_demux_chain function");
    1.26 +  
    1.27 +  if (NULL == nuv->priv->adapter) {
    1.28 +    GST_ERROR ("pull expected! Chain func should not be called");
    1.29 +    return GST_FLOW_UNEXPECTED;
    1.30 +  }
    1.31 +  
    1.32    gst_adapter_push (nuv->priv->adapter, buf);
    1.33  
    1.34 -  gst_object_unref (nuv);
    1.35 +  /* gst_object_unref (nuv); */
    1.36  
    1.37    return gst_nuv_demux_play (pad);
    1.38  }