mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
Reset the handled number of samples when going to PAUSED
Original commit message from CVS: Reset the handled number of samples when going to PAUSED Some cleanups
This commit is contained in:
parent
223ce42ed6
commit
7f83fbc9fe
3 changed files with 21 additions and 41 deletions
|
@ -116,13 +116,10 @@ gst_oss_clock_get_internal_time (GstClock *clock)
|
||||||
if (diff1) {
|
if (diff1) {
|
||||||
oss_clock->adjust -= diff2 - diff1;
|
oss_clock->adjust -= diff2 - diff1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
g_print ("diff %lld %lld %lld %lld %lld %lld\n",
|
g_print ("diff %lld %lld %lld %lld %lld %lld\n",
|
||||||
diff1, diff2, time1, time2, diff2 - diff1, oss_clock->adjust);
|
diff1, diff2, time1, time2, diff2 - diff1, oss_clock->adjust);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
return time2 + oss_clock->adjust;
|
return time2 + oss_clock->adjust;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -710,31 +710,14 @@ gst_osssink_change_state (GstElement *element)
|
||||||
case GST_STATE_READY_TO_PAUSED:
|
case GST_STATE_READY_TO_PAUSED:
|
||||||
osssink->offset = 0LL;
|
osssink->offset = 0LL;
|
||||||
osssink->have_offset = FALSE;
|
osssink->have_offset = FALSE;
|
||||||
|
osssink->handled = 0LL;
|
||||||
break;
|
break;
|
||||||
case GST_STATE_PAUSED_TO_PLAYING:
|
case GST_STATE_PAUSED_TO_PLAYING:
|
||||||
/* gst_clock_adjust (osssink->clock, osssink->offset - gst_clock_get_time (osssink->clock)); */
|
|
||||||
break;
|
break;
|
||||||
case GST_STATE_PLAYING_TO_PAUSED:
|
case GST_STATE_PLAYING_TO_PAUSED:
|
||||||
{
|
{
|
||||||
if (GST_FLAG_IS_SET (element, GST_OSSSINK_OPEN)) {
|
if (GST_FLAG_IS_SET (element, GST_OSSSINK_OPEN))
|
||||||
if (osssink->bps) {
|
ioctl (osssink->fd, SNDCTL_DSP_RESET, 0);
|
||||||
GstClockTime time;
|
|
||||||
audio_buf_info ospace;
|
|
||||||
gint queued;
|
|
||||||
|
|
||||||
ioctl (osssink->fd, SNDCTL_DSP_GETOSPACE, &ospace);
|
|
||||||
ioctl (osssink->fd, SNDCTL_DSP_RESET, 0);
|
|
||||||
|
|
||||||
queued = (ospace.fragstotal * ospace.fragsize) - ospace.bytes;
|
|
||||||
time = osssink->offset + (osssink->handled - queued) * 1000000LL / osssink->bps;
|
|
||||||
|
|
||||||
//gst_clock_adjust (osssink->clock, time - gst_clock_get_time (osssink->clock));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ioctl (osssink->fd, SNDCTL_DSP_RESET, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_STATE_PAUSED_TO_READY:
|
case GST_STATE_PAUSED_TO_READY:
|
||||||
|
|
|
@ -56,32 +56,32 @@ typedef struct _GstOssSink GstOssSink;
|
||||||
typedef struct _GstOssSinkClass GstOssSinkClass;
|
typedef struct _GstOssSinkClass GstOssSinkClass;
|
||||||
|
|
||||||
struct _GstOssSink {
|
struct _GstOssSink {
|
||||||
GstElement element;
|
GstElement element;
|
||||||
|
|
||||||
GstPad *sinkpad;
|
GstPad *sinkpad;
|
||||||
GstBufferPool *sinkpool;
|
GstBufferPool *sinkpool;
|
||||||
|
|
||||||
GstClock *provided_clock;
|
GstClock *provided_clock;
|
||||||
GstClock *clock;
|
GstClock *clock;
|
||||||
|
|
||||||
/* device */
|
/* device */
|
||||||
gchar *device;
|
gchar *device;
|
||||||
|
|
||||||
/* soundcard state */
|
/* soundcard state */
|
||||||
int fd;
|
int fd;
|
||||||
int caps; /* the capabilities */
|
int caps; /* the capabilities */
|
||||||
gint format;
|
gint format;
|
||||||
gint channels;
|
gint channels;
|
||||||
gint frequency;
|
gint frequency;
|
||||||
gint fragment;
|
gint fragment;
|
||||||
gboolean mute;
|
gboolean mute;
|
||||||
guint bufsize;
|
guint bufsize;
|
||||||
guint bps;
|
guint bps;
|
||||||
gboolean have_offset;
|
gboolean have_offset;
|
||||||
guint64 offset;
|
guint64 offset;
|
||||||
guint64 handled;
|
guint64 handled;
|
||||||
|
|
||||||
guint64 fragment_time;
|
guint64 fragment_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstOssSinkClass {
|
struct _GstOssSinkClass {
|
||||||
|
|
Loading…
Reference in a new issue