X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gst-libs%2Fgst%2Faudio%2Fgstaudiodecoder.c;h=e258d44a71dbc17a1b7eb35b2565dfb6b05fa807;hb=28d76e62b45914c6174ca29c47f06e65d8f93ee0;hp=e35779e140e85d34f38ad63325dca2309ed23665;hpb=f2f53c02d843224594b7e7e4eb7e78edb8b3ec3f;p=framework%2Fmultimedia%2Fgst-plugins-base0.10.git diff --git a/gst-libs/gst/audio/gstaudiodecoder.c b/gst-libs/gst/audio/gstaudiodecoder.c index e35779e..e258d44 100644 --- a/gst-libs/gst/audio/gstaudiodecoder.c +++ b/gst-libs/gst/audio/gstaudiodecoder.c @@ -220,6 +220,9 @@ struct _GstAudioDecoderPrivate GstAdapter *adapter; /* tracking input ts for changes */ GstClockTime prev_ts; +#if 1 + guint64 prev_distance; +#endif /* frames obtained from input */ GQueue frames; /* collected output data */ @@ -444,6 +447,9 @@ gst_audio_decoder_reset (GstAudioDecoder * dec, gboolean full) dec->priv->out_ts = GST_CLOCK_TIME_NONE; dec->priv->out_dur = 0; dec->priv->prev_ts = GST_CLOCK_TIME_NONE; +#if 1 + dec->priv->prev_distance = 0; +#endif dec->priv->drained = TRUE; dec->priv->base_ts = GST_CLOCK_TIME_NONE; dec->priv->samples = 0; @@ -976,6 +982,7 @@ gst_audio_decoder_push_buffers (GstAudioDecoder * dec, gboolean force) if (G_LIKELY (av)) { gint len; GstClockTime ts; + guint64 distance; /* parse if needed */ if (klass->parse) { @@ -1015,6 +1022,7 @@ gst_audio_decoder_push_buffers (GstAudioDecoder * dec, gboolean force) len = av; } /* track upstream ts, but do not get stuck if nothing new upstream */ +#if 0 ts = gst_adapter_prev_timestamp (priv->adapter, NULL); if (ts == priv->prev_ts) { GST_LOG_OBJECT (dec, "ts == prev_ts; discarding"); @@ -1022,6 +1030,16 @@ gst_audio_decoder_push_buffers (GstAudioDecoder * dec, gboolean force) } else { priv->prev_ts = ts; } +#else + ts = gst_adapter_prev_timestamp (priv->adapter, &distance); + if (ts != priv->prev_ts || distance <= priv->prev_distance) { + priv->prev_ts = ts; + priv->prev_distance = distance; + } else { + GST_LOG_OBJECT (dec, "ts == prev_ts; discarding"); + ts = GST_CLOCK_TIME_NONE; + } +#endif buffer = gst_adapter_take_buffer (priv->adapter, len); buffer = gst_buffer_make_metadata_writable (buffer); GST_BUFFER_TIMESTAMP (buffer) = ts;