NetBSD Problem Report #57436

From www@netbsd.org  Thu May 25 03:09:26 2023
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 04F4C1A9238
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 25 May 2023 03:09:25 +0000 (UTC)
Message-Id: <20230525030437.7055A1A9239@mollari.NetBSD.org>
Date: Thu, 25 May 2023 03:04:37 +0000 (UTC)
From: bmelo@protonmail.com
Reply-To: bmelo@protonmail.com
To: gnats-bugs@NetBSD.org
Subject: audio ubt0 gets disconnected when playing a video on firefox
X-Send-Pr-Version: www-1.0

>Number:         57436
>Category:       kern
>Synopsis:       audio ubt0 gets disconnected when playing a video on firefox
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    nat
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 25 03:10:00 +0000 2023
>Closed-Date:    Tue May 30 13:34:26 +0000 2023
>Last-Modified:  Tue May 30 13:34:26 +0000 2023
>Originator:     Bruno
>Release:        10.0_BETA
>Organization:
>Environment:
NetBSD 10.0_BETA (GENERIC) amd64
>Description:
Using bta2dpd to connect a bluetooth audio device we get disconnected when playing a video in the browser. This only happens in 10.0, not happening in 9.3. I tried 2 audio speakers and both of them get disconnected
>How-To-Repeat:
Just play a youtube video when a device is connected via bta2dpd
>Fix:

>Release-Note:

>Audit-Trail:
From: Nathanial Sloss <nathanialsloss@yahoo.com.au>
To: gnats-bugs@netbsd.org,
 bmelo@protonmail.com
Cc: 
Subject: Re: kern/57436: audio ubt0 gets disconnected when playing a video on firefox
Date: Thu, 25 May 2023 18:32:23 +1000

 Hi,

 Please try again, adding -n to bta2dpd.

 The -n flag stops bta2dpd from closing when audio is closed.

 Best regards,

 Nat

From: Bruno Melo <bmelo@protonmail.com>
To: Nathanial Sloss <nathanialsloss@yahoo.com.au>
Cc: gnats-bugs@netbsd.org
Subject: Re: kern/57436: audio ubt0 gets disconnected when playing a video on firefox
Date: Thu, 25 May 2023 14:27:58 +0000

 Hi,

 I'm not on home now but I'm going to try once I come back home. But last ti=
 me I tried using mpv media player to play an audio and the first output mes=
 sage I got was an "audio: Input/output error". Hope this error is useful.

 I'll keep you informed when I get home. Thanks for the help.

 Sent from ProtonMail, Swiss-based encrypted email.


 ------- Original Message -------
 Em quinta-feira, 25 de maio de 2023 =C3=A0s 05:32, Nathanial Sloss <nathani=
 alsloss@yahoo.com.au> escreveu:


 > Hi,
 >=20
 > Please try again, adding -n to bta2dpd.
 >=20
 > The -n flag stops bta2dpd from closing when audio is closed.
 >=20
 > Best regards,
 >=20
 > Nat

From: Bruno Melo <bmelo@protonmail.com>
To: Nathanial Sloss <nathanialsloss@yahoo.com.au>
Cc: gnats-bugs@netbsd.org
Subject: Re: kern/57436: audio ubt0 gets disconnected when playing a video on firefox
Date: Thu, 25 May 2023 23:32:23 +0000

 Ok, that works. But I got many annoying noises now. This does not help in 9=
 .3.



 Sent from ProtonMail, Swiss-based encrypted email.


 ------- Original Message -------
 Em quinta-feira, 25 de maio de 2023 =C3=A0s 11:27 AM, Bruno Melo <bmelo@pro=
 tonmail.com> escreveu:


 > Hi,
 >=20
 > I'm not on home now but I'm going to try once I come back home. But last =
 time I tried using mpv media player to play an audio and the first output m=
 essage I got was an "audio: Input/output error". Hope this error is useful.
 >=20
 > I'll keep you informed when I get home. Thanks for the help.
 >=20
 > Sent from ProtonMail, Swiss-based encrypted email.
 >=20
 >=20
 >=20
 >=20
 > ------- Original Message -------
 > Em quinta-feira, 25 de maio de 2023 =C3=A0s 05:32, Nathanial Sloss nathan=
 ialsloss@yahoo.com.au escreveu:
 >=20
 >=20
 >=20
 > > Hi,
 > >=20
 > > Please try again, adding -n to bta2dpd.
 > >=20
 > > The -n flag stops bta2dpd from closing when audio is closed.
 > >=20
 > > Best regards,
 > >=20
 > > Nat

From: Nat Sloss <nathanialsloss@yahoo.com.au>
To: Bruno Melo <bmelo@protonmail.com>
Cc: gnats-bugs@netbsd.org
Subject: Re: kern/57436: audio ubt0 gets disconnected when playing a video on firefox
Date: Fri, 26 May 2023 14:22:13 +1000

 On Fri, 26 May 2023 09:32:23 Bruno Melo wrote:
 > Ok, that works. But I got many annoying noises now. This does not help in
 > 93.
 >

 It's highly likely that the change that introduced -n needs to be pulled up=
  to=20
 9.3.

 Can you confirm this by building a current/NetBSD-10 bta2dpd and trying it =
 on=20
 NetBSD 9.3?

 cd /usr/src/usr.sbin/bta2dpd
 make MAKEOBJDIR=3D/tmp obj

 make MAKEOBJDIR=3D/tmp

 on your netbsd 9 box and run /tmp/bta2dpd with the -n switch


 >=20
 >=20
 > Sent from ProtonMail, Swiss-based encrypted email.
 >=20
 >=20
 > ------- Original Message -------
 >=20
 > Em quinta-feira, 25 de maio de 2023 =C3=A0s 11:27 AM, Bruno Melo=20
 <bmelo@protonmail.com> escreveu:
 > > Hi,
 > >=20
 > > I'm not on home now but I'm going to try once I come back home. But last
 > > time I tried using mpv media player to play an audio and the first
 > > output message I got was an "audio: Input/output error". Hope this error
 > > is useful.
 > >=20
 > > I'll keep you informed when I get home. Thanks for the help.
 > >=20
 > > Sent from ProtonMail, Swiss-based encrypted email.
 > >=20
 > >=20
 > >=20
 > >=20
 > > ------- Original Message -------
 > >=20
 > > Em quinta-feira, 25 de maio de 2023 =C3=A0s 05:32, Nathanial Sloss=20
 nathanialsloss@yahoo.com.au escreveu:
 > > > Hi,
 > > >=20
 > > > Please try again, adding -n to bta2dpd.
 > > >=20
 > > > The -n flag stops bta2dpd from closing when audio is closed.
 > > >=20
 > > > Best regards,
 > > >=20
 > > > Nat

From: "Nathanial Sloss" <nat@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57436 CVS commit: src/sys/dev/pad
Date: Fri, 26 May 2023 10:39:56 +0000

 Module Name:	src
 Committed By:	nat
 Date:		Fri May 26 10:39:56 UTC 2023

 Modified Files:
 	src/sys/dev/pad: pad.c

 Log Message:
 Fix logic for timing.

 Addresses PR/57436.

 XXX pullup-10.


 To generate a diff of this commit:
 cvs rdiff -u -r1.82 -r1.83 src/sys/dev/pad/pad.c

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

Responsible-Changed-From-To: kern-bug-people->nat
Responsible-Changed-By: nat@NetBSD.org
Responsible-Changed-When: Fri, 26 May 2023 10:44:27 +0000
Responsible-Changed-Why:
Take.


State-Changed-From-To: open->feedback
State-Changed-By: nat@NetBSD.org
State-Changed-When: Fri, 26 May 2023 10:44:27 +0000
State-Changed-Why:
Can you please try a -current kernel after 20230527 to see if it works.


From: Bruno Melo <bmelo@protonmail.com>
To: gnats-bugs@netbsd.org
Cc: nat@netbsd.org, kern-bug-people@netbsd.org, netbsd-bugs@netbsd.org, gnats-admin@netbsd.org
Subject: Re: kern/57436 (audio ubt0 gets disconnected when playing a video on firefox)
Date: Fri, 26 May 2023 12:43:05 +0000

 Hi,

 Is this fixing the noises?



 Sent from ProtonMail, Swiss-based encrypted email.


 ------- Original Message -------
 Em sexta-feira, 26 de maio de 2023 =C3=A0s 07:44, nat@NetBSD.org <nat@NetBS=
 D.org> escreveu:


 > Synopsis: audio ubt0 gets disconnected when playing a video on firefox
 >=20
 > Responsible-Changed-From-To: kern-bug-people->nat
 >=20
 > Responsible-Changed-By: nat@NetBSD.org
 > Responsible-Changed-When: Fri, 26 May 2023 10:44:27 +0000
 > Responsible-Changed-Why:
 > Take.
 >=20
 >=20
 > State-Changed-From-To: open->feedback
 >=20
 > State-Changed-By: nat@NetBSD.org
 > State-Changed-When: Fri, 26 May 2023 10:44:27 +0000
 > State-Changed-Why:
 > Can you please try a -current kernel after 20230527 to see if it works.
 > 

From: Nathanial Sloss <nathanialsloss@yahoo.com.au>
To: Bruno Melo <bmelo@protonmail.com>
Cc: gnats-bugs@netbsd.org,
 kern-bug-people@netbsd.org,
 netbsd-bugs@netbsd.org,
 gnats-admin@netbsd.org
Subject: Re: kern/57436 (audio ubt0 gets disconnected when playing a video on firefox)
Date: Fri, 26 May 2023 23:05:14 +1000

 Yes it should fix playback on NetBSD10 when its been pulled up.

 For now please try a current kernel in a day, so auto builds complete to 
 confirm that it's fixed.


 Best regards,

 Nat

From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: PR/57436 CVS commit: src/sys/dev/pad
Date: Sat, 27 May 2023 05:38:50 -0000 (UTC)

 nat@netbsd.org ("Nathanial Sloss") writes:

 > Module Name:	src
 > Committed By:	nat
 > Date:		Fri May 26 10:39:56 UTC 2023
 > 
 > Modified Files:
 > 	src/sys/dev/pad: pad.c
 > 
 > Log Message:
 > Fix logic for timing.


 This and the following change break the "high precision" timing
 that I added for netbsd-10.

 In netbsd-9 pad(4) would just block until the whole userland buffer
 was filled, making it impossible to actually 'time' I/O to what
 the audio driver produces unless you know exactly what data it will
 produce (or do single sample reads).

 With the 'high precision' timing, you would get short reads with
 data blocks as they get produced. This might be what broke bta2dpd.

 With this 'fix' pad(4) will just return end-of-file when no data is
 available, breaking almost every user.

From: "Nathanial Sloss" <nat@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57436 CVS commit: src/sys/dev/pad
Date: Sat, 27 May 2023 14:51:47 +0000

 Module Name:	src
 Committed By:	nat
 Date:		Sat May 27 14:51:47 UTC 2023

 Modified Files:
 	src/sys/dev/pad: pad.c

 Log Message:
 Revert to previous.

 This change broke the intention of recent changes to pad(4).

 The solution to address PR/57436 must be done in bta2dpd(8).


 To generate a diff of this commit:
 cvs rdiff -u -r1.84 -r1.85 src/sys/dev/pad/pad.c

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

From: Bruno Melo <bmelo@protonmail.com>
To: gnats-bugs@netbsd.org
Cc: nat@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: PR/57436 CVS commit: src/sys/dev/pad
Date: Sat, 27 May 2023 18:09:52 +0000

 Hi nat,

 I'm reporting this PR/57443 too related to uaudio bug. If you can check the=
 n I can test both fixes at once.

 Thanks.

 Sent from ProtonMail, Swiss-based encrypted email.


 ------- Original Message -------
 Em s=C3=A1bado, 27 de maio de 2023 =C3=A0s 11:55 AM, Nathanial Sloss <nat@n=
 etbsd.org> escreveu:


 > The following reply was made to PR kern/57436; it has been noted by GNATS=
 .
 >=20
 > From: "Nathanial Sloss" nat@netbsd.org
 >=20
 > To: gnats-bugs@gnats.NetBSD.org
 > Cc:
 > Subject: PR/57436 CVS commit: src/sys/dev/pad
 > Date: Sat, 27 May 2023 14:51:47 +0000
 >=20
 > Module Name: src
 > Committed By: nat
 > Date: Sat May 27 14:51:47 UTC 2023
 >=20
 > Modified Files:
 > src/sys/dev/pad: pad.c
 >=20
 > Log Message:
 > Revert to previous.
 >=20
 > This change broke the intention of recent changes to pad(4).
 >=20
 > The solution to address PR/57436 must be done in bta2dpd(8).
 >=20
 >=20
 > To generate a diff of this commit:
 > cvs rdiff -u -r1.84 -r1.85 src/sys/dev/pad/pad.c
 >=20
 > Please note that diffs are not public domain; they are subject to the
 > copyright notices on the relevant files.

From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: PR/57436 CVS commit: src/sys/dev/pad
Date: Sun, 28 May 2023 06:35:32 -0000 (UTC)

 bmelo@protonmail.com (Bruno Melo) writes:

 >The following reply was made to PR kern/57436; it has been noted by GNATS.

 >From: Bruno Melo <bmelo@protonmail.com>
 >To: gnats-bugs@netbsd.org
 >Cc: nat@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
 >Subject: Re: PR/57436 CVS commit: src/sys/dev/pad
 >Date: Sat, 27 May 2023 18:09:52 +0000

 > Hi nat,
 > 
 > I'm reporting this PR/57443 too related to uaudio bug. If you can check the=
 > n I can test both fixes at once.


 Replacing the single read in bta2dpd with a read loop (to collect
 data from partial reads) should restore the old behaviour.

 http://ftp.netbsd.org/pub/NetBSD/misc/mlelstv/bta2dpd.diff

 Index: usr.sbin/bta2dpd/bta2dpd/sbc_encode.c
 ===================================================================
 RCS file: /cvsroot/src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c,v
 retrieving revision 1.10
 diff -p -u -r1.10 sbc_encode.c
 --- usr.sbin/bta2dpd/bta2dpd/sbc_encode.c	21 Sep 2019 00:01:33 -0000	1.10
 +++ usr.sbin/bta2dpd/bta2dpd/sbc_encode.c	28 May 2023 06:32:56 -0000
 @@ -813,6 +813,29 @@ make_frame(uint8_t *frame, int16_t *inpu
  	return frame - frameStart;
  }

 +static ssize_t
 +readloop(int fd, void *buf, size_t nbytes)
 +{
 +	size_t count;
 +	ssize_t ret;
 +
 +	count = 0;
 +	while (nbytes > 0) {
 +		ret = read(fd, ((char *)buf) + count, nbytes);
 +		if (ret < 0) {
 +			if (count == 0)
 +				return ret;
 +			break;
 +		}
 +		if (ret == 0)
 +			break;
 +		count += (size_t)ret;
 +		nbytes -= (size_t)ret;
 +	}
 +
 +	return (ssize_t) count;
 +}
 +
  ssize_t
  stream(int in, int outfd, uint8_t mode, uint8_t freq, uint8_t bands, uint8_t
      blocks, uint8_t alloc_method, uint8_t bitpool, size_t mtu, int volume)
 @@ -891,7 +914,7 @@ stream(int in, int outfd, uint8_t mode, 
  	pkt_len = 80;
  	while (totalSize + ((size_t)pkt_len * 2) <= mtu) {

 -		len = read(in, music, readsize);
 +		len = readloop(in, music, readsize);
  		if (len < (int)readsize)
  			break;



 Greetings,

From: Nathanial Sloss <nathanialsloss@yahoo.com.au>
To: gnats-bugs@netbsd.org,
 mlelstv@serpens.de
Cc: gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org,
 bmelo@protonmail.com
Subject: Re: PR/57436 CVS commit: src/sys/dev/pad
Date: Sun, 28 May 2023 17:20:17 +1000

 Can you commit this and I'll request pullups for 10.

 Verifying working on all of my bluetooth speakers thanks for doing this.

 Best regards,

 Nat

 On Sun, 28 May 2023 16:40:02 Michael van Elst wrote:
 > The following reply was made to PR kern/57436; it has been noted by GNATS.
 > 
 > From: mlelstv@serpens.de (Michael van Elst)
 > To: gnats-bugs@netbsd.org
 > Cc:
 > Subject: Re: PR/57436 CVS commit: src/sys/dev/pad
 > Date: Sun, 28 May 2023 06:35:32 -0000 (UTC)
 > 
 >  bmelo@protonmail.com (Bruno Melo) writes:
 >  >The following reply was made to PR kern/57436; it has been noted by
 >  >GNATS.
 >  >
 >  >From: Bruno Melo <bmelo@protonmail.com>
 >  >To: gnats-bugs@netbsd.org
 >  >Cc: nat@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
 >  >Subject: Re: PR/57436 CVS commit: src/sys/dev/pad
 >  >Date: Sat, 27 May 2023 18:09:52 +0000
 >  >
 >  > Hi nat,
 >  > 
 >  > I'm reporting this PR/57443 too related to uaudio bug. If you can check
 >  > the= n I can test both fixes at once.
 > 
 >  Replacing the single read in bta2dpd with a read loop (to collect
 >  data from partial reads) should restore the old behaviour.
 > 
 >  http://ftp.netbsd.org/pub/NetBSD/misc/mlelstv/bta2dpd.diff
 > 
 >  Index: usr.sbin/bta2dpd/bta2dpd/sbc_encode.c
 >  ===================================================================
 >  RCS file: /cvsroot/src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c,v
 >  retrieving revision 1.10
 >  diff -p -u -r1.10 sbc_encode.c
 >  --- usr.sbin/bta2dpd/bta2dpd/sbc_encode.c	21 Sep 2019 00:01:33 -0000	
 1.10
 >  +++ usr.sbin/bta2dpd/bta2dpd/sbc_encode.c	28 May 2023 06:32:56 -0000
 >  @@ -813,6 +813,29 @@ make_frame(uint8_t *frame, int16_t *inpu
 >   	return frame - frameStart;
 >   }
 > 
 >  +static ssize_t
 >  +readloop(int fd, void *buf, size_t nbytes)
 >  +{
 >  +	size_t count;
 >  +	ssize_t ret;
 >  +
 >  +	count = 0;
 >  +	while (nbytes > 0) {
 >  +		ret = read(fd, ((char *)buf) + count, nbytes);
 >  +		if (ret < 0) {
 >  +			if (count == 0)
 >  +				return ret;
 >  +			break;
 >  +		}
 >  +		if (ret == 0)
 >  +			break;
 >  +		count += (size_t)ret;
 >  +		nbytes -= (size_t)ret;
 >  +	}
 >  +
 >  +	return (ssize_t) count;
 >  +}
 >  +
 >   ssize_t
 >   stream(int in, int outfd, uint8_t mode, uint8_t freq, uint8_t bands,
 > uint8_t blocks, uint8_t alloc_method, uint8_t bitpool, size_t mtu, int
 > volume) @@ -891,7 +914,7 @@ stream(int in, int outfd, uint8_t mode,
 >   	pkt_len = 80;
 >   	while (totalSize + ((size_t)pkt_len * 2) <= mtu) {
 > 
 >  -		len = read(in, music, readsize);
 >  +		len = readloop(in, music, readsize);
 >   		if (len < (int)readsize)
 >   			break;
 > 
 > 
 > 
 >  Greetings,

From: Michael van Elst <mlelstv@serpens.de>
To: Nathanial Sloss <nathanialsloss@yahoo.com.au>
Cc: gnats-bugs@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
	bmelo@protonmail.com
Subject: Re: PR/57436 CVS commit: src/sys/dev/pad
Date: Sun, 28 May 2023 10:02:26 +0200

 On Sun, May 28, 2023 at 05:20:17PM +1000, Nathanial Sloss wrote:
 > Can you commit this and I'll request pullups for 10.
 > 
 > Verifying working on all of my bluetooth speakers thanks for doing this.


 Good to hear. I have committed that patch.

 This should also make it possible for bta2dpd to read safely from a pipe.
 Maybe we can add handling for a '-' filename as 'stdin' ?

 > 
 > Best regards,
 > 
 > Nat

 Greetings,
 -- 
                                 Michael van Elst
 Internet: mlelstv@serpens.de
                                 "A potential Snark may lurk in every tree."

From: Bruno Melo <bmelo@protonmail.com>
To: gnats-bugs@netbsd.org
Cc: nat@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: PR/57436 CVS commit: src/sys/dev/pad
Date: Mon, 29 May 2023 00:29:20 +0000

 I confirm: this works!

 Thanks guys.



 Sent from ProtonMail, Swiss-based encrypted email.


 ------- Original Message -------
 Em domingo, 28 de maio de 2023 =C3=A0s 3:40 AM, mlelstv@serpens.de <mlelstv=
 @serpens.de> escreveu:


 > The following reply was made to PR kern/57436; it has been noted by GNATS=
 .
 >=20
 > From: mlelstv@serpens.de (Michael van Elst)
 > To: gnats-bugs@netbsd.org
 > Cc:
 > Subject: Re: PR/57436 CVS commit: src/sys/dev/pad
 > Date: Sun, 28 May 2023 06:35:32 -0000 (UTC)
 >=20
 > bmelo@protonmail.com (Bruno Melo) writes:
 >=20
 > > The following reply was made to PR kern/57436; it has been noted by GNA=
 TS.
 >=20
 > > From: Bruno Melo bmelo@protonmail.com
 >=20
 > > To: gnats-bugs@netbsd.org
 >=20
 > > Cc: nat@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
 >=20
 > > Subject: Re: PR/57436 CVS commit: src/sys/dev/pad
 >=20
 > > Date: Sat, 27 May 2023 18:09:52 +0000
 >=20
 > > Hi nat,
 >=20
 > > I'm reporting this PR/57443 too related to uaudio bug. If you can check=
  the=3D
 >=20
 > > n I can test both fixes at once.
 >=20
 >=20
 >=20
 > Replacing the single read in bta2dpd with a read loop (to collect
 > data from partial reads) should restore the old behaviour.
 >=20
 > http://ftp.netbsd.org/pub/NetBSD/misc/mlelstv/bta2dpd.diff
 >=20
 > Index: usr.sbin/bta2dpd/bta2dpd/sbc_encode.c
 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 > RCS file: /cvsroot/src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c,v
 > retrieving revision 1.10
 > diff -p -u -r1.10 sbc_encode.c
 > --- usr.sbin/bta2dpd/bta2dpd/sbc_encode.c 21 Sep 2019 00:01:33 -0000 1.10
 > +++ usr.sbin/bta2dpd/bta2dpd/sbc_encode.c 28 May 2023 06:32:56 -0000
 > @@ -813,6 +813,29 @@ make_frame(uint8_t *frame, int16_t *inpu
 > return frame - frameStart;
 > }
 >=20
 > +static ssize_t
 > +readloop(int fd, void *buf, size_t nbytes)
 > +{
 > + size_t count;
 > + ssize_t ret;
 > +
 > + count =3D 0;
 > + while (nbytes > 0) {
 >=20
 > + ret =3D read(fd, ((char *)buf) + count, nbytes);
 > + if (ret < 0) {
 > + if (count =3D=3D 0)
 > + return ret;
 > + break;
 > + }
 > + if (ret =3D=3D 0)
 > + break;
 > + count +=3D (size_t)ret;
 > + nbytes -=3D (size_t)ret;
 > + }
 > +
 > + return (ssize_t) count;
 > +}
 > +
 > ssize_t
 > stream(int in, int outfd, uint8_t mode, uint8_t freq, uint8_t bands, uint=
 8_t
 > blocks, uint8_t alloc_method, uint8_t bitpool, size_t mtu, int volume)
 > @@ -891,7 +914,7 @@ stream(int in, int outfd, uint8_t mode,
 > pkt_len =3D 80;
 > while (totalSize + ((size_t)pkt_len * 2) <=3D mtu) {
 >=20
 > - len =3D read(in, music, readsize);
 > + len =3D readloop(in, music, readsize);
 > if (len < (int)readsize)
 > break;
 >=20
 >=20
 >=20
 > Greetings,

State-Changed-From-To: feedback->pending-pullups
State-Changed-By: nat@NetBSD.org
State-Changed-When: Tue, 30 May 2023 13:33:34 +0000
State-Changed-Why:
pullup-10 #184


State-Changed-From-To: pending-pullups->closed
State-Changed-By: nat@NetBSD.org
State-Changed-When: Tue, 30 May 2023 13:34:26 +0000
State-Changed-Why:
Pullups completed.  Thanks for the report.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.