Commit 90cf66b0 authored by pali's avatar pali

fixup! bluetooth: Add A2DP aptX and aptX HD codecs support

parent 0ed2f2b3
......@@ -204,7 +204,7 @@ static bool is_configuration_valid_hd(const uint8_t *config_buffer, uint8_t conf
return is_configuration_valid_common(&config->aptx, APTX_HD_VENDOR_ID, APTX_HD_CODEC_ID);
}
static bool fill_preferred_configuration_common(const pa_sample_spec *default_sample_spec, const a2dp_aptx_t *capabilities, a2dp_aptx_t *config, uint32_t vendor_id, uint16_t codec_id) {
static int fill_preferred_configuration_common(const pa_sample_spec *default_sample_spec, const a2dp_aptx_t *capabilities, a2dp_aptx_t *config, uint32_t vendor_id, uint16_t codec_id) {
int i;
static const struct {
......@@ -219,14 +219,14 @@ static bool fill_preferred_configuration_common(const pa_sample_spec *default_sa
if (A2DP_GET_VENDOR_ID(capabilities->info) != vendor_id || A2DP_GET_CODEC_ID(capabilities->info) != codec_id) {
pa_log_error("No supported vendor codec information");
return false;
return -1;
}
config->info = A2DP_SET_VENDOR_ID_CODEC_ID(vendor_id, codec_id);
if (!(capabilities->channel_mode & APTX_CHANNEL_MODE_STEREO)) {
pa_log_error("No supported channel modes");
return false;
return -1;
}
config->channel_mode = APTX_CHANNEL_MODE_STEREO;
......@@ -253,7 +253,7 @@ static bool fill_preferred_configuration_common(const pa_sample_spec *default_sa
}
}
return true;
return 0;
}
static uint8_t fill_preferred_configuration(const pa_sample_spec *default_sample_spec, const uint8_t *capabilities_buffer, uint8_t capabilities_size, uint8_t config_buffer[MAX_A2DP_CAPS_SIZE]) {
......@@ -267,7 +267,7 @@ static uint8_t fill_preferred_configuration(const pa_sample_spec *default_sample
pa_zero(*config);
if (!fill_preferred_configuration_common(default_sample_spec, capabilities, config, APTX_VENDOR_ID, APTX_CODEC_ID))
if (fill_preferred_configuration_common(default_sample_spec, capabilities, config, APTX_VENDOR_ID, APTX_CODEC_ID) < 0)
return 0;
return sizeof(*config);
......@@ -284,7 +284,7 @@ static uint8_t fill_preferred_configuration_hd(const pa_sample_spec *default_sam
pa_zero(*config);
if (!fill_preferred_configuration_common(default_sample_spec, &capabilities->aptx, &config->aptx, APTX_HD_VENDOR_ID, APTX_HD_CODEC_ID))
if (fill_preferred_configuration_common(default_sample_spec, &capabilities->aptx, &config->aptx, APTX_HD_VENDOR_ID, APTX_HD_CODEC_ID) < 0)
return 0;
return sizeof(*config);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment