Fixes https://bugzilla.gnome.org/show_bug.cgi?id=680614
gint max_errors;
gint error_count;
gint max_errors;
gint error_count;
/* ... being tracked here;
* only available during parsing */
GstVideoCodecFrame *current_frame;
/* ... being tracked here;
* only available during parsing */
GstVideoCodecFrame *current_frame;
GstCaps *caps;
gst_event_parse_caps (event, &caps);
GstCaps *caps;
gst_event_parse_caps (event, &caps);
- ret = gst_video_decoder_setcaps (decoder, caps);
+ ret = TRUE;
+ decoder->priv->do_caps = TRUE;
gst_event_unref (event);
event = NULL;
break;
gst_event_unref (event);
event = NULL;
break;
decoder = GST_VIDEO_DECODER (parent);
decoder = GST_VIDEO_DECODER (parent);
+ if (G_UNLIKELY (decoder->priv->do_caps)) {
+ GstCaps *caps = gst_pad_get_current_caps (decoder->sinkpad);
+ if (caps) {
+ if (!gst_video_decoder_setcaps (decoder, caps)) {
+ gst_caps_unref (caps);
+ goto not_negotiated;
+ }
+ gst_caps_unref (caps);
+ }
+ decoder->priv->do_caps = FALSE;
+ }
+
GST_LOG_OBJECT (decoder,
"chain PTS %" GST_TIME_FORMAT ", DTS %" GST_TIME_FORMAT " duration %"
GST_TIME_FORMAT " size %" G_GSIZE_FORMAT,
GST_LOG_OBJECT (decoder,
"chain PTS %" GST_TIME_FORMAT ", DTS %" GST_TIME_FORMAT " duration %"
GST_TIME_FORMAT " size %" G_GSIZE_FORMAT,
GST_VIDEO_DECODER_STREAM_UNLOCK (decoder);
return ret;
GST_VIDEO_DECODER_STREAM_UNLOCK (decoder);
return ret;
+
+ /* ERRORS */
+not_negotiated:
+ {
+ GST_ELEMENT_ERROR (decoder, CORE, NEGOTIATION, (NULL),
+ ("encoder not initialized"));
+ gst_buffer_unref (buf);
+ return GST_FLOW_NOT_NEGOTIATED;
+ }
}
static GstStateChangeReturn
}
static GstStateChangeReturn
/* FIXME : (and introduce a context ?) */
gboolean drained;
gboolean at_eos;
/* FIXME : (and introduce a context ?) */
gboolean drained;
gboolean at_eos;
gint64 min_latency;
gint64 max_latency;
gint64 min_latency;
gint64 max_latency;
GstCaps *caps;
gst_event_parse_caps (event, &caps);
GstCaps *caps;
gst_event_parse_caps (event, &caps);
- ret = gst_video_encoder_setcaps (encoder, caps);
+ ret = TRUE;
+ encoder->priv->do_caps = TRUE;
gst_event_unref (event);
event = NULL;
break;
gst_event_unref (event);
event = NULL;
break;
g_return_val_if_fail (klass->handle_frame != NULL, GST_FLOW_ERROR);
g_return_val_if_fail (klass->handle_frame != NULL, GST_FLOW_ERROR);
+ if (G_UNLIKELY (encoder->priv->do_caps)) {
+ GstCaps *caps = gst_pad_get_current_caps (encoder->sinkpad);
+ if (!caps)
+ goto not_negotiated;
+ if (!gst_video_encoder_setcaps (encoder, caps)) {
+ gst_caps_unref (caps);
+ goto not_negotiated;
+ }
+ encoder->priv->do_caps = FALSE;
+ }
+
GST_VIDEO_ENCODER_STREAM_LOCK (encoder);
pts = GST_BUFFER_PTS (buf);
GST_VIDEO_ENCODER_STREAM_LOCK (encoder);
pts = GST_BUFFER_PTS (buf);
GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);
return ret;
GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);
return ret;
+
+ /* ERRORS */
+not_negotiated:
+ {
+ GST_ELEMENT_ERROR (encoder, CORE, NEGOTIATION, (NULL),
+ ("encoder not initialized"));
+ gst_buffer_unref (buf);
+ return GST_FLOW_NOT_NEGOTIATED;
+ }
}
static GstStateChangeReturn
}
static GstStateChangeReturn