ext/alsa/gstalsa.c: really start/stop clock only on PLAYING <=> PAUSED

Original commit message from CVS:
2004-01-31  Benjamin Otte  <in7y118@public.uni-hamburg.de>

* ext/alsa/gstalsa.c: (gst_alsa_change_state), (gst_alsa_start),
(gst_alsa_drain_audio), (gst_alsa_stop_audio):
really start/stop clock only on PLAYING <=> PAUSED
* ext/alsa/gstalsasink.c: (gst_alsa_sink_loop):
remove \n from debugging lines
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_chain):
make it work when seeking does not
* ext/vorbis/vorbisdec.c: (vorbis_dec_event):
reset on DISCONT
This commit is contained in:
Benjamin Otte 2004-01-31 20:57:21 +00:00
parent a61dceb24d
commit 1646d10b87
5 changed files with 23 additions and 7 deletions

View file

@ -1,3 +1,15 @@
2004-01-31 Benjamin Otte <in7y118@public.uni-hamburg.de>
* ext/alsa/gstalsa.c: (gst_alsa_change_state), (gst_alsa_start),
(gst_alsa_drain_audio), (gst_alsa_stop_audio):
really start/stop clock only on PLAYING <=> PAUSED
* ext/alsa/gstalsasink.c: (gst_alsa_sink_loop):
remove \n from debugging lines
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_chain):
make it work when seeking does not
* ext/vorbis/vorbisdec.c: (vorbis_dec_event):
reset on DISCONT
2004-01-31 Benjamin Otte <in7y118@public.uni-hamburg.de> 2004-01-31 Benjamin Otte <in7y118@public.uni-hamburg.de>
* ext/alsa/gstalsa.c: (gst_alsa_change_state), (gst_alsa_start): * ext/alsa/gstalsa.c: (gst_alsa_change_state), (gst_alsa_start):

View file

@ -720,6 +720,9 @@ gst_alsa_change_state (GstElement *element)
GST_ERROR_OBJECT (this, "Error unpausing sound: %s", snd_strerror (err)); GST_ERROR_OBJECT (this, "Error unpausing sound: %s", snd_strerror (err));
return GST_STATE_FAILURE; return GST_STATE_FAILURE;
} }
} else if (! (GST_FLAG_IS_SET (element, GST_ALSA_RUNNING) ||
gst_alsa_start_audio (this))) {
return GST_STATE_FAILURE;
} }
gst_alsa_clock_start (this->clock); gst_alsa_clock_start (this->clock);
break; break;
@ -730,11 +733,13 @@ gst_alsa_change_state (GstElement *element)
GST_ERROR_OBJECT (this, "Error pausing sound: %s", snd_strerror (err)); GST_ERROR_OBJECT (this, "Error pausing sound: %s", snd_strerror (err));
return GST_STATE_FAILURE; return GST_STATE_FAILURE;
} }
gst_alsa_clock_stop (this->clock);
} }
break; break;
} }
gst_alsa_clock_stop (this->clock);
/* if device doesn't know how to pause, we just stop */ /* if device doesn't know how to pause, we just stop */
if (GST_FLAG_IS_SET (element, GST_ALSA_RUNNING)) gst_alsa_stop_audio (this);
break;
case GST_STATE_PAUSED_TO_READY: case GST_STATE_PAUSED_TO_READY:
if (GST_FLAG_IS_SET (element, GST_ALSA_RUNNING)) gst_alsa_stop_audio (this); if (GST_FLAG_IS_SET (element, GST_ALSA_RUNNING)) gst_alsa_stop_audio (this);
g_free (this->format); g_free (this->format);
@ -836,7 +841,6 @@ gst_alsa_start (GstAlsa *this)
g_assert_not_reached (); g_assert_not_reached ();
break; break;
} }
/* gst_alsa_clock_start (this->clock); */
return TRUE; return TRUE;
} }
void void
@ -1071,7 +1075,6 @@ gst_alsa_drain_audio (GstAlsa *this)
switch (snd_pcm_state (this->handle)) { switch (snd_pcm_state (this->handle)) {
case SND_PCM_STATE_XRUN: case SND_PCM_STATE_XRUN:
case SND_PCM_STATE_RUNNING: case SND_PCM_STATE_RUNNING:
gst_alsa_clock_stop (this->clock);
/* fall through - clock is already stopped when paused */ /* fall through - clock is already stopped when paused */
case SND_PCM_STATE_PAUSED: case SND_PCM_STATE_PAUSED:
/* snd_pcm_drain only works in blocking mode */ /* snd_pcm_drain only works in blocking mode */
@ -1098,7 +1101,6 @@ gst_alsa_stop_audio (GstAlsa *this)
switch (snd_pcm_state (this->handle)) { switch (snd_pcm_state (this->handle)) {
case SND_PCM_STATE_XRUN: case SND_PCM_STATE_XRUN:
case SND_PCM_STATE_RUNNING: case SND_PCM_STATE_RUNNING:
gst_alsa_clock_stop (this->clock);
/* fall through - clock is already stopped when paused */ /* fall through - clock is already stopped when paused */
case SND_PCM_STATE_PAUSED: case SND_PCM_STATE_PAUSED:
ERROR_CHECK (snd_pcm_drop (this->handle), ERROR_CHECK (snd_pcm_drop (this->handle),

View file

@ -374,7 +374,7 @@ no_difference:
int samples = MIN (bytes, sample_diff) * int samples = MIN (bytes, sample_diff) *
(element->numpads == 1 ? this->format->channels : 1); (element->numpads == 1 ? this->format->channels : 1);
int size = samples * snd_pcm_format_physical_width (this->format->format) / 8; int size = samples * snd_pcm_format_physical_width (this->format->format) / 8;
GST_INFO_OBJECT (this, "Allocating %d bytes (%ld samples) now to resync: sample %ld expected, but got %ld\n", GST_INFO_OBJECT (this, "Allocating %d bytes (%ld samples) now to resync: sample %ld expected, but got %ld",
size, MIN (bytes, sample_diff), time_sample, samplestamp); size, MIN (bytes, sample_diff), time_sample, samplestamp);
sink->data[i] = g_try_malloc (size); sink->data[i] = g_try_malloc (size);
if (!sink->data[i]) { if (!sink->data[i]) {
@ -387,7 +387,7 @@ no_difference:
} }
sink->behaviour[i] = 1; sink->behaviour[i] = 1;
} else if (gst_alsa_samples_to_bytes (this, -sample_diff) >= sink->buf[i]->size) { } else if (gst_alsa_samples_to_bytes (this, -sample_diff) >= sink->buf[i]->size) {
GST_INFO_OBJECT (this, "Skipping %lu samples to resync (complete buffer): sample %ld expected, but got %ld\n", GST_INFO_OBJECT (this, "Skipping %lu samples to resync (complete buffer): sample %ld expected, but got %ld",
gst_alsa_bytes_to_samples (this, sink->buf[i]->size), time_sample, samplestamp); gst_alsa_bytes_to_samples (this, sink->buf[i]->size), time_sample, samplestamp);
/* this buffer is way behind */ /* this buffer is way behind */
gst_buffer_unref (sink->buf[i]); gst_buffer_unref (sink->buf[i]);
@ -395,7 +395,7 @@ no_difference:
continue; continue;
} else if (sample_diff < 0) { } else if (sample_diff < 0) {
gint difference = gst_alsa_samples_to_bytes (this, -samplestamp); gint difference = gst_alsa_samples_to_bytes (this, -samplestamp);
GST_INFO_OBJECT (this, "Skipping %lu samples to resync: sample %ld expected, but got %ld\n", GST_INFO_OBJECT (this, "Skipping %lu samples to resync: sample %ld expected, but got %ld",
(gulong) -sample_diff, time_sample, samplestamp); (gulong) -sample_diff, time_sample, samplestamp);
/* this buffer is only a bit behind */ /* this buffer is only a bit behind */
sink->size[i] = sink->buf[i]->size - difference; sink->size[i] = sink->buf[i]->size - difference;

View file

@ -564,6 +564,7 @@ gst_ogg_demux_chain (GstPad *pad, GstData *buffer)
GST_FLAG_SET (ogg, GST_OGG_FLAG_WAIT_FOR_DISCONT); GST_FLAG_SET (ogg, GST_OGG_FLAG_WAIT_FOR_DISCONT);
goto out; goto out;
} }
gst_ogg_add_chain (ogg);
GST_OGG_SET_STATE (ogg, GST_OGG_STATE_PLAY); GST_OGG_SET_STATE (ogg, GST_OGG_STATE_PLAY);
/* fall through */ /* fall through */
case GST_OGG_STATE_SEEK: case GST_OGG_STATE_SEEK:

View file

@ -276,6 +276,7 @@ vorbis_dec_event (GstVorbisDec *dec, GstEvent *event)
} else { } else {
GST_ERROR_OBJECT (dec, "failed to parse data for DISCONT event, not sending any"); GST_ERROR_OBJECT (dec, "failed to parse data for DISCONT event, not sending any");
} }
vorbis_synthesis_restart (&dec->vd);
} }
break; break;
default: default: