I am attaching 3 patches for consideration upstream:
- pulseaudio-05-shm.diff
The shm files on Solaris end up with a different name. This patch
makes the code work on Solaris too.
- pulseaudio-07-sada.diff
Fixes to improve the SunAudio plugin so it works better.
- pulsaudio-10-endian.diff
On Sparc, WORDS_BIGENDIAN needs to get set if _BIG_ENDIAN is set.
Brian
--- pulseaudio-1.1/src/pulsecore/shm.c-orig 2011-10-24 19:42:44.692685416
-0500
+++ pulseaudio-1.1/src/pulsecore/shm.c 2011-10-24 20:24:30.605598557 -0500
@@ -68,8 +68,13 @@
* /dev/shm. We can use that information to list all blocks and
* cleanup unused ones */
#define SHM_PATH "/dev/shm/"
+#define SHM_ID_LEN 10
+#elif defined(__sun)
+#define SHM_PATH "/tmp"
+#define SHM_ID_LEN 15
#else
#undef SHM_PATH
+#define SHM_ID_LEN 0
#endif
#define SHM_MARKER ((int) 0xbeefcafe)
@@ -359,10 +364,14 @@ int pa_shm_cleanup(void) {
char fn[128];
struct shm_marker *m;
- if (strncmp(de->d_name, "pulse-shm-", 10))
+#ifdef defined(__sun)
+ if (strncmp(de->d_name, "pulse-shm-", SHM_ID_LEN))
+#else
+ if (strncmp(de->d_name, ".SHMDpulse-shm-", SHM_ID_LEN))
+#endif
continue;
- if (pa_atou(de->d_name + 10, &id) < 0)
+ if (pa_atou(de->d_name + SHM_ID_LEN, &id) < 0)
continue;
if (pa_shm_attach_ro(&seg, id) < 0)
--- pulseaudio-1.1/src/modules/module-solaris.c-orig 2012-05-14
20:28:17.916336872 -0500
+++ pulseaudio-1.1/src/modules/module-solaris.c 2012-05-14 20:28:38.353786471
-0500
@@ -137,6 +137,7 @@ static const char* const valid_modargs[]
static uint64_t get_playback_buffered_bytes(struct userdata *u) {
audio_info_t info;
uint64_t played_bytes;
+ int64_t buffered_bytes;
int err;
pa_assert(u->sink);
@@ -163,7 +164,13 @@ static uint64_t get_playback_buffered_by
pa_smoother_put(u->smoother, pa_rtclock_now(),
pa_bytes_to_usec(played_bytes, &u->sink->sample_spec));
- return u->written_bytes - played_bytes;
+ buffered_bytes = u->written_bytes - played_bytes;
+
+ if (buffered_bytes < 0) {
+ buffered_bytes = 0;
+ }
+
+ return (uint64_t) buffered_bytes;
}
static pa_usec_t sink_get_latency(struct userdata *u, pa_sample_spec *ss) {
@@ -348,7 +355,7 @@ static int suspend(struct userdata *u) {
pa_log_info("Suspending...");
- ioctl(u->fd, AUDIO_DRAIN, NULL);
+ ioctl(u->fd, I_FLUSH, FLUSHRW);
pa_close(u->fd);
u->fd = -1;
@@ -485,14 +492,26 @@ static int source_process_msg(pa_msgobje
static void sink_set_volume(pa_sink *s) {
struct userdata *u;
audio_info_t info;
+ pa_volume_t v;
pa_assert_se(u = s->userdata);
+ if (u->fd < 0) {
+ u->fd = pa_open_cloexec(u->device_name, u->mode | O_NONBLOCK, 0);
+ }
+
if (u->fd >= 0) {
AUDIO_INITINFO(&info);
- info.play.gain = pa_cvolume_max(&s->real_volume) * AUDIO_MAX_GAIN /
PA_VOLUME_NORM;
- assert(info.play.gain <= AUDIO_MAX_GAIN);
+ v = pa_cvolume_max(&s->real_volume);
+ if (v > PA_VOLUME_NORM) {
+ v = PA_VOLUME_NORM;
+ }
+
+ info.play.gain = v * AUDIO_MAX_GAIN / PA_VOLUME_NORM;
+
+ pa_log_debug("PA_VOLUME_NORM is %ld", PA_VOLUME_NORM);
+ pa_log_debug("Setting volume %ld %ld", v, info.play.gain);
if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0) {
if (errno == EINVAL)
@@ -513,6 +532,7 @@ static void sink_get_volume(pa_sink *s)
if (ioctl(u->fd, AUDIO_GETINFO, &info) < 0)
pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno));
else
+ pa_log_debug("Getting volume %ld %ld", info.play.gain,
(info.play.gain * PA_VOLUME_NORM / AUDIO_MAX_GAIN));
pa_cvolume_set(&s->real_volume, s->sample_spec.channels,
info.play.gain * PA_VOLUME_NORM / AUDIO_MAX_GAIN);
}
}
@@ -520,14 +540,19 @@ static void sink_get_volume(pa_sink *s)
static void source_set_volume(pa_source *s) {
struct userdata *u;
audio_info_t info;
+ pa_volume_t v;
pa_assert_se(u = s->userdata);
if (u->fd >= 0) {
AUDIO_INITINFO(&info);
- info.play.gain = pa_cvolume_max(&s->real_volume) * AUDIO_MAX_GAIN /
PA_VOLUME_NORM;
- assert(info.play.gain <= AUDIO_MAX_GAIN);
+ v = pa_cvolume_max(&s->real_volume);
+ if (v > PA_VOLUME_NORM) {
+ v = PA_VOLUME_NORM;
+ }
+
+ info.play.gain = v * AUDIO_MAX_GAIN / PA_VOLUME_NORM;
if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0) {
if (errno == EINVAL)
--- pulseaudio-1.1/src/pulse/sample.h-orig 2012-05-14 20:24:44.242497036
-0500
+++ pulseaudio-1.1/src/pulse/sample.h 2012-05-14 20:24:27.792501491 -0500
@@ -117,6 +117,9 @@ PA_C_DECL_BEGIN
#define WORDS_BIGENDIAN
#endif
#endif
+#if defined(_BIG_ENDIAN)
+#define WORDS_BIGENDIAN
+#endif
#endif
/** Maximum number of allowed channels */
_______________________________________________
pulseaudio-discuss mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss