summaryrefslogtreecommitdiffstats
path: root/sys/sunaudio
diff options
context:
space:
mode:
authorBrian Cameron <brian.cameron@sun.com>2006-04-06 09:14:30 +0000
committerTim-Philipp Müller <tim@centricular.net>2006-04-06 09:14:30 +0000
commit89b392aa2f9793e0cc440f097620abea5e0c6a10 (patch)
tree51f91f9015d07ab0a6b3fe1f94fdcf807e633522 /sys/sunaudio
parent36c81557a3f6ffff3b71895642f860ae9090c265 (diff)
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 <brian dot cameron at sun dot com> * 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).
Diffstat (limited to 'sys/sunaudio')
-rw-r--r--sys/sunaudio/gstsunaudiosink.c46
-rw-r--r--sys/sunaudio/gstsunaudiosink.h1
2 files changed, 16 insertions, 31 deletions
diff --git a/sys/sunaudio/gstsunaudiosink.c b/sys/sunaudio/gstsunaudiosink.c
index f791c4a5..622b7ece 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 0b594301..f40a4cc0 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 {