From: Brian Cameron Date: Thu, 6 Apr 2006 09:14:30 +0000 (+0000) Subject: sys/sunaudio/gstsunaudiosink.*: Use spec->segsize and spec->segtotal in the prepare... X-Git-Tag: RELEASE-0_10_3~120 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=89b392aa2f9793e0cc440f097620abea5e0c6a10;p=platform%2Fupstream%2Fgst-plugins-good.git sys/sunaudio/gstsunaudiosink.*: Use spec->segsize and spec->segtotal in the prepare function to initialise the ring b... Original commit message from CVS: Patch by: Brian Cameron * sys/sunaudio/gstsunaudiosink.c: (gst_sunaudiosink_init), (gst_sunaudiosink_prepare), (gst_sunaudiosink_write): * sys/sunaudio/gstsunaudiosink.h: Use spec->segsize and spec->segtotal in the prepare function to initialise the ring buffer instead of using the buffer-time property (#337421). --- diff --git a/ChangeLog b/ChangeLog index 0df49e6..ad95fb5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2006-04-06 Tim-Philipp Müller + Patch by: Brian Cameron + + * sys/sunaudio/gstsunaudiosink.c: (gst_sunaudiosink_init), + (gst_sunaudiosink_prepare), (gst_sunaudiosink_write): + * sys/sunaudio/gstsunaudiosink.h: + Use spec->segsize and spec->segtotal in the prepare function + to initialise the ring buffer instead of using the buffer-time + property (#337421). + +2006-04-06 Tim-Philipp Müller + * configure.ac: Bump core requirements to CVS for gst_pad_query_peer_duration() which is used by speexdec. diff --git a/sys/sunaudio/gstsunaudiosink.c b/sys/sunaudio/gstsunaudiosink.c index f791c4a..622b7ec 100644 --- a/sys/sunaudio/gstsunaudiosink.c +++ b/sys/sunaudio/gstsunaudiosink.c @@ -184,31 +184,6 @@ gst_sunaudiosink_init (GstSunAudioSink * sunaudiosink) GST_DEBUG_OBJECT (sunaudiosink, "initializing sunaudiosink"); - /* - * According to the Sun audio man page, this value can't be set and - * will be ignored for playback, but setting it the same way that - * esound does. Probably not necessary, but doesn't hurt. - */ - sunaudiosink->buffer_size = 8180; - - /* - * Reset the buffer-time to 5ms instead of the normal default of 500us - * (10 times larger, in other words). - * - * Setting a larger buffer causes the sinesrc to not stutter with this - * sink. The fact that SunAudio requires a larger buffer should be - * investigated further to see if this is needed due to limitations of - * SunAudio itself or because of a more serious problem with the - * GStreamer engine on Solaris. - */ - g_value_init (&gvalue, G_TYPE_INT64); - g_object_get_property (G_OBJECT (sunaudiosink), "buffer-time", &gvalue); - buffer_time = g_value_get_int64 (&gvalue); - if (buffer_time < 5000000) { - g_value_set_int64 (&gvalue, 5000000); - g_object_set_property (G_OBJECT (sunaudiosink), "buffer-time", &gvalue); - } - audiodev = g_getenv ("AUDIODEV"); if (audiodev == NULL) audiodev = DEFAULT_DEVICE; @@ -364,9 +339,23 @@ gst_sunaudiosink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec) ainfo.play.precision = spec->width; ainfo.play.encoding = AUDIO_ENCODING_LINEAR; ainfo.play.port = ports; - ainfo.play.buffer_size = sunaudiosink->buffer_size; ainfo.output_muted = 0; + /* + * SunAudio doesn't really give access to buffer size, these values work. Setting + * the buffer so large (512K) is a bit annoying because this causes the volume + * control in audio players to be slow in responding since the audio volume won't + * change until the buffer empties. SunAudio doesn't seem to allow changing the + * audio output buffer size to anything smaller, though. I notice setting the + * values smaller causes the audio to stutter, which is worse. + */ + spec->segsize = 4096; + spec->segtotal = 128; + spec->silence_sample[0] = 0; + spec->silence_sample[1] = 0; + spec->silence_sample[2] = 0; + spec->silence_sample[3] = 0; + ret = ioctl (sunaudiosink->fd, AUDIO_SETINFO, &ainfo); if (ret == -1) { GST_ELEMENT_ERROR (sunaudiosink, RESOURCE, SETTINGS, (NULL), ("%s", @@ -388,10 +377,7 @@ gst_sunaudiosink_write (GstAudioSink * asink, gpointer data, guint length) { GstSunAudioSink *sunaudiosink = GST_SUNAUDIO_SINK (asink); - if (length > sunaudiosink->buffer_size) - return write (sunaudiosink->fd, data, sunaudiosink->buffer_size); - else - return write (sunaudiosink->fd, data, length); + return write (sunaudiosink->fd, data, length); } /* diff --git a/sys/sunaudio/gstsunaudiosink.h b/sys/sunaudio/gstsunaudiosink.h index 0b59430..f40a4cc 100644 --- a/sys/sunaudio/gstsunaudiosink.h +++ b/sys/sunaudio/gstsunaudiosink.h @@ -48,7 +48,6 @@ struct _GstSunAudioSink { audio_info_t info; gint bytes_per_sample; - gint buffer_size; }; struct _GstSunAudioSinkClass {