mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 03:31:05 +00:00
libs/gst/base/gstbasesrc.c: Make _wait_playing() not check any variables so that we can call this function from subcl...
Original commit message from CVS: * libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing), (gst_base_src_perform_seek), (gst_base_src_get_range), (gst_base_src_set_playing), (gst_base_src_change_state): Make _wait_playing() not check any variables so that we can call this function from subclasses. Move the checks elsewhere similar to _wait_preroll() in basesink. Add some debugging. Only signal the LIVE cond when we are going back to PLAYING.
This commit is contained in:
parent
af471ed6cd
commit
8a695165c2
2 changed files with 30 additions and 16 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
2007-12-17 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
|
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
|
||||||
|
(gst_base_src_perform_seek), (gst_base_src_get_range),
|
||||||
|
(gst_base_src_set_playing), (gst_base_src_change_state):
|
||||||
|
Make _wait_playing() not check any variables so that we can call this
|
||||||
|
function from subclasses. Move the checks elsewhere similar to
|
||||||
|
_wait_preroll() in basesink.
|
||||||
|
Add some debugging.
|
||||||
|
Only signal the LIVE cond when we are going back to PLAYING.
|
||||||
|
|
||||||
2007-12-16 Tim-Philipp Müller <tim at centricular dot net>
|
2007-12-16 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* gst/gstregistrybinary.c: (gst_registry_binary_write_cache):
|
* gst/gstregistrybinary.c: (gst_registry_binary_write_cache):
|
||||||
|
|
|
@ -484,17 +484,11 @@ GstFlowReturn
|
||||||
gst_base_src_wait_playing (GstBaseSrc * src)
|
gst_base_src_wait_playing (GstBaseSrc * src)
|
||||||
{
|
{
|
||||||
/* block until the state changes, or we get a flush, or something */
|
/* block until the state changes, or we get a flush, or something */
|
||||||
if (src->is_live) {
|
GST_DEBUG_OBJECT (src, "live source waiting for running state");
|
||||||
while (G_UNLIKELY (!src->live_running)) {
|
GST_LIVE_WAIT (src);
|
||||||
GST_DEBUG ("live source signal waiting");
|
if (src->priv->flushing)
|
||||||
GST_LIVE_SIGNAL (src);
|
goto flushing;
|
||||||
GST_DEBUG ("live source waiting for running state");
|
GST_DEBUG_OBJECT (src, "live source unlocked");
|
||||||
GST_LIVE_WAIT (src);
|
|
||||||
GST_DEBUG ("live source unlocked");
|
|
||||||
}
|
|
||||||
if (src->priv->flushing)
|
|
||||||
goto flushing;
|
|
||||||
}
|
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
|
|
||||||
|
@ -1207,7 +1201,7 @@ gst_base_src_perform_seek (GstBaseSrc * src, GstEvent * event, gboolean unlock)
|
||||||
src->segment.format, src->segment.last_stop));
|
src->segment.format, src->segment.last_stop));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* for deriving a stop position for the playback segment form the seek
|
/* for deriving a stop position for the playback segment from the seek
|
||||||
* segment, we must take the duration when the stop is not set */
|
* segment, we must take the duration when the stop is not set */
|
||||||
if ((stop = src->segment.stop) == -1)
|
if ((stop = src->segment.stop) == -1)
|
||||||
stop = src->segment.duration;
|
stop = src->segment.duration;
|
||||||
|
@ -1751,9 +1745,13 @@ gst_base_src_get_range (GstBaseSrc * src, guint64 offset, guint length,
|
||||||
|
|
||||||
bclass = GST_BASE_SRC_GET_CLASS (src);
|
bclass = GST_BASE_SRC_GET_CLASS (src);
|
||||||
|
|
||||||
ret = gst_base_src_wait_playing (src);
|
if (src->is_live) {
|
||||||
if (ret != GST_FLOW_OK)
|
while (G_UNLIKELY (!src->live_running)) {
|
||||||
goto stopped;
|
ret = gst_base_src_wait_playing (src);
|
||||||
|
if (ret != GST_FLOW_OK)
|
||||||
|
goto stopped;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (G_UNLIKELY (!GST_OBJECT_FLAG_IS_SET (src, GST_BASE_SRC_STARTED)))
|
if (G_UNLIKELY (!GST_OBJECT_FLAG_IS_SET (src, GST_BASE_SRC_STARTED)))
|
||||||
goto not_started;
|
goto not_started;
|
||||||
|
@ -2380,12 +2378,14 @@ gst_base_src_set_playing (GstBaseSrc * basesrc, gboolean live_play)
|
||||||
* waiting for PLAYING while blocked in the LIVE cond or we can be waiting
|
* waiting for PLAYING while blocked in the LIVE cond or we can be waiting
|
||||||
* for the clock. */
|
* for the clock. */
|
||||||
GST_LIVE_LOCK (basesrc);
|
GST_LIVE_LOCK (basesrc);
|
||||||
|
GST_DEBUG_OBJECT (basesrc, "unschedule clock");
|
||||||
|
|
||||||
/* unblock clock sync (if any) */
|
/* unblock clock sync (if any) */
|
||||||
if (basesrc->clock_id)
|
if (basesrc->clock_id)
|
||||||
gst_clock_id_unschedule (basesrc->clock_id);
|
gst_clock_id_unschedule (basesrc->clock_id);
|
||||||
|
|
||||||
/* configure what to do when we get to the LIVE lock. */
|
/* configure what to do when we get to the LIVE lock. */
|
||||||
|
GST_DEBUG_OBJECT (basesrc, "live running %d", live_play);
|
||||||
basesrc->live_running = live_play;
|
basesrc->live_running = live_play;
|
||||||
|
|
||||||
if (live_play) {
|
if (live_play) {
|
||||||
|
@ -2406,8 +2406,9 @@ gst_base_src_set_playing (GstBaseSrc * basesrc, gboolean live_play)
|
||||||
if (start)
|
if (start)
|
||||||
gst_pad_start_task (basesrc->srcpad, (GstTaskFunction) gst_base_src_loop,
|
gst_pad_start_task (basesrc->srcpad, (GstTaskFunction) gst_base_src_loop,
|
||||||
basesrc->srcpad);
|
basesrc->srcpad);
|
||||||
|
GST_DEBUG_OBJECT (basesrc, "signal");
|
||||||
|
GST_LIVE_SIGNAL (basesrc);
|
||||||
}
|
}
|
||||||
GST_LIVE_SIGNAL (basesrc);
|
|
||||||
GST_LIVE_UNLOCK (basesrc);
|
GST_LIVE_UNLOCK (basesrc);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -2555,6 +2556,7 @@ gst_base_src_change_state (GstElement * element, GstStateChange transition)
|
||||||
no_preroll = gst_base_src_is_live (basesrc);
|
no_preroll = gst_base_src_is_live (basesrc);
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
||||||
|
GST_DEBUG_OBJECT (basesrc, "PAUSED->PLAYING");
|
||||||
if (gst_base_src_is_live (basesrc)) {
|
if (gst_base_src_is_live (basesrc)) {
|
||||||
/* now we can start playback */
|
/* now we can start playback */
|
||||||
gst_base_src_set_playing (basesrc, TRUE);
|
gst_base_src_set_playing (basesrc, TRUE);
|
||||||
|
@ -2571,6 +2573,7 @@ gst_base_src_change_state (GstElement * element, GstStateChange transition)
|
||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
||||||
|
GST_DEBUG_OBJECT (basesrc, "PLAYING->PAUSED");
|
||||||
if (gst_base_src_is_live (basesrc)) {
|
if (gst_base_src_is_live (basesrc)) {
|
||||||
/* make sure we block in the live lock in PAUSED */
|
/* make sure we block in the live lock in PAUSED */
|
||||||
gst_base_src_set_playing (basesrc, FALSE);
|
gst_base_src_set_playing (basesrc, FALSE);
|
||||||
|
|
Loading…
Reference in a new issue