Loading system/btif/include/btif_a2dp_sink.h +3 −0 Original line number Diff line number Diff line Loading @@ -85,6 +85,9 @@ tA2DP_SAMPLE_RATE btif_a2dp_sink_get_sample_rate(void); // Get the audio channel count for the A2DP Sink module. tA2DP_CHANNEL_COUNT btif_a2dp_sink_get_channel_count(void); // Get the audio bits per sample for the A2DP Sink module. tA2DP_BITS_PER_SAMPLE btif_a2dp_sink_get_bits_per_sample(void); // Update the decoder for the A2DP Sink module. // |p_codec_info| contains the new codec information. void btif_a2dp_sink_update_decoder(const uint8_t* p_codec_info); Loading system/btif/include/btif_avrcp_audio_track.h +2 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,8 @@ * should eventually be * deleted using BtifAvrcpAudioTrackDelete (see below). */ void* BtifAvrcpAudioTrackCreate(int trackFreq, int channelType); void* BtifAvrcpAudioTrackCreate(int trackFreq, int bits_per_sample, int channelType); /** * Starts the audio track. Loading system/btif/src/btif_a2dp_sink.cc +13 −1 Original line number Diff line number Diff line Loading @@ -113,6 +113,7 @@ class BtifA2dpSinkControlBlock { bool rx_flush; /* discards any incoming data when true */ alarm_t* decode_alarm; tA2DP_SAMPLE_RATE sample_rate; tA2DP_BITS_PER_SAMPLE bits_per_sample; tA2DP_CHANNEL_COUNT channel_count; btif_a2dp_sink_focus_state_t rx_focus_state; /* audio focus state */ void* audio_track; Loading Loading @@ -320,6 +321,11 @@ tA2DP_SAMPLE_RATE btif_a2dp_sink_get_sample_rate() { return btif_a2dp_sink_cb.sample_rate; } tA2DP_BITS_PER_SAMPLE btif_a2dp_sink_get_bits_per_sample() { LockGuard lock(g_mutex); return btif_a2dp_sink_cb.bits_per_sample; } tA2DP_CHANNEL_COUNT btif_a2dp_sink_get_channel_count() { LockGuard lock(g_mutex); return btif_a2dp_sink_cb.channel_count; Loading Loading @@ -539,6 +545,11 @@ static void btif_a2dp_sink_decoder_update_event( LOG_ERROR(LOG_TAG, "%s: cannot get the track frequency", __func__); return; } int bits_per_sample = A2DP_GetTrackBitsPerSample(p_buf->codec_info); if (bits_per_sample == -1) { LOG_ERROR(LOG_TAG, "%s: cannot get the bits per sample", __func__); return; } int channel_count = A2DP_GetTrackChannelCount(p_buf->codec_info); if (channel_count == -1) { LOG_ERROR(LOG_TAG, "%s: cannot get the channel count", __func__); Loading @@ -550,6 +561,7 @@ static void btif_a2dp_sink_decoder_update_event( return; } btif_a2dp_sink_cb.sample_rate = sample_rate; btif_a2dp_sink_cb.bits_per_sample = bits_per_sample; btif_a2dp_sink_cb.channel_count = channel_count; btif_a2dp_sink_cb.rx_flush = false; Loading @@ -571,7 +583,7 @@ static void btif_a2dp_sink_decoder_update_event( APPL_TRACE_DEBUG("%s: create audio track", __func__); btif_a2dp_sink_cb.audio_track = #ifndef OS_GENERIC BtifAvrcpAudioTrackCreate(sample_rate, channel_type); BtifAvrcpAudioTrackCreate(sample_rate, bits_per_sample, channel_type); #else NULL; #endif Loading system/btif/src/btif_avrcp_audio_track.cc +19 −4 Original line number Diff line number Diff line Loading @@ -35,11 +35,26 @@ FILE* outputPcmSampleFile; char outputFilename[50] = "/data/misc/bluedroid/output_sample.pcm"; #endif void* BtifAvrcpAudioTrackCreate(int trackFreq, int channelType) { LOG_VERBOSE(LOG_TAG, "%s Track.cpp: btCreateTrack freq %d channel %d ", __func__, trackFreq, channelType); void* BtifAvrcpAudioTrackCreate(int trackFreq, int bits_per_sample, int channelType) { audio_format_t format; switch (bits_per_sample) { default: case 16: format = AUDIO_FORMAT_PCM_16_BIT; break; case 24: format = AUDIO_FORMAT_PCM_24_BIT_PACKED; break; case 32: format = AUDIO_FORMAT_PCM_32_BIT; break; } LOG_VERBOSE(LOG_TAG, "%s Track.cpp: btCreateTrack freq %d format 0x%x channel %d ", __func__, trackFreq, format, channelType); sp<android::AudioTrack> track = new android::AudioTrack( AUDIO_STREAM_MUSIC, trackFreq, AUDIO_FORMAT_PCM_16_BIT, channelType, AUDIO_STREAM_MUSIC, trackFreq, format, channelType, (size_t)0 /*frameCount*/, (audio_output_flags_t)AUDIO_OUTPUT_FLAG_FAST, NULL /*callback_t*/, NULL /*void* user*/, 0 /*notificationFrames*/, AUDIO_SESSION_ALLOCATE, android::AudioTrack::TRANSFER_SYNC); Loading system/include/hardware/bt_av.h +4 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ typedef enum { // Add an entry for each sink codec here BTAV_A2DP_CODEC_INDEX_SINK_SBC = BTAV_A2DP_CODEC_INDEX_SINK_MIN, BTAV_A2DP_CODEC_INDEX_SINK_AAC, BTAV_A2DP_CODEC_INDEX_SINK_LDAC, BTAV_A2DP_CODEC_INDEX_SINK_MAX, Loading Loading @@ -154,6 +155,9 @@ typedef struct { case BTAV_A2DP_CODEC_INDEX_SINK_AAC: codec_name_str = "AAC (Sink)"; break; case BTAV_A2DP_CODEC_INDEX_SINK_LDAC: codec_name_str = "LDAC (Sink)"; break; case BTAV_A2DP_CODEC_INDEX_MAX: codec_name_str = "Unknown(CODEC_INDEX_MAX)"; break; Loading Loading
system/btif/include/btif_a2dp_sink.h +3 −0 Original line number Diff line number Diff line Loading @@ -85,6 +85,9 @@ tA2DP_SAMPLE_RATE btif_a2dp_sink_get_sample_rate(void); // Get the audio channel count for the A2DP Sink module. tA2DP_CHANNEL_COUNT btif_a2dp_sink_get_channel_count(void); // Get the audio bits per sample for the A2DP Sink module. tA2DP_BITS_PER_SAMPLE btif_a2dp_sink_get_bits_per_sample(void); // Update the decoder for the A2DP Sink module. // |p_codec_info| contains the new codec information. void btif_a2dp_sink_update_decoder(const uint8_t* p_codec_info); Loading
system/btif/include/btif_avrcp_audio_track.h +2 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,8 @@ * should eventually be * deleted using BtifAvrcpAudioTrackDelete (see below). */ void* BtifAvrcpAudioTrackCreate(int trackFreq, int channelType); void* BtifAvrcpAudioTrackCreate(int trackFreq, int bits_per_sample, int channelType); /** * Starts the audio track. Loading
system/btif/src/btif_a2dp_sink.cc +13 −1 Original line number Diff line number Diff line Loading @@ -113,6 +113,7 @@ class BtifA2dpSinkControlBlock { bool rx_flush; /* discards any incoming data when true */ alarm_t* decode_alarm; tA2DP_SAMPLE_RATE sample_rate; tA2DP_BITS_PER_SAMPLE bits_per_sample; tA2DP_CHANNEL_COUNT channel_count; btif_a2dp_sink_focus_state_t rx_focus_state; /* audio focus state */ void* audio_track; Loading Loading @@ -320,6 +321,11 @@ tA2DP_SAMPLE_RATE btif_a2dp_sink_get_sample_rate() { return btif_a2dp_sink_cb.sample_rate; } tA2DP_BITS_PER_SAMPLE btif_a2dp_sink_get_bits_per_sample() { LockGuard lock(g_mutex); return btif_a2dp_sink_cb.bits_per_sample; } tA2DP_CHANNEL_COUNT btif_a2dp_sink_get_channel_count() { LockGuard lock(g_mutex); return btif_a2dp_sink_cb.channel_count; Loading Loading @@ -539,6 +545,11 @@ static void btif_a2dp_sink_decoder_update_event( LOG_ERROR(LOG_TAG, "%s: cannot get the track frequency", __func__); return; } int bits_per_sample = A2DP_GetTrackBitsPerSample(p_buf->codec_info); if (bits_per_sample == -1) { LOG_ERROR(LOG_TAG, "%s: cannot get the bits per sample", __func__); return; } int channel_count = A2DP_GetTrackChannelCount(p_buf->codec_info); if (channel_count == -1) { LOG_ERROR(LOG_TAG, "%s: cannot get the channel count", __func__); Loading @@ -550,6 +561,7 @@ static void btif_a2dp_sink_decoder_update_event( return; } btif_a2dp_sink_cb.sample_rate = sample_rate; btif_a2dp_sink_cb.bits_per_sample = bits_per_sample; btif_a2dp_sink_cb.channel_count = channel_count; btif_a2dp_sink_cb.rx_flush = false; Loading @@ -571,7 +583,7 @@ static void btif_a2dp_sink_decoder_update_event( APPL_TRACE_DEBUG("%s: create audio track", __func__); btif_a2dp_sink_cb.audio_track = #ifndef OS_GENERIC BtifAvrcpAudioTrackCreate(sample_rate, channel_type); BtifAvrcpAudioTrackCreate(sample_rate, bits_per_sample, channel_type); #else NULL; #endif Loading
system/btif/src/btif_avrcp_audio_track.cc +19 −4 Original line number Diff line number Diff line Loading @@ -35,11 +35,26 @@ FILE* outputPcmSampleFile; char outputFilename[50] = "/data/misc/bluedroid/output_sample.pcm"; #endif void* BtifAvrcpAudioTrackCreate(int trackFreq, int channelType) { LOG_VERBOSE(LOG_TAG, "%s Track.cpp: btCreateTrack freq %d channel %d ", __func__, trackFreq, channelType); void* BtifAvrcpAudioTrackCreate(int trackFreq, int bits_per_sample, int channelType) { audio_format_t format; switch (bits_per_sample) { default: case 16: format = AUDIO_FORMAT_PCM_16_BIT; break; case 24: format = AUDIO_FORMAT_PCM_24_BIT_PACKED; break; case 32: format = AUDIO_FORMAT_PCM_32_BIT; break; } LOG_VERBOSE(LOG_TAG, "%s Track.cpp: btCreateTrack freq %d format 0x%x channel %d ", __func__, trackFreq, format, channelType); sp<android::AudioTrack> track = new android::AudioTrack( AUDIO_STREAM_MUSIC, trackFreq, AUDIO_FORMAT_PCM_16_BIT, channelType, AUDIO_STREAM_MUSIC, trackFreq, format, channelType, (size_t)0 /*frameCount*/, (audio_output_flags_t)AUDIO_OUTPUT_FLAG_FAST, NULL /*callback_t*/, NULL /*void* user*/, 0 /*notificationFrames*/, AUDIO_SESSION_ALLOCATE, android::AudioTrack::TRANSFER_SYNC); Loading
system/include/hardware/bt_av.h +4 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ typedef enum { // Add an entry for each sink codec here BTAV_A2DP_CODEC_INDEX_SINK_SBC = BTAV_A2DP_CODEC_INDEX_SINK_MIN, BTAV_A2DP_CODEC_INDEX_SINK_AAC, BTAV_A2DP_CODEC_INDEX_SINK_LDAC, BTAV_A2DP_CODEC_INDEX_SINK_MAX, Loading Loading @@ -154,6 +155,9 @@ typedef struct { case BTAV_A2DP_CODEC_INDEX_SINK_AAC: codec_name_str = "AAC (Sink)"; break; case BTAV_A2DP_CODEC_INDEX_SINK_LDAC: codec_name_str = "LDAC (Sink)"; break; case BTAV_A2DP_CODEC_INDEX_MAX: codec_name_str = "Unknown(CODEC_INDEX_MAX)"; break; Loading