summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authornia <nia@pkgsrc.org>2019-06-13 22:01:56 +0000
committernia <nia@pkgsrc.org>2019-06-13 22:01:56 +0000
commite3d2d49ab12b447a4984b6a21356a726bf7bdfca (patch)
tree3537b7711d3563580d7a24512c26da093f6dc43d /www
parent22154b0fed96e8ae710d1c2714f78e3b567e0a72 (diff)
downloadpkgsrc-e3d2d49ab12b447a4984b6a21356a726bf7bdfca.tar.gz
firefox60: Disable the nonblocking audio code for now.
It seems to cause frame drops at higher latencies.
Diffstat (limited to 'www')
-rw-r--r--www/firefox60/Makefile4
-rw-r--r--www/firefox60/files/cubeb_sun.c49
2 files changed, 21 insertions, 32 deletions
diff --git a/www/firefox60/Makefile b/www/firefox60/Makefile
index ea73b5665b3..0a90d9b3238 100644
--- a/www/firefox60/Makefile
+++ b/www/firefox60/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.27 2019/06/13 14:16:37 nia Exp $
+# $NetBSD: Makefile,v 1.28 2019/06/13 22:01:56 nia Exp $
FIREFOX_VER= ${MOZ_BRANCH}${MOZ_BRANCH_MINOR}
MOZ_BRANCH= 60.7
@@ -6,7 +6,7 @@ MOZ_BRANCH_MINOR= .0esr
DISTNAME= firefox-${FIREFOX_VER}.source
PKGNAME= firefox${MOZ_BRANCH:C/\..*$//}-${MOZ_BRANCH}${MOZ_BRANCH_MINOR:S/b/beta/:S/esr//}
-PKGREVISION= 4
+PKGREVISION= 5
CATEGORIES= www
MASTER_SITES+= ${MASTER_SITE_MOZILLA:=firefox/releases/${FIREFOX_VER}/source/}
EXTRACT_SUFX= .tar.xz
diff --git a/www/firefox60/files/cubeb_sun.c b/www/firefox60/files/cubeb_sun.c
index 341bdcc2a63..92904397ea7 100644
--- a/www/firefox60/files/cubeb_sun.c
+++ b/www/firefox60/files/cubeb_sun.c
@@ -8,7 +8,6 @@
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
-#include <poll.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
@@ -47,7 +46,7 @@
#endif
#ifndef SUN_BUFFER_FRAMES
-#define SUN_BUFFER_FRAMES (32)
+#define SUN_BUFFER_FRAMES (256)
#endif
/*
@@ -97,6 +96,7 @@ struct cubeb_stream {
char input_name[32];
char output_name[32];
uint64_t frames_written;
+ uint64_t blocks_written;
};
int
@@ -434,7 +434,6 @@ sun_io_routine(void * arg)
long to_write = 0;
size_t write_ofs = 0;
size_t read_ofs = 0;
- struct pollfd pfds[1];
int drain = 0;
s->state_cb(s, s->user_ptr, CUBEB_STATE_STARTED);
@@ -479,15 +478,7 @@ sun_io_routine(void * arg)
if (to_write < SUN_BUFFER_FRAMES) {
drain = 1;
}
- pfds[0].fd = s->play_fd;
- if (s->play_fd != -1) {
- if (to_write > 0) {
- pfds[0].events = POLLOUT;
- }
- } else {
- pfds[0].events = 0;
- to_write = 0;
- }
+ to_write = s->play_fd != -1 ? to_write : 0;
to_read = s->record_fd != -1 ? SUN_BUFFER_FRAMES : 0;
write_ofs = 0;
read_ofs = 0;
@@ -495,17 +486,7 @@ sun_io_routine(void * arg)
size_t bytes;
ssize_t n, frames;
- if (pfds[0].events != 0 && poll(pfds, 1, SUN_POLL_TIMEOUT) == -1) {
- LOG("poll failed");
- state = CUBEB_STATE_ERROR;
- break;
- }
- if ((pfds[0].revents & POLLHUP) || (pfds[0].revents & POLLERR)) {
- LOG("audio device disconnected");
- state = CUBEB_STATE_ERROR;
- break;
- }
- if (to_write > 0 && (pfds[0].revents & POLLOUT)) {
+ if (to_write > 0) {
bytes = FRAMES_TO_BYTES(to_write, s->p_info.play.channels);
if ((n = write(s->play_fd, s->play_buf + write_ofs, bytes)) < 0) {
state = CUBEB_STATE_ERROR;
@@ -517,9 +498,6 @@ sun_io_routine(void * arg)
pthread_mutex_unlock(&s->mutex);
to_write -= frames;
write_ofs += frames;
- if (to_write == 0) {
- pfds[0].events = 0;
- }
}
if (to_read > 0) {
bytes = FRAMES_TO_BYTES(to_read, s->r_info.record.channels);
@@ -558,7 +536,6 @@ sun_stream_init(cubeb * context,
cubeb_stream *s = NULL;
(void)stream_name;
- (void)latency_frames;
if ((s = calloc(1, sizeof(cubeb_stream))) == NULL) {
ret = CUBEB_ERROR;
goto error;
@@ -607,7 +584,7 @@ sun_stream_init(cubeb * context,
goto error;
}
if (s->play_fd == -1) {
- if ((s->play_fd = open(s->output_name, O_WRONLY | O_NONBLOCK)) == -1) {
+ if ((s->play_fd = open(s->output_name, O_WRONLY)) == -1) {
LOG("Audio device cannot be opened as write-only");
ret = CUBEB_ERROR_DEVICE_UNAVAILABLE;
goto error;
@@ -677,10 +654,22 @@ sun_stream_start(cubeb_stream * s)
static int
sun_stream_get_position(cubeb_stream * s, uint64_t * position)
{
+#ifdef AUDIO_GETOOFFS
+ struct audio_offset offset;
+
+ if (ioctl(s->play_fd, AUDIO_GETOOFFS, &offset) == -1) {
+ return CUBEB_ERROR;
+ }
+ s->blocks_written += offset.deltablks;
+ *position = BYTES_TO_FRAMES(s->blocks_written * s->p_info.blocksize,
+ s->p_info.play.channels);
+ return CUBEB_OK;
+#else
pthread_mutex_lock(&s->mutex);
*position = s->frames_written;
pthread_mutex_unlock(&s->mutex);
return CUBEB_OK;
+#endif
}
static int
@@ -693,11 +682,11 @@ sun_stream_get_latency(cubeb_stream * stream, uint32_t * latency)
return CUBEB_ERROR;
}
- *latency = BYTES_TO_FRAMES(info.play.seek + info.blocksize,
+ *latency = BYTES_TO_FRAMES(info.play.seek + info.blocksize / 2,
info.play.channels);
return CUBEB_OK;
#else
- cubeb_params params;
+ cubeb_stream_params params;
params.rate = stream->p_info.play.sample_rate;