-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bluetooth: Audio: Rename bt_audio_codec_qos -> bt_bap_qos_cfg #76633
Conversation
include/zephyr/bluetooth/audio/bap.h
Outdated
* Unlike the other fields, this is not a preference but a minimum requirement. | ||
* | ||
* Value range 0 to @ref BT_AUDIO_PD_MAX, or @ref BT_AUDIO_PD_PREF_NONE | ||
* to indicate no preference. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation for the presentation delay fields seem wrong. Although fixing this is not strictly part of this PR it may as well be done here, instead of creating a separate PR for fixing it.
* Unlike the other fields, this is not a preference but a minimum requirement. | |
* | |
* Value range 0 to @ref BT_AUDIO_PD_MAX, or @ref BT_AUDIO_PD_PREF_NONE | |
* to indicate no preference. | |
* Unlike the other fields, this is not a preference but a minimum requirement. | |
* | |
* Value range 0 to @ref BT_AUDIO_PD_MIN |
include/zephyr/bluetooth/audio/bap.h
Outdated
/** | ||
* @brief Preferred minimum Presentation Delay | ||
* | ||
* Value range 0 to @ref BT_AUDIO_PD_MAX. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Value range 0 to @ref BT_AUDIO_PD_MAX. | |
* Value range pd_min to pref_pd_max, or @ref BT_AUDIO_PD_PREF_NONE | |
* to indicate no preference. |
include/zephyr/bluetooth/audio/bap.h
Outdated
* Value range 0 to @ref BT_AUDIO_PD_MAX, or @ref BT_AUDIO_PD_PREF_NONE | ||
* to indicate no preference. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Value range 0 to @ref BT_AUDIO_PD_MAX, or @ref BT_AUDIO_PD_PREF_NONE | |
* to indicate no preference. | |
* Value range 0 to @ref BT_AUDIO_PD_MAX |
include/zephyr/bluetooth/audio/bap.h
Outdated
/** | ||
* @brief Preferred maximum Presentation Delay | ||
* | ||
* Value range 0 to @ref BT_AUDIO_PD_MAX. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Value range 0 to @ref BT_AUDIO_PD_MAX. | |
* Value range pref_pd_min to px_max, or @ref BT_AUDIO_PD_PREF_NONE | |
* to indicate no preference. |
include/zephyr/bluetooth/audio/bap.h
Outdated
uint32_t pd_min; | ||
|
||
/** | ||
* @brief Maximum Presentation Delay |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @brief Maximum Presentation Delay | |
* @brief Maximum Presentation Delay in microseconds |
include/zephyr/bluetooth/audio/bap.h
Outdated
uint32_t pd_max; | ||
|
||
/** | ||
* @brief Preferred minimum Presentation Delay |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @brief Preferred minimum Presentation Delay | |
* @brief Preferred minimum Presentation Delay in microseconds |
include/zephyr/bluetooth/audio/bap.h
Outdated
uint32_t pref_pd_min; | ||
|
||
/** | ||
* @brief Preferred maximum Presentation Delay |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @brief Preferred maximum Presentation Delay | |
* @brief Preferred maximum Presentation Delay in microseconds |
@kruithofa would prefer not to modify more than necessary in this PR. It will likely conflict with #75763 and once one of them is one, I can update the remaining PR with your comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comments will be handled in a separate PR, that's ok with me.
Rebased to solve merge conflicts |
bf1873f
to
91a22a5
Compare
91a22a5
to
4f07a80
Compare
Rebased to solve merge conflicts |
4f07a80
to
750874b
Compare
Rebased to solve merge conflicts |
750874b
to
a22f16d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Just 2 comments to address
subsys/bluetooth/audio/bap_stream.c
Outdated
LOG_DBG("Invalid combination of pref_pd_min %u, pd_min %u and pd_max: %u", | ||
qos_pref->pref_pd_min, qos_pref->pd_min, qos_pref->pd_max); | ||
|
||
return false; | ||
} | ||
|
||
if (qos_pref->pref_pd_max < qos_pref->pref_pd_min) { | ||
if (qos_pref->pref_pd_max != BT_AUDIO_PD_PREF_NONE && | ||
qos_pref->pref_pd_max < qos_pref->pref_pd_min) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if qos_pref->pref_pd_min == BT_AUDIO_PD_PREF_NONE ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then qos_pref->pref_pd_max < qos_pref->pref_pd_min
is applied, ensuring that our pref_pd_max
is greater or equal than pref_pd_min
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be:
if (qos_pref->pref_pd_max != BT_AUDIO_PD_PREF_NONE &&
qos_pref->pref_pd_min != BT_AUDIO_PD_PREF_NONE &&
qos_pref->pref_pd_max < qos_pref->pref_pd_min) {
subsys/bluetooth/audio/bap_stream.c
Outdated
* the ASCS spec, but should also be >= MAX(pd_min, pref_pd_min) | ||
*/ | ||
if (qos_pref->pref_pd_max != BT_AUDIO_PD_PREF_NONE) { | ||
const uint32_t min_val = qos_pref->pref_pd_min == BT_AUDIO_PD_PREF_NONE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the need for the min_val calculation. Above we have validated that
pd_min <= pref_pd_min <= pd_max
and
pref_pd_max >= pref_pd_min
We only need to validate
pd_min <= pref_pd_max <= pd_max
So just keep the old inrange check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case that qos_pref->pref_pd_min == BT_AUDIO_PD_PREF_NONE
then neither the pd_min <= pref_pd_min <= pd_max
nor pref_pd_max >= pref_pd_min
checks are performed.
So if
pref_pd_min == BT_AUDIO_PD_PREF_NONE
thenpref_pd_max
shall be greater or equal topd_min
pref_pd_min != BT_AUDIO_PD_PREF_NONE
thenpref_pd_max
shall be greater or equal topref_pd_min
But you are right that MAX(qos_pref->pd_min, qos_pref->pref_pd_min)
can be replaced with pref_pd_min
, as pref_pd_min >= pd_min
if pref_pd_min != BT_AUDIO_PD_PREF_NONE
.
Actually the calculation can simply be const uint32_t min_val = MAX(qos_pref->pd_min, qos_pref->pref_pd_min)
a22f16d
to
492099e
Compare
subsys/bluetooth/audio/bap_stream.c
Outdated
LOG_DBG("Invalid combination of pref_pd_min %u, pd_min %u and pd_max: %u", | ||
qos_pref->pref_pd_min, qos_pref->pd_min, qos_pref->pd_max); | ||
|
||
return false; | ||
} | ||
|
||
if (qos_pref->pref_pd_max < qos_pref->pref_pd_min) { | ||
if (qos_pref->pref_pd_max != BT_AUDIO_PD_PREF_NONE && | ||
qos_pref->pref_pd_max < qos_pref->pref_pd_min) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be:
if (qos_pref->pref_pd_max != BT_AUDIO_PD_PREF_NONE &&
qos_pref->pref_pd_min != BT_AUDIO_PD_PREF_NONE &&
qos_pref->pref_pd_max < qos_pref->pref_pd_min) {
subsys/bluetooth/audio/bap_stream.c
Outdated
/* If pref_pd_max is not BT_AUDIO_PD_PREF_NONE then it shall pref_pd_max <= pd_max as per | ||
* the ASCS spec, but should also be >= MAX(pd_min, pref_pd_min) | ||
*/ | ||
if (qos_pref->pref_pd_max != BT_AUDIO_PD_PREF_NONE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should just be:
if (qos_pref->pref_pd_max != BT_AUDIO_PD_PREF_NONE) {
if (!IN_RANGE(qos_pref->pref_pd_max, qos_pref->pd_min, qos_pref->pd_max)) {
With the change requested previously it has already been validated that
qos_pref->pref_pd_max <= qos_pref->pref_pd_min
The QoS structure is not related to a codec, but rather a stream, and should thus not use the "Codec" name. The BAP and ASCS specs refer to the QoS as "QoS configuration" several places, so it is an obvious choice for a name. Since the structure is defined and used by BAP, the prefix was changed from bt_audio to bt_bap. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
492099e
to
5f14ccc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! :-)
The QoS structure is not related to a codec, but rather a stream, and should thus not use the "Codec" name.
The BAP and ASCS specs refer to the QoS as
"QoS configuration" several places, so it is an obvious choice for a name.
Since the structure is defined and used by BAP, the prefix was changed from bt_audio to bt_bap.
fixes #72684