Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 593d8f45 authored by Omer Osman's avatar Omer Osman
Browse files

Update Opus over A2DP to use BluetoothCodecConfig api

Bug: 240635097
Test: sink device using bds-dev
Change-Id: I573133a3f0cad910f935311e053c4f6fde5a2fc7
parent 64fce110
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -65,8 +65,6 @@ public class 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 AudioSystem() {
        throw new UnsupportedOperationException("Trying to instantiate AudioSystem");
@@ -293,7 +291,7 @@ public class AudioSystem
            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_LC3: return BluetoothCodecConfig.SOURCE_CODEC_TYPE_LC3;
            case AUDIO_FORMAT_OPUS: return SOURCE_CODEC_TYPE_OPUS; // TODO update in U
            case AUDIO_FORMAT_OPUS: return BluetoothCodecConfig.SOURCE_CODEC_TYPE_OPUS;
            default:
                Log.e(TAG, "Unknown audio format 0x" + Integer.toHexString(audioFormat)
                        + " for conversion to BT codec");
@@ -336,7 +334,7 @@ public class AudioSystem
                return AudioSystem.AUDIO_FORMAT_LDAC;
            case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LC3:
                return AudioSystem.AUDIO_FORMAT_LC3;
            case SOURCE_CODEC_TYPE_OPUS: // TODO update in U
            case BluetoothCodecConfig.SOURCE_CODEC_TYPE_OPUS:
                return AudioSystem.AUDIO_FORMAT_OPUS;
            default:
                Log.e(TAG, "Unknown BT codec 0x" + Integer.toHexString(btCodec)
+1 −3
Original line number Diff line number Diff line
@@ -43,8 +43,6 @@ import java.util.List;
public class A2dpProfile implements LocalBluetoothProfile {
    private static final String TAG = "A2dpProfile";

    private static final int SOURCE_CODEC_TYPE_OPUS = 6; // TODO remove in U

    private Context mContext;

    private BluetoothA2dp mService;
@@ -333,7 +331,7 @@ public class A2dpProfile implements LocalBluetoothProfile {
            case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LC3:
                index = 6;
                break;
            case SOURCE_CODEC_TYPE_OPUS: // TODO update in U
            case BluetoothCodecConfig.SOURCE_CODEC_TYPE_OPUS:
                index = 7;
                break;
           }
+1 −3
Original line number Diff line number Diff line
@@ -53,8 +53,6 @@ public class 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;

    BtHelper(@NonNull AudioDeviceBroker broker) {
@@ -913,7 +911,7 @@ public class BtHelper {
                return "ENCODING_APTX_HD";
            case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC:
                return "ENCODING_LDAC";
            case SOURCE_CODEC_TYPE_OPUS: // TODO update in U
            case BluetoothCodecConfig.SOURCE_CODEC_TYPE_OPUS:
                return "ENCODING_OPUS";
            default:
                return "ENCODING_BT_CODEC_TYPE(" + btCodecType + ")";