From: Sanchayan Maity Date: Fri, 27 Nov 2020 06:11:36 +0000 (+0530) Subject: audiodecoder: Move max_errors out of GstAudioDecoderContext X-Git-Tag: 1.19.3~511^2~358 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5aa836848eac4c7e460ab7f6be43a44dab96dc99;p=platform%2Fupstream%2Fgstreamer.git audiodecoder: Move max_errors out of GstAudioDecoderContext Currently max-errors gets set during init to default or via property. However, if a decoder element calls gst_audio_decoder_reset with 'full' argument set to TRUE, it would result in all the fields of context being zeroed with memset. This effectively results in max-errors getting a value of 0 overriding the default or user requested value set during init. This would result in calls to GST_AUDIO_DECODER_ERROR which track error counts and allow max-errors, to be ineffective. To fix this move max-errors out of GstAudioDecoderContext, as changes to context should not affect this. The error_count is anyways also in GstAudioDecoderPrivate and not in context. Part-of: --- diff --git a/gst-libs/gst/audio/gstaudiodecoder.c b/gst-libs/gst/audio/gstaudiodecoder.c index c8e4a0c..ee32141 100644 --- a/gst-libs/gst/audio/gstaudiodecoder.c +++ b/gst-libs/gst/audio/gstaudiodecoder.c @@ -176,7 +176,6 @@ typedef struct _GstAudioDecoderContext /* output */ gboolean do_plc; gboolean do_estimate_rate; - gint max_errors; GstCaps *allocation_caps; /* MT-protected (with LOCK) */ GstClockTime min_latency; @@ -235,6 +234,8 @@ struct _GstAudioDecoderPrivate guint sync_flush; /* error count */ gint error_count; + /* max errors */ + gint max_errors; /* upstream stream tags (global tags are passed through as-is) */ GstTagList *upstream_tags; @@ -497,7 +498,7 @@ gst_audio_decoder_init (GstAudioDecoder * dec, GstAudioDecoderClass * klass) dec->priv->plc = DEFAULT_PLC; dec->priv->drainable = DEFAULT_DRAINABLE; dec->priv->needs_format = DEFAULT_NEEDS_FORMAT; - dec->priv->ctx.max_errors = GST_AUDIO_DECODER_MAX_ERRORS; + dec->priv->max_errors = GST_AUDIO_DECODER_MAX_ERRORS; /* init state */ dec->priv->ctx.min_latency = 0; @@ -3254,8 +3255,8 @@ _gst_audio_decoder_error (GstAudioDecoder * dec, gint weight, GST_WARNING_OBJECT (dec, "error: %s", dbg); dec->priv->error_count += weight; dec->priv->discont = TRUE; - if (dec->priv->ctx.max_errors >= 0 - && dec->priv->ctx.max_errors < dec->priv->error_count) { + if (dec->priv->max_errors >= 0 + && dec->priv->max_errors < dec->priv->error_count) { gst_element_message_full (GST_ELEMENT (dec), GST_MESSAGE_ERROR, domain, code, txt, dbg, file, function, line); return GST_FLOW_ERROR; @@ -3367,7 +3368,7 @@ gst_audio_decoder_set_max_errors (GstAudioDecoder * dec, gint num) { g_return_if_fail (GST_IS_AUDIO_DECODER (dec)); - dec->priv->ctx.max_errors = num; + dec->priv->max_errors = num; } /** @@ -3381,7 +3382,7 @@ gst_audio_decoder_get_max_errors (GstAudioDecoder * dec) { g_return_val_if_fail (GST_IS_AUDIO_DECODER (dec), 0); - return dec->priv->ctx.max_errors; + return dec->priv->max_errors; } /**