X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gst%2Frtp%2Fgstrtpgstdepay.c;h=0f081776ea4f69cefb646f6252688f84b07c8254;hb=775ccdf9775bd7051929b257444b3be915e88ec6;hp=489f6a8bc8decd27e433aed1d06f0d9914363fa5;hpb=f05e14ba316d67b9cdf1440d9b2129da03625a30;p=platform%2Fupstream%2Fgst-plugins-good.git diff --git a/gst/rtp/gstrtpgstdepay.c b/gst/rtp/gstrtpgstdepay.c index 489f6a8..0f08177 100644 --- a/gst/rtp/gstrtpgstdepay.c +++ b/gst/rtp/gstrtpgstdepay.c @@ -116,31 +116,13 @@ gst_rtp_gst_depay_finalize (GObject * object) G_OBJECT_CLASS (parent_class)->finalize (object); } -static gboolean -store_cache (GstRtpGSTDepay * rtpgstdepay, guint CV, GstCaps * caps) -{ - gboolean changed = FALSE; - - if (caps && rtpgstdepay->CV_cache[CV]) - changed = !gst_caps_is_strictly_equal (caps, rtpgstdepay->CV_cache[CV]); - - if (rtpgstdepay->CV_cache[CV]) - gst_caps_unref (rtpgstdepay->CV_cache[CV]); - rtpgstdepay->CV_cache[CV] = caps; - - return changed; -} - static void gst_rtp_gst_depay_reset (GstRtpGSTDepay * rtpgstdepay, gboolean full) { - guint i; - gst_adapter_clear (rtpgstdepay->adapter); if (full) { rtpgstdepay->current_CV = 0; - for (i = 0; i < 8; i++) - store_cache (rtpgstdepay, i, NULL); + gst_caps_replace (&rtpgstdepay->current_caps, NULL); g_free (rtpgstdepay->stream_id); rtpgstdepay->stream_id = NULL; if (rtpgstdepay->tags) @@ -189,14 +171,14 @@ gst_rtp_gst_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps) } /* store in cache */ rtpgstdepay->current_CV = CV; - gst_caps_ref (outcaps); - store_cache (rtpgstdepay, CV, outcaps); + gst_caps_replace (&rtpgstdepay->current_caps, outcaps); res = gst_pad_set_caps (depayload->srcpad, outcaps); gst_caps_unref (outcaps); } else { GST_WARNING_OBJECT (depayload, "no caps given"); rtpgstdepay->current_CV = -1; + gst_caps_replace (&rtpgstdepay->current_caps, NULL); res = TRUE; } @@ -471,8 +453,12 @@ gst_rtp_gst_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp) GST_DEBUG_OBJECT (rtpgstdepay, "inline caps %u, length %u, %" GST_PTR_FORMAT, CV, size, outcaps); - if (store_cache (rtpgstdepay, CV, outcaps)) + if (!rtpgstdepay->current_caps + || !gst_caps_is_strictly_equal (rtpgstdepay->current_caps, outcaps)) gst_pad_set_caps (depayload->srcpad, outcaps); + gst_caps_replace (&rtpgstdepay->current_caps, outcaps); + gst_caps_unref (outcaps); + rtpgstdepay->current_CV = CV; /* skip caps */ offset += size; @@ -512,17 +498,9 @@ gst_rtp_gst_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp) /* see what caps we need */ if (CV != rtpgstdepay->current_CV) { - /* we need to switch caps, check if we have the caps */ - if ((outcaps = rtpgstdepay->CV_cache[CV]) == NULL) - goto missing_caps; - - GST_DEBUG_OBJECT (rtpgstdepay, - "need caps switch from %u to %u, %" GST_PTR_FORMAT, - rtpgstdepay->current_CV, CV, outcaps); - - /* and set caps */ - if (gst_pad_set_caps (depayload->srcpad, outcaps)) - rtpgstdepay->current_CV = CV; + /* we need to switch caps but didn't receive the new caps yet */ + gst_caps_replace (&rtpgstdepay->current_caps, NULL); + goto missing_caps; } if (payload[0] & 0x8)