gst-libs/gst/audio/gstbaseaudiosrc.c: Add debug info.

Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_create), (gst_base_audio_src_change_state):
Add debug info.
When going from PLAYING to PAUSED, pause the ringbuffer before calling
the parent state change function, just like the audiosink, because the
parent waits for the element to finish its processing before completing
the state change. This makes going to PAUSED a lot snappier.
When going from READY to PAUSED, don't allow the ringbuffer to start
yet.
This commit is contained in:
Wim Taymans 2007-12-17 16:44:51 +00:00
parent 80d1fbac43
commit 2ea251a366
2 changed files with 27 additions and 4 deletions

View file

@ -1,3 +1,15 @@
2007-12-17 Wim Taymans <wim.taymans@collabora.co.uk>
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_create), (gst_base_audio_src_change_state):
Add debug info.
When going from PLAYING to PAUSED, pause the ringbuffer before calling
the parent state change function, just like the audiosink, because the
parent waits for the element to finish its processing before completing
the state change. This makes going to PAUSED a lot snappier.
When going from READY to PAUSED, don't allow the ringbuffer to start
yet.
2007-12-17 Edward Hervey <edward.hervey@collabora.co.uk>
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_audio_caps):

View file

@ -642,9 +642,12 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
break;
/* else something interrupted us and we wait for playing again. */
GST_DEBUG_OBJECT (src, "wait playing");
if (gst_base_src_wait_playing (bsrc) != GST_FLOW_OK)
goto stopped;
GST_DEBUG_OBJECT (src, "continue playing");
/* read next samples */
sample += read;
samples -= read;
@ -760,6 +763,7 @@ gst_base_audio_src_change_state (GstElement * element,
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
GST_DEBUG_OBJECT (src, "NULL->READY");
if (src->ringbuffer == NULL) {
src->ringbuffer = gst_base_audio_src_create_ringbuffer (src);
}
@ -767,13 +771,22 @@ gst_base_audio_src_change_state (GstElement * element,
goto open_failed;
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
GST_DEBUG_OBJECT (src, "READY->PAUSED");
src->next_sample = -1;
gst_ring_buffer_set_flushing (src->ringbuffer, FALSE);
gst_ring_buffer_may_start (src->ringbuffer, FALSE);
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
GST_DEBUG_OBJECT (src, "PAUSED->PLAYING");
gst_ring_buffer_may_start (src->ringbuffer, TRUE);
break;
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
GST_DEBUG_OBJECT (src, "PLAYING->PAUSED");
gst_ring_buffer_may_start (src->ringbuffer, FALSE);
gst_ring_buffer_pause (src->ringbuffer);
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
GST_DEBUG_OBJECT (src, "PAUSED->READY");
gst_ring_buffer_set_flushing (src->ringbuffer, TRUE);
break;
default:
@ -783,14 +796,12 @@ gst_base_audio_src_change_state (GstElement * element,
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
switch (transition) {
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
gst_ring_buffer_may_start (src->ringbuffer, FALSE);
gst_ring_buffer_pause (src->ringbuffer);
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
GST_DEBUG_OBJECT (src, "PAUSED->READY");
gst_ring_buffer_release (src->ringbuffer);
break;
case GST_STATE_CHANGE_READY_TO_NULL:
GST_DEBUG_OBJECT (src, "READY->NULL");
gst_ring_buffer_close_device (src->ringbuffer);
gst_object_unparent (GST_OBJECT_CAST (src->ringbuffer));
src->ringbuffer = NULL;