mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
videodecoder/videoencoder: Mark pads as requiring reconfiguration again if negotiation fails
Otherwise we might end up in non-optimal configuration, especially when a flush happened during reconfiguration.
This commit is contained in:
parent
721931d80a
commit
35ee4b056b
2 changed files with 16 additions and 4 deletions
|
@ -2435,6 +2435,7 @@ gst_video_decoder_finish_frame (GstVideoDecoder * decoder,
|
||||||
if (G_UNLIKELY (priv->output_state_changed || (priv->output_state
|
if (G_UNLIKELY (priv->output_state_changed || (priv->output_state
|
||||||
&& gst_pad_check_reconfigure (decoder->srcpad)))) {
|
&& gst_pad_check_reconfigure (decoder->srcpad)))) {
|
||||||
if (!gst_video_decoder_negotiate (decoder)) {
|
if (!gst_video_decoder_negotiate (decoder)) {
|
||||||
|
gst_pad_mark_reconfigure (decoder->srcpad);
|
||||||
if (GST_PAD_IS_FLUSHING (decoder->srcpad))
|
if (GST_PAD_IS_FLUSHING (decoder->srcpad))
|
||||||
ret = GST_FLOW_FLUSHING;
|
ret = GST_FLOW_FLUSHING;
|
||||||
else
|
else
|
||||||
|
@ -3182,6 +3183,7 @@ gst_video_decoder_allocate_output_buffer (GstVideoDecoder * decoder)
|
||||||
|| gst_pad_check_reconfigure (decoder->srcpad))) {
|
|| gst_pad_check_reconfigure (decoder->srcpad))) {
|
||||||
if (!gst_video_decoder_negotiate (decoder)) {
|
if (!gst_video_decoder_negotiate (decoder)) {
|
||||||
GST_DEBUG_OBJECT (decoder, "Failed to negotiate, fallback allocation");
|
GST_DEBUG_OBJECT (decoder, "Failed to negotiate, fallback allocation");
|
||||||
|
gst_pad_mark_reconfigure (decoder->srcpad);
|
||||||
goto fallback;
|
goto fallback;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3246,8 +3248,12 @@ gst_video_decoder_allocate_output_frame (GstVideoDecoder *
|
||||||
}
|
}
|
||||||
|
|
||||||
if (G_UNLIKELY (decoder->priv->output_state_changed
|
if (G_UNLIKELY (decoder->priv->output_state_changed
|
||||||
|| gst_pad_check_reconfigure (decoder->srcpad)))
|
|| gst_pad_check_reconfigure (decoder->srcpad))) {
|
||||||
gst_video_decoder_negotiate (decoder);
|
if (!gst_video_decoder_negotiate (decoder)) {
|
||||||
|
GST_DEBUG_OBJECT (decoder, "Failed to negotiate, fallback allocation");
|
||||||
|
gst_pad_mark_reconfigure (decoder->srcpad);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GST_LOG_OBJECT (decoder, "alloc buffer size %d", num_bytes);
|
GST_LOG_OBJECT (decoder, "alloc buffer size %d", num_bytes);
|
||||||
|
|
||||||
|
|
|
@ -1619,6 +1619,7 @@ gst_video_encoder_allocate_output_buffer (GstVideoEncoder * encoder, gsize size)
|
||||||
&& gst_pad_check_reconfigure (encoder->srcpad)))) {
|
&& gst_pad_check_reconfigure (encoder->srcpad)))) {
|
||||||
if (!gst_video_encoder_negotiate (encoder)) {
|
if (!gst_video_encoder_negotiate (encoder)) {
|
||||||
GST_DEBUG_OBJECT (encoder, "Failed to negotiate, fallback allocation");
|
GST_DEBUG_OBJECT (encoder, "Failed to negotiate, fallback allocation");
|
||||||
|
gst_pad_mark_reconfigure (encoder->srcpad);
|
||||||
goto fallback;
|
goto fallback;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1667,8 +1668,12 @@ gst_video_encoder_allocate_output_frame (GstVideoEncoder *
|
||||||
GST_VIDEO_ENCODER_STREAM_LOCK (encoder);
|
GST_VIDEO_ENCODER_STREAM_LOCK (encoder);
|
||||||
if (G_UNLIKELY (encoder->priv->output_state_changed
|
if (G_UNLIKELY (encoder->priv->output_state_changed
|
||||||
|| (encoder->priv->output_state
|
|| (encoder->priv->output_state
|
||||||
&& gst_pad_check_reconfigure (encoder->srcpad))))
|
&& gst_pad_check_reconfigure (encoder->srcpad)))) {
|
||||||
gst_video_encoder_negotiate (encoder);
|
if (!gst_video_encoder_negotiate (encoder)) {
|
||||||
|
GST_DEBUG_OBJECT (encoder, "Failed to negotiate, fallback allocation");
|
||||||
|
gst_pad_mark_reconfigure (encoder->srcpad);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GST_LOG_OBJECT (encoder, "alloc buffer size %" G_GSIZE_FORMAT, size);
|
GST_LOG_OBJECT (encoder, "alloc buffer size %" G_GSIZE_FORMAT, size);
|
||||||
|
|
||||||
|
@ -1740,6 +1745,7 @@ gst_video_encoder_finish_frame (GstVideoEncoder * encoder,
|
||||||
if (G_UNLIKELY (priv->output_state_changed || (priv->output_state
|
if (G_UNLIKELY (priv->output_state_changed || (priv->output_state
|
||||||
&& gst_pad_check_reconfigure (encoder->srcpad)))) {
|
&& gst_pad_check_reconfigure (encoder->srcpad)))) {
|
||||||
if (!gst_video_encoder_negotiate (encoder)) {
|
if (!gst_video_encoder_negotiate (encoder)) {
|
||||||
|
gst_pad_mark_reconfigure (encoder->srcpad);
|
||||||
if (GST_PAD_IS_FLUSHING (encoder->srcpad))
|
if (GST_PAD_IS_FLUSHING (encoder->srcpad))
|
||||||
ret = GST_FLOW_FLUSHING;
|
ret = GST_FLOW_FLUSHING;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue