diff options
author | Jan Schmidt <jan@centricular.com> | 2014-08-08 20:01:20 +1000 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2014-09-23 19:44:37 +0300 |
commit | 4ef7abbad6ba21cf3b85b4759a62e745d5368001 (patch) | |
tree | c184a45a44f66779a353581142556db3bc25e837 | |
parent | c2df24db9b8384c5cc2a11268c275d401a5c93e0 (diff) | |
download | gstreamer-plugins-base-4ef7abbad6ba21cf3b85b4759a62e745d5368001.tar.gz |
videodecoder: Reset last_timestamp_out on new segment
Reset last_timestamp_out when applying the output segment
change, to avoid decoder confusion over new timestamp timelines when
a seamless segment change happens.
Move some locks/unlocks to later when they're actually needed.
https://bugzilla.gnome.org/show_bug.cgi?id=734617
-rw-r--r-- | gst-libs/gst/video/gstvideodecoder.c | 12 | ||||
-rw-r--r-- | gst-libs/gst/video/gstvideodecoder.h | 3 |
2 files changed, 8 insertions, 7 deletions
diff --git a/gst-libs/gst/video/gstvideodecoder.c b/gst-libs/gst/video/gstvideodecoder.c index 7c1c18100..c29ddc750 100644 --- a/gst-libs/gst/video/gstvideodecoder.c +++ b/gst-libs/gst/video/gstvideodecoder.c @@ -893,19 +893,18 @@ gst_video_decoder_push_event (GstVideoDecoder * decoder, GstEvent * event) { GstSegment segment; - GST_VIDEO_DECODER_STREAM_LOCK (decoder); - gst_event_copy_segment (event, &segment); GST_DEBUG_OBJECT (decoder, "segment %" GST_SEGMENT_FORMAT, &segment); if (segment.format != GST_FORMAT_TIME) { GST_DEBUG_OBJECT (decoder, "received non TIME newsegment"); - GST_VIDEO_DECODER_STREAM_UNLOCK (decoder); break; } + GST_VIDEO_DECODER_STREAM_LOCK (decoder); decoder->output_segment = segment; + decoder->priv->last_timestamp_out = GST_CLOCK_TIME_NONE; GST_VIDEO_DECODER_STREAM_UNLOCK (decoder); break; } @@ -1120,8 +1119,6 @@ gst_video_decoder_sink_event_default (GstVideoDecoder * decoder, { GstSegment segment; - GST_VIDEO_DECODER_STREAM_LOCK (decoder); - gst_event_copy_segment (event, &segment); if (segment.format == GST_FORMAT_TIME) { @@ -1151,11 +1148,12 @@ gst_video_decoder_sink_event_default (GstVideoDecoder * decoder, gst_event_unref (event); event = gst_event_new_segment (&segment); } else { - GST_VIDEO_DECODER_STREAM_UNLOCK (decoder); goto newseg_wrong_format; } } + GST_VIDEO_DECODER_STREAM_LOCK (decoder); + priv->base_timestamp = GST_CLOCK_TIME_NONE; priv->base_picture_number = 0; @@ -1598,9 +1596,11 @@ gst_video_decoder_sink_query_default (GstVideoDecoder * decoder, gint64 src_val, dest_val; gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); + GST_VIDEO_DECODER_STREAM_LOCK (decoder); res = gst_video_encoded_video_convert (priv->bytes_out, priv->time, src_fmt, src_val, &dest_fmt, &dest_val); + GST_VIDEO_DECODER_STREAM_UNLOCK (decoder); if (!res) goto error; gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); diff --git a/gst-libs/gst/video/gstvideodecoder.h b/gst-libs/gst/video/gstvideodecoder.h index b41ca30b2..04b6245c9 100644 --- a/gst-libs/gst/video/gstvideodecoder.h +++ b/gst-libs/gst/video/gstvideodecoder.h @@ -214,7 +214,8 @@ struct _GstVideoDecoder * @handle_frame: Provides input data frame to subclass. * @finish: Optional. * Called to request subclass to dispatch any pending remaining - * data (e.g. at EOS). + * data (e.g. at EOS or segment end). Sub-classes should be prepared + * to handle new data afterward, or seamless segment processing will break. * @sink_event: Optional. * Event handler on the sink pad. This function should return * TRUE if the event was handled and should be discarded |