From a0522c2394640863d4049873fbacf0ad4dddd115 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Thu, 20 Apr 2006 11:00:16 +0000 Subject: [PATCH] gst/matroska/matroska-demux.c: Handle end of segment properly when set; don't dead-lock when posting start of segment... Original commit message from CVS: Patch by: Mark Nauwelaerts * gst/matroska/matroska-demux.c: (gst_matroska_demux_handle_seek_event), (gst_matroska_demux_loop): Handle end of segment properly when set; don't dead-lock when posting start of segment message when doing a segment seek. Fixes #338810. --- ChangeLog | 10 ++++++++++ gst/matroska/matroska-demux.c | 20 ++++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 751e4b300e..ef83d1cc03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-04-20 Tim-Philipp Müller + + Patch by: Mark Nauwelaerts + + * gst/matroska/matroska-demux.c: + (gst_matroska_demux_handle_seek_event), (gst_matroska_demux_loop): + Handle end of segment properly when set; don't dead-lock when + posting start of segment message when doing a segment seek. + Fixes #338810. + 2006-04-20 Tim-Philipp Müller * gst/matroska/matroska-demux.c: (gst_matroska_demux_audio_caps), diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c index d3878ee55d..f342781303 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -1181,6 +1181,8 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux, demux->segment_start = segment_start; demux->segment_stop = segment_stop; + GST_OBJECT_UNLOCK (demux); + /* notify start of new segment */ if (demux->segment_play) { GstMessage *msg; @@ -1191,10 +1193,8 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux, } /* FIXME: should be demux->segment_start, not entry->time */ - newsegment_event = gst_event_new_new_segment (FALSE, demux->segment_rate, - GST_FORMAT_TIME, entry->time, demux->segment_stop, entry->time); - - GST_OBJECT_UNLOCK (demux); + newsegment_event = gst_event_new_new_segment (FALSE, rate, + GST_FORMAT_TIME, entry->time, segment_stop, entry->time); GST_DEBUG ("Stopping flush"); if (flush) { @@ -2827,7 +2827,7 @@ gst_matroska_demux_loop (GstPad * pad) /* first, if we're to start, let's actually get starting */ if (demux->state == GST_MATROSKA_DEMUX_STATE_START) { if (!gst_matroska_demux_init_stream (demux)) { - GST_DEBUG_OBJECT (demux, "init stream failed!"); + GST_WARNING_OBJECT (demux, "init stream failed!"); goto eos_and_pause; } demux->state = GST_MATROSKA_DEMUX_STATE_HEADER; @@ -2836,14 +2836,18 @@ gst_matroska_demux_loop (GstPad * pad) ret = gst_matroska_demux_loop_stream (demux); /* check if we're at the end of a configured segment */ - if (demux->segment_play && GST_CLOCK_TIME_IS_VALID (demux->segment_stop)) { + if (GST_CLOCK_TIME_IS_VALID (demux->segment_stop)) { guint i; for (i = 0; i < demux->num_streams; i++) { if (demux->src[i]->pos >= demux->segment_stop) { - GST_LOG ("Reached end of segment (%" G_GUINT64_FORMAT "-%" - G_GUINT64_FORMAT ") on pad %s:%s", demux->segment_start, + GST_INFO_OBJECT (demux, "Reached end of segment (%" G_GUINT64_FORMAT + "-%" G_GUINT64_FORMAT ") on pad %s:%s", demux->segment_start, demux->segment_stop, GST_DEBUG_PAD_NAME (demux->src[i]->pad)); + + if (!demux->segment_play) + goto eos_and_pause; + gst_element_post_message (GST_ELEMENT (demux), gst_message_new_segment_done (GST_OBJECT (demux), GST_FORMAT_TIME, demux->segment_stop));