pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/www/firefox60



Module Name:    pkgsrc
Committed By:   nia
Date:           Thu Jun 13 22:01:56 UTC 2019

Modified Files:
        pkgsrc/www/firefox60: Makefile
        pkgsrc/www/firefox60/files: cubeb_sun.c

Log Message:
firefox60: Disable the nonblocking audio code for now.

It seems to cause frame drops at higher latencies.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 pkgsrc/www/firefox60/Makefile
cvs rdiff -u -r1.1 -r1.2 pkgsrc/www/firefox60/files/cubeb_sun.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/www/firefox60/Makefile
diff -u pkgsrc/www/firefox60/Makefile:1.27 pkgsrc/www/firefox60/Makefile:1.28
--- pkgsrc/www/firefox60/Makefile:1.27  Thu Jun 13 14:16:37 2019
+++ pkgsrc/www/firefox60/Makefile       Thu Jun 13 22:01:56 2019
@@ -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

Index: pkgsrc/www/firefox60/files/cubeb_sun.c
diff -u pkgsrc/www/firefox60/files/cubeb_sun.c:1.1 pkgsrc/www/firefox60/files/cubeb_sun.c:1.2
--- pkgsrc/www/firefox60/files/cubeb_sun.c:1.1  Thu Jun 13 14:16:37 2019
+++ pkgsrc/www/firefox60/files/cubeb_sun.c      Thu Jun 13 22:01:56 2019
@@ -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 * st
     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;
 



Home | Main Index | Thread Index | Old Index