mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-23 14:36:24 +00:00
video{en,de}coder: Call reset() before the start() vfunc
This makes sure that the element is in the same state before start() is called the very first time and every future call after the element was used already. Also it ensure that we always have a clean state before start(), cleaned the same way in every case.
This commit is contained in:
parent
aae6400962
commit
87d6c265a8
2 changed files with 8 additions and 6 deletions
|
@ -2275,12 +2275,13 @@ gst_video_decoder_change_state (GstElement * element, GstStateChange transition)
|
||||||
goto open_failed;
|
goto open_failed;
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
/* Initialize device/library if needed */
|
|
||||||
if (decoder_class->start && !decoder_class->start (decoder))
|
|
||||||
goto start_failed;
|
|
||||||
GST_VIDEO_DECODER_STREAM_LOCK (decoder);
|
GST_VIDEO_DECODER_STREAM_LOCK (decoder);
|
||||||
gst_video_decoder_reset (decoder, TRUE, TRUE);
|
gst_video_decoder_reset (decoder, TRUE, TRUE);
|
||||||
GST_VIDEO_DECODER_STREAM_UNLOCK (decoder);
|
GST_VIDEO_DECODER_STREAM_UNLOCK (decoder);
|
||||||
|
|
||||||
|
/* Initialize device/library if needed */
|
||||||
|
if (decoder_class->start && !decoder_class->start (decoder))
|
||||||
|
goto start_failed;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1411,12 +1411,13 @@ gst_video_encoder_change_state (GstElement * element, GstStateChange transition)
|
||||||
goto open_failed;
|
goto open_failed;
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
/* Initialize device/library if needed */
|
|
||||||
if (encoder_class->start && !encoder_class->start (encoder))
|
|
||||||
goto start_failed;
|
|
||||||
GST_VIDEO_ENCODER_STREAM_LOCK (encoder);
|
GST_VIDEO_ENCODER_STREAM_LOCK (encoder);
|
||||||
gst_video_encoder_reset (encoder, TRUE);
|
gst_video_encoder_reset (encoder, TRUE);
|
||||||
GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);
|
GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);
|
||||||
|
|
||||||
|
/* Initialize device/library if needed */
|
||||||
|
if (encoder_class->start && !encoder_class->start (encoder))
|
||||||
|
goto start_failed;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue