diff mbox series

[BlueZ,v2,1/2] client/player: Fix calculation of number of packet

Message ID 20240419202341.1635591-1-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Commit 92c1c1c366119c344e60f5025503c8ee97927c65
Headers show
Series [BlueZ,v2,1/2] client/player: Fix calculation of number of packet | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Luiz Augusto von Dentz April 19, 2024, 8:23 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

The calculation shall attempt to round to number of packets to the
closest integer otherwise it can result in 0 packets to be sent at each
latency.
---
 client/player.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

bluez.test.bot@gmail.com April 19, 2024, 10:27 p.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=846226

---Test result---

Test Summary:
CheckPatch                    PASS      0.55 seconds
GitLint                       PASS      0.41 seconds
BuildEll                      PASS      24.69 seconds
BluezMake                     PASS      1676.42 seconds
MakeCheck                     PASS      12.84 seconds
MakeDistcheck                 PASS      178.48 seconds
CheckValgrind                 PASS      247.63 seconds
CheckSmatch                   PASS      353.43 seconds
bluezmakeextell               PASS      119.86 seconds
IncrementalBuild              PASS      2962.74 seconds
ScanBuild                     PASS      1017.77 seconds



---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org April 22, 2024, 3:40 p.m. UTC | #2
Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Fri, 19 Apr 2024 16:23:40 -0400 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> The calculation shall attempt to round to number of packets to the
> closest integer otherwise it can result in 0 packets to be sent at each
> latency.
> ---
>  client/player.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Here is the summary with links:
  - [BlueZ,v2,1/2] client/player: Fix calculation of number of packet
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=92c1c1c36611
  - [BlueZ,v2,2/2] client/player: Fix using unicast QoS for broadcast
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=04153538aaf4

You are awesome, thank you!
diff mbox series

Patch

diff --git a/client/player.c b/client/player.c
index 1f56bfd270f6..65f771039258 100644
--- a/client/player.c
+++ b/client/player.c
@@ -63,6 +63,7 @@ 
 #define NSEC_USEC(_t) (_t / 1000L)
 #define SEC_USEC(_t)  (_t  * 1000000L)
 #define TS_USEC(_ts)  (SEC_USEC((_ts)->tv_sec) + NSEC_USEC((_ts)->tv_nsec))
+#define ROUND_CLOSEST(_x, _y) (((_x) + (_y / 2)) / (_y))
 
 #define EP_SRC_LOCATIONS 0x00000003
 #define EP_SNK_LOCATIONS 0x00000003
@@ -5031,8 +5032,9 @@  static bool transport_timer_read(struct io *io, void *user_data)
 		return false;
 	}
 
-	/* num of packets = latency (ms) / interval (us) */
-	num = (qos.ucast.out.latency * 1000 / qos.ucast.out.interval);
+	/* num of packets = ROUND_CLOSEST(latency (ms) / interval (us)) */
+	num = ROUND_CLOSEST(qos.ucast.out.latency * 1000,
+				qos.ucast.out.interval);
 
 	ret = transport_send_seq(transport, transport->fd, num);
 	if (ret < 0) {