mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
gst-libs/gst/audio/gstbaseaudiosink.c: Use new basesink method to make our EOS drain interruptable.
Original commit message from CVS: * gst-libs/gst/audio/gstbaseaudiosink.c: (gst_base_audio_sink_drain): Use new basesink method to make our EOS drain interruptable.
This commit is contained in:
parent
c96877779a
commit
02f280a9a0
2 changed files with 16 additions and 17 deletions
|
@ -1,3 +1,9 @@
|
|||
2007-10-10 Wim Taymans <wim.taymans@gmail.com>
|
||||
|
||||
* gst-libs/gst/audio/gstbaseaudiosink.c:
|
||||
(gst_base_audio_sink_drain):
|
||||
Use new basesink method to make our EOS drain interruptable.
|
||||
|
||||
2007-10-10 Jan Schmidt <Jan.Schmidt@sun.com>
|
||||
|
||||
* gst-libs/gst/rtp/gstrtppayloads.c:
|
||||
|
|
|
@ -547,9 +547,7 @@ gst_base_audio_sink_get_times (GstBaseSink * bsink, GstBuffer * buffer,
|
|||
*end = GST_CLOCK_TIME_NONE;
|
||||
}
|
||||
|
||||
/* FIXME, this waits for the drain to happen but it cannot be
|
||||
* canceled.
|
||||
*/
|
||||
/* This waits for the drain to happen and can be canceled */
|
||||
static gboolean
|
||||
gst_base_audio_sink_drain (GstBaseAudioSink * sink)
|
||||
{
|
||||
|
@ -559,33 +557,28 @@ gst_base_audio_sink_drain (GstBaseAudioSink * sink)
|
|||
return TRUE;
|
||||
|
||||
/* need to start playback before we can drain, but only when
|
||||
* we have successfully negotiated a format and thus aqcuired the
|
||||
* we have successfully negotiated a format and thus acquired the
|
||||
* ringbuffer. */
|
||||
if (gst_ring_buffer_is_acquired (sink->ringbuffer))
|
||||
gst_ring_buffer_start (sink->ringbuffer);
|
||||
|
||||
if (sink->next_sample != -1) {
|
||||
GstClockTime time;
|
||||
GstClock *clock;
|
||||
|
||||
/* convert next expected sample to time */
|
||||
time =
|
||||
gst_util_uint64_scale_int (sink->next_sample, GST_SECOND,
|
||||
sink->ringbuffer->spec.rate);
|
||||
|
||||
GST_OBJECT_LOCK (sink);
|
||||
if ((clock = GST_ELEMENT_CLOCK (sink)) != NULL) {
|
||||
GstClockID id = gst_clock_new_single_shot_id (clock, time);
|
||||
GST_DEBUG_OBJECT (sink,
|
||||
"last sample %" G_GUINT64_FORMAT ", time %" GST_TIME_FORMAT,
|
||||
sink->next_sample, GST_TIME_ARGS (time));
|
||||
|
||||
GST_OBJECT_UNLOCK (sink);
|
||||
/* wait for the EOS time to be reached, this is the time when the last
|
||||
* sample is played. */
|
||||
gst_base_sink_wait_eos (GST_BASE_SINK (sink), time, NULL);
|
||||
|
||||
GST_DEBUG_OBJECT (sink, "waiting for last sample to play");
|
||||
gst_clock_id_wait (id, NULL);
|
||||
|
||||
gst_clock_id_unref (id);
|
||||
sink->next_sample = -1;
|
||||
} else {
|
||||
GST_OBJECT_UNLOCK (sink);
|
||||
}
|
||||
sink->next_sample = -1;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue