pkgsrc-Bugs archive

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

pkg/54206: Firefox oss audio, cubeb_stream_init()'s latency unit is frames, not milliseconds.



>Number:         54206
>Category:       pkg
>Synopsis:       Firefox oss audio, cubeb_stream_init()'s latency unit is frames, not milliseconds.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 15 04:50:00 +0000 2019
>Originator:     Y.Sugahara
>Release:        
>Organization:
personal
>Environment:
NetBSD localhost 8.0 NetBSD 8.0 (GENERIC) #0: Tue Jul 17 14:59:51 UTC 2018  mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
Firefox's dom/media/AudioStream.cpp, AudioStream::OpenCubeb() calls
cubeb_stream_init as;

  if (cubeb_stream_init(aContext, &stream, "AudioStream", nullptr, nullptr,
                        deviceID, &aParams, latency_frames, DataCallback_S,
                        StateCallback_S, this) == CUBEB_OK) {

Pass latency parameter is frames.

But, patch-media_libcubeb_src_cubeb__oss.c?rev=1.12
oss_stream_init() pass to latency oss_try_set_latency,

static void oss_try_set_latency(cubeb_stream* stream, unsigned int latency)

+  latency_bytes =
+    latency*stream->params.rate*stream->params.channels*sizeof(uint16_t)/1000;

latency parameter that seems milliseconds.

Then, audio subsystem received x48 hiwat size.

>How-To-Repeat:
play any audio or video by firefox.
>Fix:
diff --git a/www/firefox/patches/patch-media_libcubeb_src_cubeb__oss.c b/www/firefox/patches/patch-media_libcubeb_src_cubeb__oss.c
index b3891eb7ba0..71aa5085481 100644
--- a/www/firefox/patches/patch-media_libcubeb_src_cubeb__oss.c
+++ b/www/firefox/patches/patch-media_libcubeb_src_cubeb__oss.c
@@ -240,6 +240,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__oss.c,v 1.12 2018/11/04 00:38:45 ryoon
 +  return NULL;
 +}
 +
++/* latency: frames */
 +static void oss_try_set_latency(cubeb_stream* stream, unsigned int latency)
 +{
 +  unsigned int latency_bytes, n_frag;
@@ -247,13 +248,14 @@ $NetBSD: patch-media_libcubeb_src_cubeb__oss.c,v 1.12 2018/11/04 00:38:45 ryoon
 +  /* fragment size of 1024 is a good choice with good chances to be accepted */
 +  unsigned int frag_log=10; /* 2^frag_log = fragment size */
 +  latency_bytes =
-+    latency*stream->params.rate*stream->params.channels*sizeof(uint16_t)/1000;
++    latency*stream->params.channels*sizeof(uint16_t);
 +  n_frag = latency_bytes>>frag_log;
 +  frag = (n_frag<<16) | frag_log;
 +  /* Even if this fails we wish to continue, not checking for errors */
 +  ioctl(stream->fd, SNDCTL_DSP_SETFRAGMENT, &frag);
 +}
 +
++/* latency: frames */
 +static int oss_stream_init(cubeb * context, cubeb_stream ** stm,
 +                           char const * stream_name,
 +                           cubeb_devid input_device,


Home | Main Index | Thread Index | Old Index