Page MenuHomeFreeBSD

D28250.diff
No OneTemporary

D28250.diff

Index: www/firefox/files/patch-freebsd11
===================================================================
--- www/firefox/files/patch-freebsd11
+++ /dev/null
@@ -1,21 +0,0 @@
-Drop after FreeBSD 11 EOL, see https://svnweb.freebsd.org/changeset/base/303524
-
-media/libcubeb/src/cubeb_oss.c:362:10: error: implicit declaration of function 'getline' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
- while (getline(&line, &linecap, sndstatfp) > 0) {
- ^
-media/libcubeb/src/cubeb_oss.c:850:13: warning: comparison of integers of different signs: 'long' and 'unsigned int' [-Wsign-compare]
- if (nfr > s->bufframes) {
- ~~~ ^ ~~~~~~~~~~~~
-
---- media/libcubeb/src/cubeb_oss.c.orig 2020-12-07 23:35:05 UTC
-+++ media/libcubeb/src/cubeb_oss.c
-@@ -10,6 +10,9 @@
- * accompanying file LICENSE for details.
- */
-
-+#if defined(__FreeBSD__) && __FreeBSD__ < 12
-+#define _WITH_GETLINE
-+#endif
- #include <assert.h>
- #include <ctype.h>
- #include <limits.h>
Index: www/firefox/files/patch-media_libcubeb_src_cubeb__oss.c
===================================================================
--- /dev/null
+++ www/firefox/files/patch-media_libcubeb_src_cubeb__oss.c
@@ -0,0 +1,90 @@
+Drop _WITH_GETLINE changes after FreeBSD 11 EOL, see https://svnweb.freebsd.org/changeset/base/303524
+
+media/libcubeb/src/cubeb_oss.c:362:10: error: implicit declaration of function 'getline' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
+ while (getline(&line, &linecap, sndstatfp) > 0) {
+ ^
+media/libcubeb/src/cubeb_oss.c:850:13: warning: comparison of integers of different signs: 'long' and 'unsigned int' [-Wsign-compare]
+ if (nfr > s->bufframes) {
+ ~~~ ^ ~~~~~~~~~~~~
+
+--- media/libcubeb/src/cubeb_oss.c.orig
++++ media/libcubeb/src/cubeb_oss.c
+@@ -10,6 +10,9 @@
+ * accompanying file LICENSE for details.
+ */
+
++#if defined(__FreeBSD__) && __FreeBSD__ < 12
++#define _WITH_GETLINE
++#endif
+ #include <assert.h>
+ #include <ctype.h>
+ #include <limits.h>
+@@ -781,6 +784,28 @@ oss_put_play_frames(cubeb_stream * s, unsigned int nfr
+ return 0;
+ }
+
++static int
++oss_wait_playfd_for_space(cubeb_stream * s)
++{
++ /* For non-duplex stream we have to wait until we have space in the
++ * buffer */
++ int rate = s->play.info.sample_rate;
++ struct pollfd pfd;
++
++ pfd.events = POLLOUT|POLLHUP;
++ pfd.revents = 0;
++ pfd.fd = s->play.fd;
++
++ if (poll(&pfd, 1, s->nfr * 1000 + rate - 1 / rate) == -1) {
++ return CUBEB_ERROR;
++ }
++
++ if (pfd.revents & POLLHUP) {
++ return CUBEB_ERROR;
++ }
++ return 0;
++}
++
+ /* 1 - Stopped by cubeb_stream_stop, otherwise 0 */
+ static int
+ oss_audio_loop(cubeb_stream * s, cubeb_state *new_state)
+@@ -873,26 +898,31 @@ oss_audio_loop(cubeb_stream * s, cubeb_state *new_stat
+ goto breakdown;
+ }
+
+- audio_buf_info bi;
+ if (play_on) {
+- if (ioctl(s->play.fd, SNDCTL_DSP_GETOSPACE, &bi)) {
+- state = CUBEB_STATE_ERROR;
+- goto breakdown;
+- }
+ /*
+ * In duplex mode, playback direction drives recording direction to
+ * prevent building up latencies.
+ */
++
++ if (oss_wait_playfd_for_space(s) != 0) {
++ state = CUBEB_STATE_ERROR;
++ goto breakdown;
++ }
++
++ audio_buf_info bi;
++ if (ioctl(s->play.fd, SNDCTL_DSP_GETOSPACE, &bi)) {
++ state = CUBEB_STATE_ERROR;
++ goto breakdown;
++ }
+ nfr = bi.fragsize * bi.fragments / s->play.frame_size;
+ if (nfr > s->bufframes) {
+ nfr = s->bufframes;
+ }
++ } else {
++ nfr = s->nfr;
+ }
+
+ if (record_on) {
+- if (nfr == 0) {
+- nfr = s->nfr;
+- }
+ if (oss_get_rec_frames(s, nfr) == CUBEB_ERROR) {
+ state = CUBEB_STATE_ERROR;
+ goto breakdown;

File Metadata

Mime Type
text/plain
Expires
Wed, Jun 24, 1:14 AM (7 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34266984
Default Alt Text
D28250.diff (3 KB)

Event Timeline