video{enc,dec}oder: Don't reset latency all the time and handle max=GST_CLOCK_TIME_NONE correctly

max=NONE means that *this* element has no maximum latency. If upstream had a
maximum latency we must not override it with NONE.
This commit is contained in:
Sebastian Dröge 2015-02-03 12:23:06 +01:00
parent 823cb40642
commit aa645b11f1
2 changed files with 14 additions and 12 deletions

View file

@ -568,6 +568,9 @@ gst_video_decoder_init (GstVideoDecoder * decoder, GstVideoDecoderClass * klass)
decoder->priv->packetized = TRUE;
decoder->priv->needs_format = FALSE;
decoder->priv->min_latency = 0;
decoder->priv->max_latency = GST_CLOCK_TIME_NONE;
gst_video_decoder_reset (decoder, TRUE, TRUE);
}
@ -1538,10 +1541,11 @@ gst_video_decoder_src_query_default (GstVideoDecoder * dec, GstQuery * query)
GST_OBJECT_LOCK (dec);
min_latency += dec->priv->min_latency;
if (dec->priv->max_latency == GST_CLOCK_TIME_NONE) {
max_latency = GST_CLOCK_TIME_NONE;
} else if (max_latency != GST_CLOCK_TIME_NONE) {
if (max_latency != GST_CLOCK_TIME_NONE
&& dec->priv->max_latency != GST_CLOCK_TIME_NONE) {
max_latency += dec->priv->max_latency;
} else if (dec->priv->max_latency != GST_CLOCK_TIME_NONE) {
max_latency = dec->priv->max_latency;
}
GST_OBJECT_UNLOCK (dec);
@ -1870,9 +1874,6 @@ gst_video_decoder_reset (GstVideoDecoder * decoder, gboolean full,
priv->qos_frame_duration = 0;
GST_OBJECT_UNLOCK (decoder);
priv->min_latency = 0;
priv->max_latency = 0;
if (priv->tags)
gst_tag_list_unref (priv->tags);
priv->tags = NULL;

View file

@ -363,9 +363,6 @@ gst_video_encoder_reset (GstVideoEncoder * encoder, gboolean hard)
priv->tags = NULL;
priv->tags_changed = FALSE;
priv->min_latency = 0;
priv->max_latency = 0;
g_list_foreach (priv->headers, (GFunc) gst_event_unref, NULL);
g_list_free (priv->headers);
priv->headers = NULL;
@ -456,6 +453,9 @@ gst_video_encoder_init (GstVideoEncoder * encoder, GstVideoEncoderClass * klass)
priv->headers = NULL;
priv->new_headers = FALSE;
priv->min_latency = 0;
priv->max_latency = GST_CLOCK_TIME_NONE;
gst_video_encoder_reset (encoder, TRUE);
}
@ -1199,10 +1199,11 @@ gst_video_encoder_src_query_default (GstVideoEncoder * enc, GstQuery * query)
GST_OBJECT_LOCK (enc);
min_latency += priv->min_latency;
if (enc->priv->max_latency == GST_CLOCK_TIME_NONE) {
max_latency = GST_CLOCK_TIME_NONE;
} else if (max_latency != GST_CLOCK_TIME_NONE) {
if (max_latency != GST_CLOCK_TIME_NONE
&& enc->priv->max_latency != GST_CLOCK_TIME_NONE) {
max_latency += enc->priv->max_latency;
} else if (enc->priv->max_latency != GST_CLOCK_TIME_NONE) {
max_latency = enc->priv->max_latency;
}
GST_OBJECT_UNLOCK (enc);