Merge "Add support for Opus over A2DP" into tm-qpr-dev
This commit is contained in:
@@ -65,6 +65,8 @@ public class AudioSystem
|
|||||||
|
|
||||||
private static final String TAG = "AudioSystem";
|
private static final String TAG = "AudioSystem";
|
||||||
|
|
||||||
|
private static final int SOURCE_CODEC_TYPE_OPUS = 6; // TODO remove in U
|
||||||
|
|
||||||
// private constructor to prevent instantiating AudioSystem
|
// private constructor to prevent instantiating AudioSystem
|
||||||
private AudioSystem() {
|
private AudioSystem() {
|
||||||
throw new UnsupportedOperationException("Trying to instantiate AudioSystem");
|
throw new UnsupportedOperationException("Trying to instantiate AudioSystem");
|
||||||
@@ -243,6 +245,8 @@ public class AudioSystem
|
|||||||
public static final int AUDIO_FORMAT_LDAC = 0x23000000;
|
public static final int AUDIO_FORMAT_LDAC = 0x23000000;
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static final int AUDIO_FORMAT_LC3 = 0x2B000000;
|
public static final int AUDIO_FORMAT_LC3 = 0x2B000000;
|
||||||
|
/** @hide */
|
||||||
|
public static final int AUDIO_FORMAT_OPUS = 0x08000000;
|
||||||
|
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@@ -254,7 +258,9 @@ public class AudioSystem
|
|||||||
AUDIO_FORMAT_APTX,
|
AUDIO_FORMAT_APTX,
|
||||||
AUDIO_FORMAT_APTX_HD,
|
AUDIO_FORMAT_APTX_HD,
|
||||||
AUDIO_FORMAT_LDAC,
|
AUDIO_FORMAT_LDAC,
|
||||||
AUDIO_FORMAT_LC3}
|
AUDIO_FORMAT_LC3,
|
||||||
|
AUDIO_FORMAT_OPUS
|
||||||
|
}
|
||||||
)
|
)
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface AudioFormatNativeEnumForBtCodec {}
|
public @interface AudioFormatNativeEnumForBtCodec {}
|
||||||
@@ -287,6 +293,7 @@ public class AudioSystem
|
|||||||
case AUDIO_FORMAT_APTX_HD: return BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX_HD;
|
case AUDIO_FORMAT_APTX_HD: return BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX_HD;
|
||||||
case AUDIO_FORMAT_LDAC: return BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC;
|
case AUDIO_FORMAT_LDAC: return BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC;
|
||||||
case AUDIO_FORMAT_LC3: return BluetoothCodecConfig.SOURCE_CODEC_TYPE_LC3;
|
case AUDIO_FORMAT_LC3: return BluetoothCodecConfig.SOURCE_CODEC_TYPE_LC3;
|
||||||
|
case AUDIO_FORMAT_OPUS: return SOURCE_CODEC_TYPE_OPUS; // TODO update in U
|
||||||
default:
|
default:
|
||||||
Log.e(TAG, "Unknown audio format 0x" + Integer.toHexString(audioFormat)
|
Log.e(TAG, "Unknown audio format 0x" + Integer.toHexString(audioFormat)
|
||||||
+ " for conversion to BT codec");
|
+ " for conversion to BT codec");
|
||||||
@@ -329,6 +336,8 @@ public class AudioSystem
|
|||||||
return AudioSystem.AUDIO_FORMAT_LDAC;
|
return AudioSystem.AUDIO_FORMAT_LDAC;
|
||||||
case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LC3:
|
case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LC3:
|
||||||
return AudioSystem.AUDIO_FORMAT_LC3;
|
return AudioSystem.AUDIO_FORMAT_LC3;
|
||||||
|
case SOURCE_CODEC_TYPE_OPUS: // TODO update in U
|
||||||
|
return AudioSystem.AUDIO_FORMAT_OPUS;
|
||||||
default:
|
default:
|
||||||
Log.e(TAG, "Unknown BT codec 0x" + Integer.toHexString(btCodec)
|
Log.e(TAG, "Unknown BT codec 0x" + Integer.toHexString(btCodec)
|
||||||
+ " for conversion to audio format");
|
+ " for conversion to audio format");
|
||||||
|
|||||||
@@ -154,6 +154,8 @@
|
|||||||
<item><xliff:g id="qualcomm">Qualcomm®</xliff:g> <xliff:g id="aptx">aptX™</xliff:g> audio</item>
|
<item><xliff:g id="qualcomm">Qualcomm®</xliff:g> <xliff:g id="aptx">aptX™</xliff:g> audio</item>
|
||||||
<item><xliff:g id="qualcomm">Qualcomm®</xliff:g> <xliff:g id="aptx_hd">aptX™ HD</xliff:g> audio</item>
|
<item><xliff:g id="qualcomm">Qualcomm®</xliff:g> <xliff:g id="aptx_hd">aptX™ HD</xliff:g> audio</item>
|
||||||
<item>LDAC</item>
|
<item>LDAC</item>
|
||||||
|
<item>LC3</item>
|
||||||
|
<item>Opus</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<!-- Values for Bluetooth Audio Codec selection preference. -->
|
<!-- Values for Bluetooth Audio Codec selection preference. -->
|
||||||
@@ -164,6 +166,8 @@
|
|||||||
<item>2</item>
|
<item>2</item>
|
||||||
<item>3</item>
|
<item>3</item>
|
||||||
<item>4</item>
|
<item>4</item>
|
||||||
|
<item>5</item>
|
||||||
|
<item>6</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<!-- Summaries for Bluetooth Audio Codec selection preference. [CHAR LIMIT=50]-->
|
<!-- Summaries for Bluetooth Audio Codec selection preference. [CHAR LIMIT=50]-->
|
||||||
@@ -174,6 +178,8 @@
|
|||||||
<item><xliff:g id="qualcomm">Qualcomm®</xliff:g> <xliff:g id="aptx">aptX™</xliff:g> audio</item>
|
<item><xliff:g id="qualcomm">Qualcomm®</xliff:g> <xliff:g id="aptx">aptX™</xliff:g> audio</item>
|
||||||
<item><xliff:g id="qualcomm">Qualcomm®</xliff:g> <xliff:g id="aptx_hd">aptX™ HD</xliff:g> audio</item>
|
<item><xliff:g id="qualcomm">Qualcomm®</xliff:g> <xliff:g id="aptx_hd">aptX™ HD</xliff:g> audio</item>
|
||||||
<item>LDAC</item>
|
<item>LDAC</item>
|
||||||
|
<item>LC3</item>
|
||||||
|
<item>Opus</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<!-- Titles for Bluetooth Audio Codec Sample Rate selection preference. [CHAR LIMIT=50] -->
|
<!-- Titles for Bluetooth Audio Codec Sample Rate selection preference. [CHAR LIMIT=50] -->
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ import java.util.List;
|
|||||||
public class A2dpProfile implements LocalBluetoothProfile {
|
public class A2dpProfile implements LocalBluetoothProfile {
|
||||||
private static final String TAG = "A2dpProfile";
|
private static final String TAG = "A2dpProfile";
|
||||||
|
|
||||||
|
private static final int SOURCE_CODEC_TYPE_OPUS = 6; // TODO remove in U
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
|
||||||
private BluetoothA2dp mService;
|
private BluetoothA2dp mService;
|
||||||
@@ -328,6 +330,12 @@ public class A2dpProfile implements LocalBluetoothProfile {
|
|||||||
case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC:
|
case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC:
|
||||||
index = 5;
|
index = 5;
|
||||||
break;
|
break;
|
||||||
|
case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LC3:
|
||||||
|
index = 6;
|
||||||
|
break;
|
||||||
|
case SOURCE_CODEC_TYPE_OPUS: // TODO update in U
|
||||||
|
index = 7;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ public class BtHelper {
|
|||||||
|
|
||||||
private static final String TAG = "AS.BtHelper";
|
private static final String TAG = "AS.BtHelper";
|
||||||
|
|
||||||
|
private static final int SOURCE_CODEC_TYPE_OPUS = 6; // TODO remove in U
|
||||||
|
|
||||||
private final @NonNull AudioDeviceBroker mDeviceBroker;
|
private final @NonNull AudioDeviceBroker mDeviceBroker;
|
||||||
|
|
||||||
BtHelper(@NonNull AudioDeviceBroker broker) {
|
BtHelper(@NonNull AudioDeviceBroker broker) {
|
||||||
@@ -907,6 +909,8 @@ public class BtHelper {
|
|||||||
return "ENCODING_APTX_HD";
|
return "ENCODING_APTX_HD";
|
||||||
case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC:
|
case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC:
|
||||||
return "ENCODING_LDAC";
|
return "ENCODING_LDAC";
|
||||||
|
case SOURCE_CODEC_TYPE_OPUS: // TODO update in U
|
||||||
|
return "ENCODING_OPUS";
|
||||||
default:
|
default:
|
||||||
return "ENCODING_BT_CODEC_TYPE(" + btCodecType + ")";
|
return "ENCODING_BT_CODEC_TYPE(" + btCodecType + ")";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user