From 1aca0c541b4381deac3940125583c46a15c381ca Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 24 Mar 2006 19:41:03 +0000 Subject: ext/flac/: Spifify a bit. Original commit message from CVS: * ext/flac/gstflacdec.c: (gst_flac_dec_handle_seek_event): * ext/flac/gstflacdec.h: * ext/flac/gstflacenc.h: Spifify a bit. Fix deadly lock order error in seeking code, STREAM_LOCK cannot be taken within LOCK and the streaming variables are protected with the STREAM_LOCK anyway. --- ext/flac/gstflacdec.c | 43 ++++++++++--------------------------------- 1 file changed, 10 insertions(+), 33 deletions(-) (limited to 'ext/flac/gstflacdec.c') diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c index 92aa4e2c..c310c6e4 100644 --- a/ext/flac/gstflacdec.c +++ b/ext/flac/gstflacdec.c @@ -920,14 +920,6 @@ gst_flac_dec_handle_seek_event (GstFlacDec * flacdec, GstEvent * event) flush = ((seek_flags & GST_SEEK_FLAG_FLUSH) == GST_SEEK_FLAG_FLUSH); - GST_OBJECT_LOCK (flacdec); - - /* operate on segment copy until we know the seek worked */ - segment = flacdec->segment; - - gst_segment_set_seek (&segment, rate, GST_FORMAT_DEFAULT, - seek_flags, start_type, start, stop_type, stop, &only_update); - if (flush) { gst_pad_push_event (flacdec->srcpad, gst_event_new_flush_start ()); } else { @@ -936,13 +928,11 @@ gst_flac_dec_handle_seek_event (GstFlacDec * flacdec, GstEvent * event) GST_PAD_STREAM_LOCK (flacdec->sinkpad); -#if 0 - if (only_update) { - flacdec->segment = segment; - gst_flac_dec_send_newsegment (flacdec, TRUE); - goto done; - } -#endif + /* operate on segment copy until we know the seek worked */ + segment = flacdec->segment; + + gst_segment_set_seek (&segment, rate, GST_FORMAT_DEFAULT, + seek_flags, start_type, start, stop_type, stop, &only_update); GST_DEBUG ("configured segment: [%" G_GINT64_FORMAT "-%" G_GINT64_FORMAT "] = [%" GST_TIME_FORMAT "-%" GST_TIME_FORMAT "]", @@ -960,38 +950,25 @@ gst_flac_dec_handle_seek_event (GstFlacDec * flacdec, GstEvent * event) flacdec->seeking = FALSE; - gst_pad_push_event (flacdec->srcpad, gst_event_new_flush_stop ()); + /* FIXME: support segment seeks */ + if (flush) { + gst_pad_push_event (flacdec->srcpad, gst_event_new_flush_stop ()); + } if (seek_ok) { flacdec->segment = segment; gst_flac_dec_send_newsegment (flacdec, FALSE); flacdec->segment.last_stop = segment.start; -/* FIXME: support segment seeks - if ((seek_flags & GST_SEEK_FLAG_SEGMENT) != 0) { - GST_DEBUG_OBJECT (flacdec, "posting SEGMENT_START message"); - GST_OBJECT_UNLOCK (flacdec); - gst_element_post_message (GST_ELEMENT (flacdec), - gst_message_new_segment_start (GST_OBJECT (flacdec), - GST_FORMAT_DEFAULT, flacdec->segment.start)); - GST_OBJECT_LOCK (flacdec); - } -*/ GST_DEBUG_OBJECT (flacdec, "seek successful"); } else { GST_WARNING_OBJECT (flacdec, "seek failed"); } -#if 0 -done: -#endif - - GST_PAD_STREAM_UNLOCK (flacdec->sinkpad); - gst_pad_start_task (flacdec->sinkpad, (GstTaskFunction) gst_flac_dec_loop, flacdec->sinkpad); - GST_OBJECT_UNLOCK (flacdec); + GST_PAD_STREAM_UNLOCK (flacdec->sinkpad); return TRUE; } -- cgit