diff mbox series

[Bluez,v2] audio/transport: Don't set volume if it's invalid

Message ID 20200901115913.Bluez.v2.1.Ieeae14ab680eda03474551fdb7a0a020f950e9c1@changeid (mailing list archive)
State Accepted
Delegated to: Luiz Von Dentz
Headers show
Series [Bluez,v2] audio/transport: Don't set volume if it's invalid | expand

Commit Message

Archie Pusaka Sept. 1, 2020, 4 a.m. UTC
From: Archie Pusaka <apusaka@chromium.org>

Adding a check inside media_transport_update_volume to prevent
the volume being updated with an invalid value.
---

Changes in v2:
* Move the check from media.c:set_configuration

 profiles/audio/transport.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Archie Pusaka Sept. 11, 2020, 12:50 p.m. UTC | #1
Hi Bluez maintainers,

Could you take another look at this patch?

Thanks,
Archie

On Tue, 1 Sep 2020 at 12:00, Archie Pusaka <apusaka@google.com> wrote:
>
> From: Archie Pusaka <apusaka@chromium.org>
>
> Adding a check inside media_transport_update_volume to prevent
> the volume being updated with an invalid value.
> ---
>
> Changes in v2:
> * Move the check from media.c:set_configuration
>
>  profiles/audio/transport.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
> index a2c4f7dfb..dd1c553a2 100644
> --- a/profiles/audio/transport.c
> +++ b/profiles/audio/transport.c
> @@ -941,6 +941,9 @@ void media_transport_update_volume(struct media_transport *transport,
>  {
>         struct a2dp_transport *a2dp = transport->data;
>
> +       if (volume < 0)
> +               return;
> +
>         /* Check if volume really changed */
>         if (a2dp->volume == volume)
>                 return;
> --
> 2.28.0.402.g5ffc5be6b7-goog
>
Luiz Augusto von Dentz Sept. 11, 2020, 3:43 p.m. UTC | #2
Hi Archie,

On Mon, Aug 31, 2020 at 9:00 PM Archie Pusaka <apusaka@google.com> wrote:
>
> From: Archie Pusaka <apusaka@chromium.org>
>
> Adding a check inside media_transport_update_volume to prevent
> the volume being updated with an invalid value.
> ---
>
> Changes in v2:
> * Move the check from media.c:set_configuration
>
>  profiles/audio/transport.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
> index a2c4f7dfb..dd1c553a2 100644
> --- a/profiles/audio/transport.c
> +++ b/profiles/audio/transport.c
> @@ -941,6 +941,9 @@ void media_transport_update_volume(struct media_transport *transport,
>  {
>         struct a2dp_transport *a2dp = transport->data;
>
> +       if (volume < 0)
> +               return;
> +
>         /* Check if volume really changed */
>         if (a2dp->volume == volume)
>                 return;
> --
> 2.28.0.402.g5ffc5be6b7-goog
>

Applied, thanks.
diff mbox series

Patch

diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index a2c4f7dfb..dd1c553a2 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -941,6 +941,9 @@  void media_transport_update_volume(struct media_transport *transport,
 {
 	struct a2dp_transport *a2dp = transport->data;
 
+	if (volume < 0)
+		return;
+
 	/* Check if volume really changed */
 	if (a2dp->volume == volume)
 		return;