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  <manauw at skynet dot be>
* 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.
This commit is contained in:
Mark Nauwelaerts 2006-04-20 11:00:16 +00:00 committed by Tim-Philipp Müller
parent 95175ab920
commit a0522c2394
2 changed files with 22 additions and 8 deletions

View file

@ -1,3 +1,13 @@
2006-04-20 Tim-Philipp Müller <tim at centricular dot net>
Patch by: Mark Nauwelaerts <manauw at skynet dot be>
* 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 <tim at centricular dot net> 2006-04-20 Tim-Philipp Müller <tim at centricular dot net>
* gst/matroska/matroska-demux.c: (gst_matroska_demux_audio_caps), * gst/matroska/matroska-demux.c: (gst_matroska_demux_audio_caps),

View file

@ -1181,6 +1181,8 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux,
demux->segment_start = segment_start; demux->segment_start = segment_start;
demux->segment_stop = segment_stop; demux->segment_stop = segment_stop;
GST_OBJECT_UNLOCK (demux);
/* notify start of new segment */ /* notify start of new segment */
if (demux->segment_play) { if (demux->segment_play) {
GstMessage *msg; GstMessage *msg;
@ -1191,10 +1193,8 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux,
} }
/* FIXME: should be demux->segment_start, not entry->time */ /* FIXME: should be demux->segment_start, not entry->time */
newsegment_event = gst_event_new_new_segment (FALSE, demux->segment_rate, newsegment_event = gst_event_new_new_segment (FALSE, rate,
GST_FORMAT_TIME, entry->time, demux->segment_stop, entry->time); GST_FORMAT_TIME, entry->time, segment_stop, entry->time);
GST_OBJECT_UNLOCK (demux);
GST_DEBUG ("Stopping flush"); GST_DEBUG ("Stopping flush");
if (flush) { if (flush) {
@ -2827,7 +2827,7 @@ gst_matroska_demux_loop (GstPad * pad)
/* first, if we're to start, let's actually get starting */ /* first, if we're to start, let's actually get starting */
if (demux->state == GST_MATROSKA_DEMUX_STATE_START) { if (demux->state == GST_MATROSKA_DEMUX_STATE_START) {
if (!gst_matroska_demux_init_stream (demux)) { 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; goto eos_and_pause;
} }
demux->state = GST_MATROSKA_DEMUX_STATE_HEADER; demux->state = GST_MATROSKA_DEMUX_STATE_HEADER;
@ -2836,14 +2836,18 @@ gst_matroska_demux_loop (GstPad * pad)
ret = gst_matroska_demux_loop_stream (demux); ret = gst_matroska_demux_loop_stream (demux);
/* check if we're at the end of a configured segment */ /* 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; guint i;
for (i = 0; i < demux->num_streams; i++) { for (i = 0; i < demux->num_streams; i++) {
if (demux->src[i]->pos >= demux->segment_stop) { if (demux->src[i]->pos >= demux->segment_stop) {
GST_LOG ("Reached end of segment (%" G_GUINT64_FORMAT "-%" GST_INFO_OBJECT (demux, "Reached end of segment (%" G_GUINT64_FORMAT
G_GUINT64_FORMAT ") on pad %s:%s", demux->segment_start, "-%" G_GUINT64_FORMAT ") on pad %s:%s", demux->segment_start,
demux->segment_stop, GST_DEBUG_PAD_NAME (demux->src[i]->pad)); 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_element_post_message (GST_ELEMENT (demux),
gst_message_new_segment_done (GST_OBJECT (demux), GST_FORMAT_TIME, gst_message_new_segment_done (GST_OBJECT (demux), GST_FORMAT_TIME,
demux->segment_stop)); demux->segment_stop));