videodecoder/encoder: Call reset() always between start() and stop() and never outside

This commit is contained in:
Sebastian Dröge 2013-07-26 10:22:32 +02:00
parent 9259ee6729
commit 047abdc944
2 changed files with 9 additions and 11 deletions

View file

@ -2033,13 +2033,12 @@ 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:
GST_VIDEO_DECODER_STREAM_LOCK (decoder);
gst_video_decoder_reset (decoder, TRUE);
GST_VIDEO_DECODER_STREAM_UNLOCK (decoder);
/* Initialize device/library if needed */ /* Initialize device/library if needed */
if (decoder_class->start && !decoder_class->start (decoder)) if (decoder_class->start && !decoder_class->start (decoder))
goto start_failed; goto start_failed;
GST_VIDEO_DECODER_STREAM_LOCK (decoder);
gst_video_decoder_reset (decoder, TRUE);
GST_VIDEO_DECODER_STREAM_UNLOCK (decoder);
break; break;
default: default:
break; break;
@ -2049,12 +2048,11 @@ gst_video_decoder_change_state (GstElement * element, GstStateChange transition)
switch (transition) { switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
if (decoder_class->stop && !decoder_class->stop (decoder))
goto stop_failed;
GST_VIDEO_DECODER_STREAM_LOCK (decoder); GST_VIDEO_DECODER_STREAM_LOCK (decoder);
gst_video_decoder_reset (decoder, TRUE); gst_video_decoder_reset (decoder, TRUE);
GST_VIDEO_DECODER_STREAM_UNLOCK (decoder); GST_VIDEO_DECODER_STREAM_UNLOCK (decoder);
if (decoder_class->stop && !decoder_class->stop (decoder))
goto stop_failed;
break; break;
case GST_STATE_CHANGE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
/* close device/library if needed */ /* close device/library if needed */

View file

@ -1365,11 +1365,11 @@ gst_video_encoder_change_state (GstElement * element, GstStateChange transition)
break; break;
case GST_STATE_CHANGE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
/* Initialize device/library if needed */ /* 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);
if (encoder_class->start && !encoder_class->start (encoder))
goto start_failed;
break; break;
default: default:
break; break;
@ -1379,11 +1379,11 @@ gst_video_encoder_change_state (GstElement * element, GstStateChange transition)
switch (transition) { switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
if (encoder_class->stop && !encoder_class->stop (encoder))
goto stop_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);
if (encoder_class->stop && !encoder_class->stop (encoder))
goto stop_failed;
break; break;
case GST_STATE_CHANGE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
/* close device/library if needed */ /* close device/library if needed */