From: <wt...@ke...> - 2006-03-17 17:48:51
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: wtay Date: Fri Mar 17 2006 17:48:45 UTC Log message: * gst-libs/gst/audio/gstbaseaudiosink.c: (gst_base_audio_sink_change_state): * gst-libs/gst/audio/gstringbuffer.c: (wait_segment), (gst_ring_buffer_may_start): * gst-libs/gst/audio/gstringbuffer.h: Only start playback if we are playing. should fix #330748. Modified files: . : ChangeLog gst-libs/gst/audio: gstbaseaudiosink.c gstringbuffer.c gstringbuffer.h Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.2494&r2=1.2495 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst-libs/gst/audio/gstbaseaudiosink.c.diff?r1=1.52&r2=1.53 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst-libs/gst/audio/gstringbuffer.c.diff?r1=1.38&r2=1.39 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst-libs/gst/audio/gstringbuffer.h.diff?r1=1.18&r2=1.19 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.2494 retrieving revision 1.2495 diff -u -d -r1.2494 -r1.2495 --- ChangeLog 17 Mar 2006 13:11:45 -0000 1.2494 +++ ChangeLog 17 Mar 2006 17:48:33 -0000 1.2495 @@ -1,3 +1,13 @@ +2006-03-17 Wim Taymans <wi...@fl...> + + * gst-libs/gst/audio/gstbaseaudiosink.c: + (gst_base_audio_sink_change_state): + * gst-libs/gst/audio/gstringbuffer.c: (wait_segment), + (gst_ring_buffer_may_start): + * gst-libs/gst/audio/gstringbuffer.h: + Only start playback if we are playing. + should fix #330748. 2006-03-17 Jan Schmidt <th...@ma...> * ext/alsa/gstalsasink.c: (gst_alsasink_getcaps): Index: gstbaseaudiosink.c RCS file: /cvs/gstreamer/gst-plugins-base/gst-libs/gst/audio/gstbaseaudiosink.c,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- gstbaseaudiosink.c 28 Feb 2006 11:06:24 -0000 1.52 +++ gstbaseaudiosink.c 17 Mar 2006 17:48:33 -0000 1.53 @@ -707,14 +707,17 @@ goto open_failed; break; case GST_STATE_CHANGE_READY_TO_PAUSED: - gst_ring_buffer_set_flushing (sink->ringbuffer, FALSE); sink->next_sample = -1; + gst_ring_buffer_set_flushing (sink->ringbuffer, FALSE); + gst_ring_buffer_may_start (sink->ringbuffer, FALSE); case GST_STATE_CHANGE_PAUSED_TO_PLAYING: { GstClock *clock; GstClockTime time, base; + gst_ring_buffer_may_start (sink->ringbuffer, TRUE); GST_OBJECT_LOCK (sink); clock = GST_ELEMENT_CLOCK (sink); if (clock == NULL) @@ -746,6 +749,8 @@ } case GST_STATE_CHANGE_PLAYING_TO_PAUSED: + /* ringbuffer cannot start anymore */ gst_ring_buffer_pause (sink->ringbuffer); case GST_STATE_CHANGE_PAUSED_TO_READY: Index: gstringbuffer.c RCS file: /cvs/gstreamer/gst-plugins-base/gst-libs/gst/audio/gstringbuffer.c,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- gstringbuffer.c 2 Mar 2006 16:47:33 -0000 1.38 +++ gstringbuffer.c 17 Mar 2006 17:48:33 -0000 1.39 @@ -1077,6 +1077,10 @@ /* buffer must be started now or we deadlock since nobody is reading */ if (G_UNLIKELY (g_atomic_int_get (&buf->state) != GST_RING_BUFFER_STATE_STARTED)) { + /* see if we are allowed to start it */ + if (G_UNLIKELY (g_atomic_int_get (&buf->abidata.ABI.may_start) == FALSE)) + goto no_start; GST_DEBUG_OBJECT (buf, "start!"); gst_ring_buffer_start (buf); } @@ -1120,6 +1124,11 @@ GST_OBJECT_UNLOCK (buf); return FALSE; +no_start: + { + GST_DEBUG_OBJECT (buf, "not allowed to start"); + return FALSE; + } } /** @@ -1455,3 +1464,22 @@ memcpy (data, buf->empty_seg, buf->spec.segsize); +/** + * gst_ring_buffer_may_start: + * @buf: the #GstRingBuffer + * @allowed: the new value + * + * Tell the ringbuffer that it is allowed to start playback when + * the ringbuffer is filled with samples. + * Since: 0.10.6 + * MT safe. + */ +void +gst_ring_buffer_may_start (GstRingBuffer * buf, gboolean allowed) +{ + GST_LOG_OBJECT (buf, "may start: %d", allowed); + gst_atomic_int_set (&buf->abidata.ABI.may_start, allowed); +} Index: gstringbuffer.h RCS file: /cvs/gstreamer/gst-plugins-base/gst-libs/gst/audio/gstringbuffer.h,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- gstringbuffer.h 2 Mar 2006 16:47:33 -0000 1.18 +++ gstringbuffer.h 17 Mar 2006 17:48:33 -0000 1.19 @@ -243,6 +243,8 @@ union { struct { gboolean flushing; + /* ATOMIC */ + gint may_start; } ABI; /* adding + 0 to mark ABI change to be undone later */ gpointer _gst_reserved[GST_PADDING + 0]; @@ -335,6 +337,9 @@ void gst_ring_buffer_clear (GstRingBuffer *buf, gint segment); void gst_ring_buffer_advance (GstRingBuffer *buf, guint advance); +void gst_ring_buffer_may_start (GstRingBuffer *buf, gboolean allowed); G_END_DECLS #endif /* __GST_RING_BUFFER_H__ */ |