mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
audio{enc,dec}oder: Handle max_latency == GST_CLOCK_TIME_NONE
And initialize the latencies with 0 and NONE.
This commit is contained in:
parent
efe54e50e9
commit
f2a762a3a0
2 changed files with 10 additions and 2 deletions
|
@ -518,6 +518,8 @@ gst_audio_decoder_init (GstAudioDecoder * dec, GstAudioDecoderClass * klass)
|
||||||
dec->priv->needs_format = DEFAULT_NEEDS_FORMAT;
|
dec->priv->needs_format = DEFAULT_NEEDS_FORMAT;
|
||||||
|
|
||||||
/* init state */
|
/* init state */
|
||||||
|
dec->priv->ctx.min_latency = 0;
|
||||||
|
dec->priv->ctx.max_latency = GST_CLOCK_TIME_NONE;
|
||||||
gst_audio_decoder_reset (dec, TRUE);
|
gst_audio_decoder_reset (dec, TRUE);
|
||||||
GST_DEBUG_OBJECT (dec, "init ok");
|
GST_DEBUG_OBJECT (dec, "init ok");
|
||||||
}
|
}
|
||||||
|
@ -2667,7 +2669,7 @@ gst_audio_decoder_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||||
/* add our latency */
|
/* add our latency */
|
||||||
if (min_latency != -1)
|
if (min_latency != -1)
|
||||||
min_latency += dec->priv->ctx.min_latency;
|
min_latency += dec->priv->ctx.min_latency;
|
||||||
if (max_latency != -1)
|
if (max_latency != -1 && dec->priv->ctx.max_latency != -1)
|
||||||
max_latency += dec->priv->ctx.max_latency;
|
max_latency += dec->priv->ctx.max_latency;
|
||||||
GST_OBJECT_UNLOCK (dec);
|
GST_OBJECT_UNLOCK (dec);
|
||||||
|
|
||||||
|
@ -3003,6 +3005,8 @@ gst_audio_decoder_set_latency (GstAudioDecoder * dec,
|
||||||
GstClockTime min, GstClockTime max)
|
GstClockTime min, GstClockTime max)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GST_IS_AUDIO_DECODER (dec));
|
g_return_if_fail (GST_IS_AUDIO_DECODER (dec));
|
||||||
|
g_return_if_fail (GST_CLOCK_TIME_IS_VALID (min));
|
||||||
|
g_return_if_fail (min <= max);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (dec);
|
GST_OBJECT_LOCK (dec);
|
||||||
dec->priv->ctx.min_latency = min;
|
dec->priv->ctx.min_latency = min;
|
||||||
|
|
|
@ -446,6 +446,8 @@ gst_audio_encoder_init (GstAudioEncoder * enc, GstAudioEncoderClass * bclass)
|
||||||
enc->priv->drainable = DEFAULT_DRAINABLE;
|
enc->priv->drainable = DEFAULT_DRAINABLE;
|
||||||
|
|
||||||
/* init state */
|
/* init state */
|
||||||
|
enc->priv->ctx.min_latency = 0;
|
||||||
|
enc->priv->ctx.max_latency = GST_CLOCK_TIME_NONE;
|
||||||
gst_audio_encoder_reset (enc, TRUE);
|
gst_audio_encoder_reset (enc, TRUE);
|
||||||
GST_DEBUG_OBJECT (enc, "init ok");
|
GST_DEBUG_OBJECT (enc, "init ok");
|
||||||
}
|
}
|
||||||
|
@ -1857,7 +1859,7 @@ gst_audio_encoder_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||||
/* add our latency */
|
/* add our latency */
|
||||||
if (min_latency != -1)
|
if (min_latency != -1)
|
||||||
min_latency += enc->priv->ctx.min_latency;
|
min_latency += enc->priv->ctx.min_latency;
|
||||||
if (max_latency != -1)
|
if (max_latency != -1 && enc->priv->ctx.max_latency != -1)
|
||||||
max_latency += enc->priv->ctx.max_latency;
|
max_latency += enc->priv->ctx.max_latency;
|
||||||
GST_OBJECT_UNLOCK (enc);
|
GST_OBJECT_UNLOCK (enc);
|
||||||
|
|
||||||
|
@ -2140,6 +2142,8 @@ gst_audio_encoder_set_latency (GstAudioEncoder * enc,
|
||||||
GstClockTime min, GstClockTime max)
|
GstClockTime min, GstClockTime max)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GST_IS_AUDIO_ENCODER (enc));
|
g_return_if_fail (GST_IS_AUDIO_ENCODER (enc));
|
||||||
|
g_return_if_fail (GST_CLOCK_TIME_IS_VALID (min));
|
||||||
|
g_return_if_fail (min <= max);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (enc);
|
GST_OBJECT_LOCK (enc);
|
||||||
enc->priv->ctx.min_latency = min;
|
enc->priv->ctx.min_latency = min;
|
||||||
|
|
Loading…
Reference in a new issue