Loading system/stack/a2dp/a2dp_codec_config.cc +83 −37 Original line number Diff line number Diff line Loading @@ -1257,87 +1257,123 @@ bool A2DP_CodecTypeEquals(const uint8_t* p_codec_info_a, const uint8_t* p_codec_ } bool A2DP_CodecEquals(const uint8_t* p_codec_info_a, const uint8_t* p_codec_info_b) { tA2DP_CODEC_TYPE codec_type_a = A2DP_GetCodecType(p_codec_info_a); tA2DP_CODEC_TYPE codec_type_b = A2DP_GetCodecType(p_codec_info_b); auto codec_id_a = bluetooth::a2dp::ParseCodecId(p_codec_info_a); auto codec_id_b = bluetooth::a2dp::ParseCodecId(p_codec_info_b); if (codec_type_a != codec_type_b) { if (!codec_id_a.has_value() || !codec_id_b.has_value() || codec_id_a != codec_id_b) { return false; } switch (codec_type_a) { case A2DP_MEDIA_CT_SBC: switch (codec_id_a.value()) { case bluetooth::a2dp::CodecId::SBC: return A2DP_CodecEqualsSbc(p_codec_info_a, p_codec_info_b); #if !defined(EXCLUDE_NONSTANDARD_CODECS) case A2DP_MEDIA_CT_AAC: case bluetooth::a2dp::CodecId::AAC: return A2DP_CodecEqualsAac(p_codec_info_a, p_codec_info_b); case A2DP_MEDIA_CT_NON_A2DP: return A2DP_VendorCodecEquals(p_codec_info_a, p_codec_info_b); case bluetooth::a2dp::CodecId::APTX: return A2DP_VendorCodecEqualsAptx(p_codec_info_a, p_codec_info_b); case bluetooth::a2dp::CodecId::APTX_HD: return A2DP_VendorCodecEqualsAptxHd(p_codec_info_a, p_codec_info_b); case bluetooth::a2dp::CodecId::LDAC: return A2DP_VendorCodecEqualsLdac(p_codec_info_a, p_codec_info_b); case bluetooth::a2dp::CodecId::OPUS: return A2DP_VendorCodecEqualsOpus(p_codec_info_a, p_codec_info_b); #endif default: break; } log::error("unsupported codec type 0x{:x}", codec_type_a); log::error("unsupported codec id 0x{:x}", codec_id_a.value()); return false; } int A2DP_GetTrackSampleRate(const uint8_t* p_codec_info) { tA2DP_CODEC_TYPE codec_type = A2DP_GetCodecType(p_codec_info); auto codec_id = bluetooth::a2dp::ParseCodecId(p_codec_info); switch (codec_type) { case A2DP_MEDIA_CT_SBC: if (!codec_id.has_value()) { return -1; } switch (codec_id.value()) { case bluetooth::a2dp::CodecId::SBC: return A2DP_GetTrackSampleRateSbc(p_codec_info); #if !defined(EXCLUDE_NONSTANDARD_CODECS) case A2DP_MEDIA_CT_AAC: case bluetooth::a2dp::CodecId::AAC: return A2DP_GetTrackSampleRateAac(p_codec_info); case A2DP_MEDIA_CT_NON_A2DP: return A2DP_VendorGetTrackSampleRate(p_codec_info); case bluetooth::a2dp::CodecId::APTX: return A2DP_VendorGetTrackSampleRateAptx(p_codec_info); case bluetooth::a2dp::CodecId::APTX_HD: return A2DP_VendorGetTrackSampleRateAptxHd(p_codec_info); case bluetooth::a2dp::CodecId::LDAC: return A2DP_VendorGetTrackSampleRateLdac(p_codec_info); case bluetooth::a2dp::CodecId::OPUS: return A2DP_VendorGetTrackSampleRateOpus(p_codec_info); #endif default: break; } log::error("unsupported codec type 0x{:x}", codec_type); log::error("unsupported codec id 0x{:x}", codec_id.value()); return -1; } int A2DP_GetTrackBitsPerSample(const uint8_t* p_codec_info) { tA2DP_CODEC_TYPE codec_type = A2DP_GetCodecType(p_codec_info); auto codec_id = bluetooth::a2dp::ParseCodecId(p_codec_info); switch (codec_type) { case A2DP_MEDIA_CT_SBC: if (!codec_id.has_value()) { return -1; } switch (codec_id.value()) { case bluetooth::a2dp::CodecId::SBC: return A2DP_GetTrackBitsPerSampleSbc(p_codec_info); #if !defined(EXCLUDE_NONSTANDARD_CODECS) case A2DP_MEDIA_CT_AAC: case bluetooth::a2dp::CodecId::AAC: return A2DP_GetTrackBitsPerSampleAac(p_codec_info); case A2DP_MEDIA_CT_NON_A2DP: return A2DP_VendorGetTrackBitsPerSample(p_codec_info); case bluetooth::a2dp::CodecId::APTX: return A2DP_VendorGetTrackBitsPerSampleAptx(p_codec_info); case bluetooth::a2dp::CodecId::APTX_HD: return A2DP_VendorGetTrackBitsPerSampleAptxHd(p_codec_info); case bluetooth::a2dp::CodecId::LDAC: return A2DP_VendorGetTrackBitsPerSampleLdac(p_codec_info); case bluetooth::a2dp::CodecId::OPUS: return A2DP_VendorGetTrackBitsPerSampleOpus(p_codec_info); #endif default: break; } log::error("unsupported codec type 0x{:x}", codec_type); log::error("unsupported codec id 0x{:x}", codec_id.value()); return -1; } int A2DP_GetTrackChannelCount(const uint8_t* p_codec_info) { tA2DP_CODEC_TYPE codec_type = A2DP_GetCodecType(p_codec_info); auto codec_id = bluetooth::a2dp::ParseCodecId(p_codec_info); switch (codec_type) { case A2DP_MEDIA_CT_SBC: if (!codec_id.has_value()) { return -1; } switch (codec_id.value()) { case bluetooth::a2dp::CodecId::SBC: return A2DP_GetTrackChannelCountSbc(p_codec_info); #if !defined(EXCLUDE_NONSTANDARD_CODECS) case A2DP_MEDIA_CT_AAC: case bluetooth::a2dp::CodecId::AAC: return A2DP_GetTrackChannelCountAac(p_codec_info); case A2DP_MEDIA_CT_NON_A2DP: return A2DP_VendorGetTrackChannelCount(p_codec_info); case bluetooth::a2dp::CodecId::APTX: return A2DP_VendorGetTrackChannelCountAptx(p_codec_info); case bluetooth::a2dp::CodecId::APTX_HD: return A2DP_VendorGetTrackChannelCountAptxHd(p_codec_info); case bluetooth::a2dp::CodecId::LDAC: return A2DP_VendorGetTrackChannelCountLdac(p_codec_info); case bluetooth::a2dp::CodecId::OPUS: return A2DP_VendorGetTrackChannelCountOpus(p_codec_info); #endif default: break; } log::error("unsupported codec type 0x{:x}", codec_type); log::error("unsupported codec id 0x{:x}", codec_id.value()); return -1; } Loading @@ -1363,22 +1399,32 @@ int A2DP_GetSinkTrackChannelType(const uint8_t* p_codec_info) { bool A2DP_GetPacketTimestamp(const uint8_t* p_codec_info, const uint8_t* p_data, uint32_t* p_timestamp) { tA2DP_CODEC_TYPE codec_type = A2DP_GetCodecType(p_codec_info); auto codec_id = bluetooth::a2dp::ParseCodecId(p_codec_info); switch (codec_type) { case A2DP_MEDIA_CT_SBC: if (!codec_id.has_value()) { return false; } switch (codec_id.value()) { case bluetooth::a2dp::CodecId::SBC: return A2DP_GetPacketTimestampSbc(p_codec_info, p_data, p_timestamp); #if !defined(EXCLUDE_NONSTANDARD_CODECS) case A2DP_MEDIA_CT_AAC: case bluetooth::a2dp::CodecId::AAC: return A2DP_GetPacketTimestampAac(p_codec_info, p_data, p_timestamp); case A2DP_MEDIA_CT_NON_A2DP: return A2DP_VendorGetPacketTimestamp(p_codec_info, p_data, p_timestamp); case bluetooth::a2dp::CodecId::APTX: return A2DP_VendorGetPacketTimestampAptx(p_codec_info, p_data, p_timestamp); case bluetooth::a2dp::CodecId::APTX_HD: return A2DP_VendorGetPacketTimestampAptxHd(p_codec_info, p_data, p_timestamp); case bluetooth::a2dp::CodecId::LDAC: return A2DP_VendorGetPacketTimestampLdac(p_codec_info, p_data, p_timestamp); case bluetooth::a2dp::CodecId::OPUS: return A2DP_VendorGetPacketTimestampOpus(p_codec_info, p_data, p_timestamp); #endif default: break; } log::error("unsupported codec type 0x{:x}", codec_type); log::error("unsupported codec id 0x{:x}", codec_id.value()); return false; } Loading system/stack/a2dp/a2dp_vendor.cc +0 −160 Original line number Diff line number Diff line Loading @@ -233,49 +233,6 @@ bool A2DP_VendorCodecTypeEquals(const uint8_t* p_codec_info_a, const uint8_t* p_ return true; } bool A2DP_VendorCodecEquals(const uint8_t* p_codec_info_a, const uint8_t* p_codec_info_b) { tA2DP_CODEC_TYPE codec_type_a = A2DP_GetCodecType(p_codec_info_a); tA2DP_CODEC_TYPE codec_type_b = A2DP_GetCodecType(p_codec_info_b); if ((codec_type_a != codec_type_b) || (codec_type_a != A2DP_MEDIA_CT_NON_A2DP)) { return false; } uint32_t vendor_id_a = A2DP_VendorCodecGetVendorId(p_codec_info_a); uint16_t codec_id_a = A2DP_VendorCodecGetCodecId(p_codec_info_a); uint32_t vendor_id_b = A2DP_VendorCodecGetVendorId(p_codec_info_b); uint16_t codec_id_b = A2DP_VendorCodecGetCodecId(p_codec_info_b); if ((vendor_id_a != vendor_id_b) || (codec_id_a != codec_id_b)) { return false; } // Check for aptX if (vendor_id_a == A2DP_APTX_VENDOR_ID && codec_id_a == A2DP_APTX_CODEC_ID_BLUETOOTH) { return A2DP_VendorCodecEqualsAptx(p_codec_info_a, p_codec_info_b); } // Check for aptX-HD if (vendor_id_a == A2DP_APTX_HD_VENDOR_ID && codec_id_a == A2DP_APTX_HD_CODEC_ID_BLUETOOTH) { return A2DP_VendorCodecEqualsAptxHd(p_codec_info_a, p_codec_info_b); } // Check for LDAC if (vendor_id_a == A2DP_LDAC_VENDOR_ID && codec_id_a == A2DP_LDAC_CODEC_ID) { return A2DP_VendorCodecEqualsLdac(p_codec_info_a, p_codec_info_b); } // Check for Opus if (vendor_id_a == A2DP_OPUS_VENDOR_ID && codec_id_a == A2DP_OPUS_CODEC_ID) { return A2DP_VendorCodecEqualsOpus(p_codec_info_a, p_codec_info_b); } // Add extra vendor-specific checks based on the // vendor-specific data stored in "p_codec_info_a" and "p_codec_info_b". return false; } int A2DP_VendorGetBitRate(const uint8_t* p_codec_info) { uint32_t vendor_id = A2DP_VendorCodecGetVendorId(p_codec_info); uint16_t codec_id = A2DP_VendorCodecGetCodecId(p_codec_info); Loading Loading @@ -305,93 +262,6 @@ int A2DP_VendorGetBitRate(const uint8_t* p_codec_info) { return -1; } int A2DP_VendorGetTrackSampleRate(const uint8_t* p_codec_info) { uint32_t vendor_id = A2DP_VendorCodecGetVendorId(p_codec_info); uint16_t codec_id = A2DP_VendorCodecGetCodecId(p_codec_info); // Check for aptX if (vendor_id == A2DP_APTX_VENDOR_ID && codec_id == A2DP_APTX_CODEC_ID_BLUETOOTH) { return A2DP_VendorGetTrackSampleRateAptx(p_codec_info); } // Check for aptX-HD if (vendor_id == A2DP_APTX_HD_VENDOR_ID && codec_id == A2DP_APTX_HD_CODEC_ID_BLUETOOTH) { return A2DP_VendorGetTrackSampleRateAptxHd(p_codec_info); } // Check for LDAC if (vendor_id == A2DP_LDAC_VENDOR_ID && codec_id == A2DP_LDAC_CODEC_ID) { return A2DP_VendorGetTrackSampleRateLdac(p_codec_info); } // Check for Opus if (vendor_id == A2DP_OPUS_VENDOR_ID && codec_id == A2DP_OPUS_CODEC_ID) { return A2DP_VendorGetTrackSampleRateOpus(p_codec_info); } // Add checks based on <vendor_id, codec_id> return -1; } int A2DP_VendorGetTrackBitsPerSample(const uint8_t* p_codec_info) { uint32_t vendor_id = A2DP_VendorCodecGetVendorId(p_codec_info); uint16_t codec_id = A2DP_VendorCodecGetCodecId(p_codec_info); // Check for aptX if (vendor_id == A2DP_APTX_VENDOR_ID && codec_id == A2DP_APTX_CODEC_ID_BLUETOOTH) { return A2DP_VendorGetTrackBitsPerSampleAptx(p_codec_info); } // Check for aptX-HD if (vendor_id == A2DP_APTX_HD_VENDOR_ID && codec_id == A2DP_APTX_HD_CODEC_ID_BLUETOOTH) { return A2DP_VendorGetTrackBitsPerSampleAptxHd(p_codec_info); } // Check for LDAC if (vendor_id == A2DP_LDAC_VENDOR_ID && codec_id == A2DP_LDAC_CODEC_ID) { return A2DP_VendorGetTrackBitsPerSampleLdac(p_codec_info); } // Check for Opus if (vendor_id == A2DP_OPUS_VENDOR_ID && codec_id == A2DP_OPUS_CODEC_ID) { return A2DP_VendorGetTrackBitsPerSampleOpus(p_codec_info); } // Add checks based on <vendor_id, codec_id> return -1; } int A2DP_VendorGetTrackChannelCount(const uint8_t* p_codec_info) { uint32_t vendor_id = A2DP_VendorCodecGetVendorId(p_codec_info); uint16_t codec_id = A2DP_VendorCodecGetCodecId(p_codec_info); // Check for aptX if (vendor_id == A2DP_APTX_VENDOR_ID && codec_id == A2DP_APTX_CODEC_ID_BLUETOOTH) { return A2DP_VendorGetTrackChannelCountAptx(p_codec_info); } // Check for aptX-HD if (vendor_id == A2DP_APTX_HD_VENDOR_ID && codec_id == A2DP_APTX_HD_CODEC_ID_BLUETOOTH) { return A2DP_VendorGetTrackChannelCountAptxHd(p_codec_info); } // Check for LDAC if (vendor_id == A2DP_LDAC_VENDOR_ID && codec_id == A2DP_LDAC_CODEC_ID) { return A2DP_VendorGetTrackChannelCountLdac(p_codec_info); } // Check for Opus if (vendor_id == A2DP_OPUS_VENDOR_ID && codec_id == A2DP_OPUS_CODEC_ID) { return A2DP_VendorGetTrackChannelCountOpus(p_codec_info); } // Add checks based on <vendor_id, codec_id> return -1; } int A2DP_VendorGetSinkTrackChannelType(const uint8_t* p_codec_info) { uint32_t vendor_id = A2DP_VendorCodecGetVendorId(p_codec_info); uint16_t codec_id = A2DP_VendorCodecGetCodecId(p_codec_info); Loading @@ -412,36 +282,6 @@ int A2DP_VendorGetSinkTrackChannelType(const uint8_t* p_codec_info) { return -1; } bool A2DP_VendorGetPacketTimestamp(const uint8_t* p_codec_info, const uint8_t* p_data, uint32_t* p_timestamp) { uint32_t vendor_id = A2DP_VendorCodecGetVendorId(p_codec_info); uint16_t codec_id = A2DP_VendorCodecGetCodecId(p_codec_info); // Check for aptX if (vendor_id == A2DP_APTX_VENDOR_ID && codec_id == A2DP_APTX_CODEC_ID_BLUETOOTH) { return A2DP_VendorGetPacketTimestampAptx(p_codec_info, p_data, p_timestamp); } // Check for aptX-HD if (vendor_id == A2DP_APTX_HD_VENDOR_ID && codec_id == A2DP_APTX_HD_CODEC_ID_BLUETOOTH) { return A2DP_VendorGetPacketTimestampAptxHd(p_codec_info, p_data, p_timestamp); } // Check for LDAC if (vendor_id == A2DP_LDAC_VENDOR_ID && codec_id == A2DP_LDAC_CODEC_ID) { return A2DP_VendorGetPacketTimestampLdac(p_codec_info, p_data, p_timestamp); } // Check for Opus if (vendor_id == A2DP_OPUS_VENDOR_ID && codec_id == A2DP_OPUS_CODEC_ID) { return A2DP_VendorGetPacketTimestampOpus(p_codec_info, p_data, p_timestamp); } // Add checks based on <vendor_id, codec_id> return false; } bool A2DP_VendorBuildCodecHeader(const uint8_t* p_codec_info, BT_HDR* p_buf, uint16_t frames_per_packet) { uint32_t vendor_id = A2DP_VendorCodecGetVendorId(p_codec_info); Loading system/stack/include/a2dp_constants.h +2 −0 Original line number Diff line number Diff line Loading @@ -169,6 +169,8 @@ enum tA2DP_STATUS : uint8_t { namespace fmt { template <> struct formatter<bluetooth::a2dp::CodecId> : enum_formatter<bluetooth::a2dp::CodecId> {}; template <> struct formatter<tA2DP_CODEC_TYPE> : enum_formatter<tA2DP_CODEC_TYPE> {}; template <> struct formatter<tA2DP_STATUS> : enum_formatter<tA2DP_STATUS> {}; Loading system/stack/include/a2dp_vendor.h +0 −32 Original line number Diff line number Diff line Loading @@ -100,30 +100,6 @@ const char* A2DP_VendorCodecName(const uint8_t* p_codec_info); // If the codec type is not recognized, the return value is false. bool A2DP_VendorCodecTypeEquals(const uint8_t* p_codec_info_a, const uint8_t* p_codec_info_b); // Checks whether two A2DP vendor-specific codecs |p_codec_info_a| and // |p_codec_info_b| are exactly the same. // Returns true if the two codecs are exactly the same, otherwise false. // If the codec type is not recognized, the return value is false. bool A2DP_VendorCodecEquals(const uint8_t* p_codec_info_a, const uint8_t* p_codec_info_b); // Gets the track sample rate value for the A2DP vendor-specific codec. // |p_codec_info| is a pointer to the vendor-specific codec_info to decode. // Returns the track sample rate on success, or -1 if |p_codec_info| // contains invalid codec information. int A2DP_VendorGetTrackSampleRate(const uint8_t* p_codec_info); // Gets the track bits per sample value for the A2DP vendor-specific codec. // |p_codec_info| is a pointer to the vendor-specific codec_info to decode. // Returns the track sample rate on success, or -1 if |p_codec_info| // contains invalid codec information. int A2DP_VendorGetTrackBitsPerSample(const uint8_t* p_codec_info); // Gets the channel count for the A2DP vendor-specific codec. // |p_codec_info| is a pointer to the vendor-specific codec_info to decode. // Returns the channel count on success, or -1 if |p_codec_info| // contains invalid codec information. int A2DP_VendorGetTrackChannelCount(const uint8_t* p_codec_info); // Gets the bitrate for the A2DP vendor-specific codec. // |p_codec_info| is a pointer to the vendor-specific codec_info to decode. // Returns the channel count on success, or -1 if |p_codec_info| Loading @@ -137,14 +113,6 @@ int A2DP_VendorGetBitRate(const uint8_t* p_codec_info); // contains invalid codec information. int A2DP_VendorGetSinkTrackChannelType(const uint8_t* p_codec_info); // Gets the A2DP codec-specific audio data timestamp from an audio packet. // |p_codec_info| contains the codec information. // |p_data| contains the audio data. // The timestamp is stored in |p_timestamp|. // Returns true on success, otherwise false. bool A2DP_VendorGetPacketTimestamp(const uint8_t* p_codec_info, const uint8_t* p_data, uint32_t* p_timestamp); // Builds A2DP vendor-specific codec header for audio data. // |p_codec_info| contains the codec information. // |p_buf| contains the audio data. Loading system/stack/test/stack_a2dp_test.cc +8 −9 Original line number Diff line number Diff line Loading @@ -579,7 +579,7 @@ TEST_F(StackA2dpTest, test_a2dp_codec_equals) { // Test two identical Opus codecs memset(codec_info_opus_test, 0xAB, sizeof(codec_info_opus_test)); memcpy(codec_info_opus_test, codec_info_opus, sizeof(codec_info_opus)); ASSERT_TRUE(A2DP_VendorCodecEquals(codec_info_opus, codec_info_opus_test)); ASSERT_TRUE(A2DP_CodecEquals(codec_info_opus, codec_info_opus_test)); // Test two identical non-A2DP codecs that are not recognized memset(codec_info_non_a2dp_test, 0xAB, sizeof(codec_info_non_a2dp_test)); Loading Loading @@ -627,14 +627,14 @@ TEST_F(StackA2dpTest, test_a2dp_codec_equals) { TEST_F(StackA2dpTest, test_a2dp_get_track_sample_rate) { EXPECT_EQ(A2DP_GetTrackSampleRate(codec_info_sbc), 44100); EXPECT_EQ(A2DP_GetTrackSampleRate(codec_info_aac), 44100); ASSERT_EQ(A2DP_VendorGetTrackSampleRate(codec_info_opus), 48000); ASSERT_EQ(A2DP_GetTrackSampleRate(codec_info_opus), 48000); EXPECT_EQ(A2DP_GetTrackSampleRate(codec_info_non_a2dp), -1); } TEST_F(StackA2dpTest, test_a2dp_get_track_channel_count) { EXPECT_EQ(A2DP_GetTrackChannelCount(codec_info_sbc), 2); EXPECT_EQ(A2DP_GetTrackChannelCount(codec_info_aac), 2); ASSERT_EQ(A2DP_VendorGetTrackChannelCount(codec_info_opus), 2); ASSERT_EQ(A2DP_GetTrackChannelCount(codec_info_opus), 2); EXPECT_EQ(A2DP_GetTrackChannelCount(codec_info_non_a2dp), -1); } Loading Loading @@ -687,7 +687,7 @@ TEST_F(StackA2dpTest, test_a2dp_get_max_bitpool_sbc) { TEST_F(StackA2dpTest, test_a2dp_get_sink_track_channel_type) { EXPECT_EQ(A2DP_GetSinkTrackChannelType(codec_info_sbc), 3); EXPECT_EQ(A2DP_GetSinkTrackChannelType(codec_info_aac), 3); ASSERT_EQ(A2DP_VendorGetSinkTrackChannelType(codec_info_opus), 2); ASSERT_EQ(A2DP_GetSinkTrackChannelType(codec_info_opus), 2); EXPECT_EQ(A2DP_GetSinkTrackChannelType(codec_info_non_a2dp), -1); } Loading Loading @@ -735,7 +735,7 @@ TEST_F(StackA2dpTest, test_a2dp_get_packet_timestamp) { memset(a2dp_data, 0xAB, sizeof(a2dp_data)); *p_ts = 0x12345678; timestamp = 0xFFFFFFFF; ASSERT_TRUE(A2DP_VendorGetPacketTimestamp(codec_info_opus, a2dp_data, ×tamp)); ASSERT_TRUE(A2DP_GetPacketTimestamp(codec_info_opus, a2dp_data, ×tamp)); ASSERT_EQ(timestamp, static_cast<uint32_t>(0x12345678)); memset(a2dp_data, 0xAB, sizeof(a2dp_data)); Loading Loading @@ -818,10 +818,9 @@ TEST_F(StackA2dpTest, test_a2dp_source_codec_index) { EXPECT_EQ(A2DP_SourceCodecIndex(codec_info_aac_capability), BTAV_A2DP_CODEC_INDEX_SOURCE_AAC); EXPECT_EQ(A2DP_SourceCodecIndex(codec_info_aac_sink_capability), BTAV_A2DP_CODEC_INDEX_SOURCE_AAC); ASSERT_EQ(A2DP_VendorSourceCodecIndex(codec_info_opus), BTAV_A2DP_CODEC_INDEX_SOURCE_OPUS); ASSERT_EQ(A2DP_VendorSourceCodecIndex(codec_info_opus_capability), BTAV_A2DP_CODEC_INDEX_SOURCE_OPUS); ASSERT_EQ(A2DP_VendorSourceCodecIndex(codec_info_opus_sink_capability), ASSERT_EQ(A2DP_SourceCodecIndex(codec_info_opus), BTAV_A2DP_CODEC_INDEX_SOURCE_OPUS); ASSERT_EQ(A2DP_SourceCodecIndex(codec_info_opus_capability), BTAV_A2DP_CODEC_INDEX_SOURCE_OPUS); ASSERT_EQ(A2DP_SourceCodecIndex(codec_info_opus_sink_capability), BTAV_A2DP_CODEC_INDEX_SOURCE_OPUS); EXPECT_EQ(A2DP_SourceCodecIndex(codec_info_non_a2dp), BTAV_A2DP_CODEC_INDEX_MAX); } Loading Loading
system/stack/a2dp/a2dp_codec_config.cc +83 −37 Original line number Diff line number Diff line Loading @@ -1257,87 +1257,123 @@ bool A2DP_CodecTypeEquals(const uint8_t* p_codec_info_a, const uint8_t* p_codec_ } bool A2DP_CodecEquals(const uint8_t* p_codec_info_a, const uint8_t* p_codec_info_b) { tA2DP_CODEC_TYPE codec_type_a = A2DP_GetCodecType(p_codec_info_a); tA2DP_CODEC_TYPE codec_type_b = A2DP_GetCodecType(p_codec_info_b); auto codec_id_a = bluetooth::a2dp::ParseCodecId(p_codec_info_a); auto codec_id_b = bluetooth::a2dp::ParseCodecId(p_codec_info_b); if (codec_type_a != codec_type_b) { if (!codec_id_a.has_value() || !codec_id_b.has_value() || codec_id_a != codec_id_b) { return false; } switch (codec_type_a) { case A2DP_MEDIA_CT_SBC: switch (codec_id_a.value()) { case bluetooth::a2dp::CodecId::SBC: return A2DP_CodecEqualsSbc(p_codec_info_a, p_codec_info_b); #if !defined(EXCLUDE_NONSTANDARD_CODECS) case A2DP_MEDIA_CT_AAC: case bluetooth::a2dp::CodecId::AAC: return A2DP_CodecEqualsAac(p_codec_info_a, p_codec_info_b); case A2DP_MEDIA_CT_NON_A2DP: return A2DP_VendorCodecEquals(p_codec_info_a, p_codec_info_b); case bluetooth::a2dp::CodecId::APTX: return A2DP_VendorCodecEqualsAptx(p_codec_info_a, p_codec_info_b); case bluetooth::a2dp::CodecId::APTX_HD: return A2DP_VendorCodecEqualsAptxHd(p_codec_info_a, p_codec_info_b); case bluetooth::a2dp::CodecId::LDAC: return A2DP_VendorCodecEqualsLdac(p_codec_info_a, p_codec_info_b); case bluetooth::a2dp::CodecId::OPUS: return A2DP_VendorCodecEqualsOpus(p_codec_info_a, p_codec_info_b); #endif default: break; } log::error("unsupported codec type 0x{:x}", codec_type_a); log::error("unsupported codec id 0x{:x}", codec_id_a.value()); return false; } int A2DP_GetTrackSampleRate(const uint8_t* p_codec_info) { tA2DP_CODEC_TYPE codec_type = A2DP_GetCodecType(p_codec_info); auto codec_id = bluetooth::a2dp::ParseCodecId(p_codec_info); switch (codec_type) { case A2DP_MEDIA_CT_SBC: if (!codec_id.has_value()) { return -1; } switch (codec_id.value()) { case bluetooth::a2dp::CodecId::SBC: return A2DP_GetTrackSampleRateSbc(p_codec_info); #if !defined(EXCLUDE_NONSTANDARD_CODECS) case A2DP_MEDIA_CT_AAC: case bluetooth::a2dp::CodecId::AAC: return A2DP_GetTrackSampleRateAac(p_codec_info); case A2DP_MEDIA_CT_NON_A2DP: return A2DP_VendorGetTrackSampleRate(p_codec_info); case bluetooth::a2dp::CodecId::APTX: return A2DP_VendorGetTrackSampleRateAptx(p_codec_info); case bluetooth::a2dp::CodecId::APTX_HD: return A2DP_VendorGetTrackSampleRateAptxHd(p_codec_info); case bluetooth::a2dp::CodecId::LDAC: return A2DP_VendorGetTrackSampleRateLdac(p_codec_info); case bluetooth::a2dp::CodecId::OPUS: return A2DP_VendorGetTrackSampleRateOpus(p_codec_info); #endif default: break; } log::error("unsupported codec type 0x{:x}", codec_type); log::error("unsupported codec id 0x{:x}", codec_id.value()); return -1; } int A2DP_GetTrackBitsPerSample(const uint8_t* p_codec_info) { tA2DP_CODEC_TYPE codec_type = A2DP_GetCodecType(p_codec_info); auto codec_id = bluetooth::a2dp::ParseCodecId(p_codec_info); switch (codec_type) { case A2DP_MEDIA_CT_SBC: if (!codec_id.has_value()) { return -1; } switch (codec_id.value()) { case bluetooth::a2dp::CodecId::SBC: return A2DP_GetTrackBitsPerSampleSbc(p_codec_info); #if !defined(EXCLUDE_NONSTANDARD_CODECS) case A2DP_MEDIA_CT_AAC: case bluetooth::a2dp::CodecId::AAC: return A2DP_GetTrackBitsPerSampleAac(p_codec_info); case A2DP_MEDIA_CT_NON_A2DP: return A2DP_VendorGetTrackBitsPerSample(p_codec_info); case bluetooth::a2dp::CodecId::APTX: return A2DP_VendorGetTrackBitsPerSampleAptx(p_codec_info); case bluetooth::a2dp::CodecId::APTX_HD: return A2DP_VendorGetTrackBitsPerSampleAptxHd(p_codec_info); case bluetooth::a2dp::CodecId::LDAC: return A2DP_VendorGetTrackBitsPerSampleLdac(p_codec_info); case bluetooth::a2dp::CodecId::OPUS: return A2DP_VendorGetTrackBitsPerSampleOpus(p_codec_info); #endif default: break; } log::error("unsupported codec type 0x{:x}", codec_type); log::error("unsupported codec id 0x{:x}", codec_id.value()); return -1; } int A2DP_GetTrackChannelCount(const uint8_t* p_codec_info) { tA2DP_CODEC_TYPE codec_type = A2DP_GetCodecType(p_codec_info); auto codec_id = bluetooth::a2dp::ParseCodecId(p_codec_info); switch (codec_type) { case A2DP_MEDIA_CT_SBC: if (!codec_id.has_value()) { return -1; } switch (codec_id.value()) { case bluetooth::a2dp::CodecId::SBC: return A2DP_GetTrackChannelCountSbc(p_codec_info); #if !defined(EXCLUDE_NONSTANDARD_CODECS) case A2DP_MEDIA_CT_AAC: case bluetooth::a2dp::CodecId::AAC: return A2DP_GetTrackChannelCountAac(p_codec_info); case A2DP_MEDIA_CT_NON_A2DP: return A2DP_VendorGetTrackChannelCount(p_codec_info); case bluetooth::a2dp::CodecId::APTX: return A2DP_VendorGetTrackChannelCountAptx(p_codec_info); case bluetooth::a2dp::CodecId::APTX_HD: return A2DP_VendorGetTrackChannelCountAptxHd(p_codec_info); case bluetooth::a2dp::CodecId::LDAC: return A2DP_VendorGetTrackChannelCountLdac(p_codec_info); case bluetooth::a2dp::CodecId::OPUS: return A2DP_VendorGetTrackChannelCountOpus(p_codec_info); #endif default: break; } log::error("unsupported codec type 0x{:x}", codec_type); log::error("unsupported codec id 0x{:x}", codec_id.value()); return -1; } Loading @@ -1363,22 +1399,32 @@ int A2DP_GetSinkTrackChannelType(const uint8_t* p_codec_info) { bool A2DP_GetPacketTimestamp(const uint8_t* p_codec_info, const uint8_t* p_data, uint32_t* p_timestamp) { tA2DP_CODEC_TYPE codec_type = A2DP_GetCodecType(p_codec_info); auto codec_id = bluetooth::a2dp::ParseCodecId(p_codec_info); switch (codec_type) { case A2DP_MEDIA_CT_SBC: if (!codec_id.has_value()) { return false; } switch (codec_id.value()) { case bluetooth::a2dp::CodecId::SBC: return A2DP_GetPacketTimestampSbc(p_codec_info, p_data, p_timestamp); #if !defined(EXCLUDE_NONSTANDARD_CODECS) case A2DP_MEDIA_CT_AAC: case bluetooth::a2dp::CodecId::AAC: return A2DP_GetPacketTimestampAac(p_codec_info, p_data, p_timestamp); case A2DP_MEDIA_CT_NON_A2DP: return A2DP_VendorGetPacketTimestamp(p_codec_info, p_data, p_timestamp); case bluetooth::a2dp::CodecId::APTX: return A2DP_VendorGetPacketTimestampAptx(p_codec_info, p_data, p_timestamp); case bluetooth::a2dp::CodecId::APTX_HD: return A2DP_VendorGetPacketTimestampAptxHd(p_codec_info, p_data, p_timestamp); case bluetooth::a2dp::CodecId::LDAC: return A2DP_VendorGetPacketTimestampLdac(p_codec_info, p_data, p_timestamp); case bluetooth::a2dp::CodecId::OPUS: return A2DP_VendorGetPacketTimestampOpus(p_codec_info, p_data, p_timestamp); #endif default: break; } log::error("unsupported codec type 0x{:x}", codec_type); log::error("unsupported codec id 0x{:x}", codec_id.value()); return false; } Loading
system/stack/a2dp/a2dp_vendor.cc +0 −160 Original line number Diff line number Diff line Loading @@ -233,49 +233,6 @@ bool A2DP_VendorCodecTypeEquals(const uint8_t* p_codec_info_a, const uint8_t* p_ return true; } bool A2DP_VendorCodecEquals(const uint8_t* p_codec_info_a, const uint8_t* p_codec_info_b) { tA2DP_CODEC_TYPE codec_type_a = A2DP_GetCodecType(p_codec_info_a); tA2DP_CODEC_TYPE codec_type_b = A2DP_GetCodecType(p_codec_info_b); if ((codec_type_a != codec_type_b) || (codec_type_a != A2DP_MEDIA_CT_NON_A2DP)) { return false; } uint32_t vendor_id_a = A2DP_VendorCodecGetVendorId(p_codec_info_a); uint16_t codec_id_a = A2DP_VendorCodecGetCodecId(p_codec_info_a); uint32_t vendor_id_b = A2DP_VendorCodecGetVendorId(p_codec_info_b); uint16_t codec_id_b = A2DP_VendorCodecGetCodecId(p_codec_info_b); if ((vendor_id_a != vendor_id_b) || (codec_id_a != codec_id_b)) { return false; } // Check for aptX if (vendor_id_a == A2DP_APTX_VENDOR_ID && codec_id_a == A2DP_APTX_CODEC_ID_BLUETOOTH) { return A2DP_VendorCodecEqualsAptx(p_codec_info_a, p_codec_info_b); } // Check for aptX-HD if (vendor_id_a == A2DP_APTX_HD_VENDOR_ID && codec_id_a == A2DP_APTX_HD_CODEC_ID_BLUETOOTH) { return A2DP_VendorCodecEqualsAptxHd(p_codec_info_a, p_codec_info_b); } // Check for LDAC if (vendor_id_a == A2DP_LDAC_VENDOR_ID && codec_id_a == A2DP_LDAC_CODEC_ID) { return A2DP_VendorCodecEqualsLdac(p_codec_info_a, p_codec_info_b); } // Check for Opus if (vendor_id_a == A2DP_OPUS_VENDOR_ID && codec_id_a == A2DP_OPUS_CODEC_ID) { return A2DP_VendorCodecEqualsOpus(p_codec_info_a, p_codec_info_b); } // Add extra vendor-specific checks based on the // vendor-specific data stored in "p_codec_info_a" and "p_codec_info_b". return false; } int A2DP_VendorGetBitRate(const uint8_t* p_codec_info) { uint32_t vendor_id = A2DP_VendorCodecGetVendorId(p_codec_info); uint16_t codec_id = A2DP_VendorCodecGetCodecId(p_codec_info); Loading Loading @@ -305,93 +262,6 @@ int A2DP_VendorGetBitRate(const uint8_t* p_codec_info) { return -1; } int A2DP_VendorGetTrackSampleRate(const uint8_t* p_codec_info) { uint32_t vendor_id = A2DP_VendorCodecGetVendorId(p_codec_info); uint16_t codec_id = A2DP_VendorCodecGetCodecId(p_codec_info); // Check for aptX if (vendor_id == A2DP_APTX_VENDOR_ID && codec_id == A2DP_APTX_CODEC_ID_BLUETOOTH) { return A2DP_VendorGetTrackSampleRateAptx(p_codec_info); } // Check for aptX-HD if (vendor_id == A2DP_APTX_HD_VENDOR_ID && codec_id == A2DP_APTX_HD_CODEC_ID_BLUETOOTH) { return A2DP_VendorGetTrackSampleRateAptxHd(p_codec_info); } // Check for LDAC if (vendor_id == A2DP_LDAC_VENDOR_ID && codec_id == A2DP_LDAC_CODEC_ID) { return A2DP_VendorGetTrackSampleRateLdac(p_codec_info); } // Check for Opus if (vendor_id == A2DP_OPUS_VENDOR_ID && codec_id == A2DP_OPUS_CODEC_ID) { return A2DP_VendorGetTrackSampleRateOpus(p_codec_info); } // Add checks based on <vendor_id, codec_id> return -1; } int A2DP_VendorGetTrackBitsPerSample(const uint8_t* p_codec_info) { uint32_t vendor_id = A2DP_VendorCodecGetVendorId(p_codec_info); uint16_t codec_id = A2DP_VendorCodecGetCodecId(p_codec_info); // Check for aptX if (vendor_id == A2DP_APTX_VENDOR_ID && codec_id == A2DP_APTX_CODEC_ID_BLUETOOTH) { return A2DP_VendorGetTrackBitsPerSampleAptx(p_codec_info); } // Check for aptX-HD if (vendor_id == A2DP_APTX_HD_VENDOR_ID && codec_id == A2DP_APTX_HD_CODEC_ID_BLUETOOTH) { return A2DP_VendorGetTrackBitsPerSampleAptxHd(p_codec_info); } // Check for LDAC if (vendor_id == A2DP_LDAC_VENDOR_ID && codec_id == A2DP_LDAC_CODEC_ID) { return A2DP_VendorGetTrackBitsPerSampleLdac(p_codec_info); } // Check for Opus if (vendor_id == A2DP_OPUS_VENDOR_ID && codec_id == A2DP_OPUS_CODEC_ID) { return A2DP_VendorGetTrackBitsPerSampleOpus(p_codec_info); } // Add checks based on <vendor_id, codec_id> return -1; } int A2DP_VendorGetTrackChannelCount(const uint8_t* p_codec_info) { uint32_t vendor_id = A2DP_VendorCodecGetVendorId(p_codec_info); uint16_t codec_id = A2DP_VendorCodecGetCodecId(p_codec_info); // Check for aptX if (vendor_id == A2DP_APTX_VENDOR_ID && codec_id == A2DP_APTX_CODEC_ID_BLUETOOTH) { return A2DP_VendorGetTrackChannelCountAptx(p_codec_info); } // Check for aptX-HD if (vendor_id == A2DP_APTX_HD_VENDOR_ID && codec_id == A2DP_APTX_HD_CODEC_ID_BLUETOOTH) { return A2DP_VendorGetTrackChannelCountAptxHd(p_codec_info); } // Check for LDAC if (vendor_id == A2DP_LDAC_VENDOR_ID && codec_id == A2DP_LDAC_CODEC_ID) { return A2DP_VendorGetTrackChannelCountLdac(p_codec_info); } // Check for Opus if (vendor_id == A2DP_OPUS_VENDOR_ID && codec_id == A2DP_OPUS_CODEC_ID) { return A2DP_VendorGetTrackChannelCountOpus(p_codec_info); } // Add checks based on <vendor_id, codec_id> return -1; } int A2DP_VendorGetSinkTrackChannelType(const uint8_t* p_codec_info) { uint32_t vendor_id = A2DP_VendorCodecGetVendorId(p_codec_info); uint16_t codec_id = A2DP_VendorCodecGetCodecId(p_codec_info); Loading @@ -412,36 +282,6 @@ int A2DP_VendorGetSinkTrackChannelType(const uint8_t* p_codec_info) { return -1; } bool A2DP_VendorGetPacketTimestamp(const uint8_t* p_codec_info, const uint8_t* p_data, uint32_t* p_timestamp) { uint32_t vendor_id = A2DP_VendorCodecGetVendorId(p_codec_info); uint16_t codec_id = A2DP_VendorCodecGetCodecId(p_codec_info); // Check for aptX if (vendor_id == A2DP_APTX_VENDOR_ID && codec_id == A2DP_APTX_CODEC_ID_BLUETOOTH) { return A2DP_VendorGetPacketTimestampAptx(p_codec_info, p_data, p_timestamp); } // Check for aptX-HD if (vendor_id == A2DP_APTX_HD_VENDOR_ID && codec_id == A2DP_APTX_HD_CODEC_ID_BLUETOOTH) { return A2DP_VendorGetPacketTimestampAptxHd(p_codec_info, p_data, p_timestamp); } // Check for LDAC if (vendor_id == A2DP_LDAC_VENDOR_ID && codec_id == A2DP_LDAC_CODEC_ID) { return A2DP_VendorGetPacketTimestampLdac(p_codec_info, p_data, p_timestamp); } // Check for Opus if (vendor_id == A2DP_OPUS_VENDOR_ID && codec_id == A2DP_OPUS_CODEC_ID) { return A2DP_VendorGetPacketTimestampOpus(p_codec_info, p_data, p_timestamp); } // Add checks based on <vendor_id, codec_id> return false; } bool A2DP_VendorBuildCodecHeader(const uint8_t* p_codec_info, BT_HDR* p_buf, uint16_t frames_per_packet) { uint32_t vendor_id = A2DP_VendorCodecGetVendorId(p_codec_info); Loading
system/stack/include/a2dp_constants.h +2 −0 Original line number Diff line number Diff line Loading @@ -169,6 +169,8 @@ enum tA2DP_STATUS : uint8_t { namespace fmt { template <> struct formatter<bluetooth::a2dp::CodecId> : enum_formatter<bluetooth::a2dp::CodecId> {}; template <> struct formatter<tA2DP_CODEC_TYPE> : enum_formatter<tA2DP_CODEC_TYPE> {}; template <> struct formatter<tA2DP_STATUS> : enum_formatter<tA2DP_STATUS> {}; Loading
system/stack/include/a2dp_vendor.h +0 −32 Original line number Diff line number Diff line Loading @@ -100,30 +100,6 @@ const char* A2DP_VendorCodecName(const uint8_t* p_codec_info); // If the codec type is not recognized, the return value is false. bool A2DP_VendorCodecTypeEquals(const uint8_t* p_codec_info_a, const uint8_t* p_codec_info_b); // Checks whether two A2DP vendor-specific codecs |p_codec_info_a| and // |p_codec_info_b| are exactly the same. // Returns true if the two codecs are exactly the same, otherwise false. // If the codec type is not recognized, the return value is false. bool A2DP_VendorCodecEquals(const uint8_t* p_codec_info_a, const uint8_t* p_codec_info_b); // Gets the track sample rate value for the A2DP vendor-specific codec. // |p_codec_info| is a pointer to the vendor-specific codec_info to decode. // Returns the track sample rate on success, or -1 if |p_codec_info| // contains invalid codec information. int A2DP_VendorGetTrackSampleRate(const uint8_t* p_codec_info); // Gets the track bits per sample value for the A2DP vendor-specific codec. // |p_codec_info| is a pointer to the vendor-specific codec_info to decode. // Returns the track sample rate on success, or -1 if |p_codec_info| // contains invalid codec information. int A2DP_VendorGetTrackBitsPerSample(const uint8_t* p_codec_info); // Gets the channel count for the A2DP vendor-specific codec. // |p_codec_info| is a pointer to the vendor-specific codec_info to decode. // Returns the channel count on success, or -1 if |p_codec_info| // contains invalid codec information. int A2DP_VendorGetTrackChannelCount(const uint8_t* p_codec_info); // Gets the bitrate for the A2DP vendor-specific codec. // |p_codec_info| is a pointer to the vendor-specific codec_info to decode. // Returns the channel count on success, or -1 if |p_codec_info| Loading @@ -137,14 +113,6 @@ int A2DP_VendorGetBitRate(const uint8_t* p_codec_info); // contains invalid codec information. int A2DP_VendorGetSinkTrackChannelType(const uint8_t* p_codec_info); // Gets the A2DP codec-specific audio data timestamp from an audio packet. // |p_codec_info| contains the codec information. // |p_data| contains the audio data. // The timestamp is stored in |p_timestamp|. // Returns true on success, otherwise false. bool A2DP_VendorGetPacketTimestamp(const uint8_t* p_codec_info, const uint8_t* p_data, uint32_t* p_timestamp); // Builds A2DP vendor-specific codec header for audio data. // |p_codec_info| contains the codec information. // |p_buf| contains the audio data. Loading
system/stack/test/stack_a2dp_test.cc +8 −9 Original line number Diff line number Diff line Loading @@ -579,7 +579,7 @@ TEST_F(StackA2dpTest, test_a2dp_codec_equals) { // Test two identical Opus codecs memset(codec_info_opus_test, 0xAB, sizeof(codec_info_opus_test)); memcpy(codec_info_opus_test, codec_info_opus, sizeof(codec_info_opus)); ASSERT_TRUE(A2DP_VendorCodecEquals(codec_info_opus, codec_info_opus_test)); ASSERT_TRUE(A2DP_CodecEquals(codec_info_opus, codec_info_opus_test)); // Test two identical non-A2DP codecs that are not recognized memset(codec_info_non_a2dp_test, 0xAB, sizeof(codec_info_non_a2dp_test)); Loading Loading @@ -627,14 +627,14 @@ TEST_F(StackA2dpTest, test_a2dp_codec_equals) { TEST_F(StackA2dpTest, test_a2dp_get_track_sample_rate) { EXPECT_EQ(A2DP_GetTrackSampleRate(codec_info_sbc), 44100); EXPECT_EQ(A2DP_GetTrackSampleRate(codec_info_aac), 44100); ASSERT_EQ(A2DP_VendorGetTrackSampleRate(codec_info_opus), 48000); ASSERT_EQ(A2DP_GetTrackSampleRate(codec_info_opus), 48000); EXPECT_EQ(A2DP_GetTrackSampleRate(codec_info_non_a2dp), -1); } TEST_F(StackA2dpTest, test_a2dp_get_track_channel_count) { EXPECT_EQ(A2DP_GetTrackChannelCount(codec_info_sbc), 2); EXPECT_EQ(A2DP_GetTrackChannelCount(codec_info_aac), 2); ASSERT_EQ(A2DP_VendorGetTrackChannelCount(codec_info_opus), 2); ASSERT_EQ(A2DP_GetTrackChannelCount(codec_info_opus), 2); EXPECT_EQ(A2DP_GetTrackChannelCount(codec_info_non_a2dp), -1); } Loading Loading @@ -687,7 +687,7 @@ TEST_F(StackA2dpTest, test_a2dp_get_max_bitpool_sbc) { TEST_F(StackA2dpTest, test_a2dp_get_sink_track_channel_type) { EXPECT_EQ(A2DP_GetSinkTrackChannelType(codec_info_sbc), 3); EXPECT_EQ(A2DP_GetSinkTrackChannelType(codec_info_aac), 3); ASSERT_EQ(A2DP_VendorGetSinkTrackChannelType(codec_info_opus), 2); ASSERT_EQ(A2DP_GetSinkTrackChannelType(codec_info_opus), 2); EXPECT_EQ(A2DP_GetSinkTrackChannelType(codec_info_non_a2dp), -1); } Loading Loading @@ -735,7 +735,7 @@ TEST_F(StackA2dpTest, test_a2dp_get_packet_timestamp) { memset(a2dp_data, 0xAB, sizeof(a2dp_data)); *p_ts = 0x12345678; timestamp = 0xFFFFFFFF; ASSERT_TRUE(A2DP_VendorGetPacketTimestamp(codec_info_opus, a2dp_data, ×tamp)); ASSERT_TRUE(A2DP_GetPacketTimestamp(codec_info_opus, a2dp_data, ×tamp)); ASSERT_EQ(timestamp, static_cast<uint32_t>(0x12345678)); memset(a2dp_data, 0xAB, sizeof(a2dp_data)); Loading Loading @@ -818,10 +818,9 @@ TEST_F(StackA2dpTest, test_a2dp_source_codec_index) { EXPECT_EQ(A2DP_SourceCodecIndex(codec_info_aac_capability), BTAV_A2DP_CODEC_INDEX_SOURCE_AAC); EXPECT_EQ(A2DP_SourceCodecIndex(codec_info_aac_sink_capability), BTAV_A2DP_CODEC_INDEX_SOURCE_AAC); ASSERT_EQ(A2DP_VendorSourceCodecIndex(codec_info_opus), BTAV_A2DP_CODEC_INDEX_SOURCE_OPUS); ASSERT_EQ(A2DP_VendorSourceCodecIndex(codec_info_opus_capability), BTAV_A2DP_CODEC_INDEX_SOURCE_OPUS); ASSERT_EQ(A2DP_VendorSourceCodecIndex(codec_info_opus_sink_capability), ASSERT_EQ(A2DP_SourceCodecIndex(codec_info_opus), BTAV_A2DP_CODEC_INDEX_SOURCE_OPUS); ASSERT_EQ(A2DP_SourceCodecIndex(codec_info_opus_capability), BTAV_A2DP_CODEC_INDEX_SOURCE_OPUS); ASSERT_EQ(A2DP_SourceCodecIndex(codec_info_opus_sink_capability), BTAV_A2DP_CODEC_INDEX_SOURCE_OPUS); EXPECT_EQ(A2DP_SourceCodecIndex(codec_info_non_a2dp), BTAV_A2DP_CODEC_INDEX_MAX); } Loading