From 1aca0c541b4381deac3940125583c46a15c381ca Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 24 Mar 2006 19:41:03 +0000 Subject: [PATCH] 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. --- ChangeLog | 10 ++++++++++ ext/flac/gstflacdec.c | 43 ++++++++++--------------------------------- ext/flac/gstflacdec.h | 10 ++-------- ext/flac/gstflacenc.h | 3 --- 4 files changed, 22 insertions(+), 44 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5743a1e..7141e33 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2006-03-24 Wim Taymans + * 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. + +2006-03-24 Wim Taymans + * gst/avi/gstavidemux.c: (gst_avi_demux_parse_index), (gst_avi_demux_stream_index), (gst_avi_demux_stream_scan), (gst_avi_demux_massage_index), (gst_avi_demux_handle_seek): diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c index 92aa4e2..c310c6e 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; } diff --git a/ext/flac/gstflacdec.h b/ext/flac/gstflacdec.h index f40bcc3..8987e56 100644 --- a/ext/flac/gstflacdec.h +++ b/ext/flac/gstflacdec.h @@ -26,10 +26,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - +G_BEGIN_DECLS #define GST_TYPE_FLAC_DEC gst_flac_dec_get_type() #define GST_FLAC_DEC(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, GST_TYPE_FLAC_DEC, GstFlacDec) @@ -75,9 +72,6 @@ struct _GstFlacDecClass { GType gst_flac_dec_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ +G_END_DECLS #endif /* __GST_FLAC_DEC_H__ */ diff --git a/ext/flac/gstflacenc.h b/ext/flac/gstflacenc.h index 9a68386..98e4602 100644 --- a/ext/flac/gstflacenc.h +++ b/ext/flac/gstflacenc.h @@ -27,7 +27,6 @@ G_BEGIN_DECLS - #define GST_TYPE_FLAC_ENC (gst_flac_enc_get_type()) #define GST_FLAC_ENC(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, GST_TYPE_FLAC_ENC, GstFlacEnc) #define GST_FLAC_ENC_CLASS(klass) G_TYPE_CHECK_CLASS_CAST(klass, GST_TYPE_FLAC_ENC, GstFlacEnc) @@ -67,8 +66,6 @@ struct _GstFlacEncClass { GType gst_flac_enc_get_type(void); - G_END_DECLS - #endif /* __GST_FLAC_ENC_H__ */ -- 2.7.4