@ -38,6 +38,17 @@
# include "audience.h"
# include "audience.h"
# endif
# endif
/**
* container_of - cast a member of a structure out to the containing structure
* @ ptr : the pointer to the member .
* @ type : the type of the container struct this is embedded in .
* @ member : the name of the member within the struct .
*
*/
# define container_of(ptr, type, member) ({ \
void * __mptr = ( void * ) ( ptr ) ; \
( ( type * ) ( ( uintptr_t ) __mptr - offsetof ( type , member ) ) ) ; } )
static struct pcm_config pcm_config_voicecall = {
static struct pcm_config pcm_config_voicecall = {
. channels = 2 ,
. channels = 2 ,
. rate = 8000 ,
. rate = 8000 ,
@ -160,6 +171,7 @@ static void stop_voice_session_bt_sco(struct voice_session *session) {
void start_voice_session_bt_sco ( struct voice_session * session )
void start_voice_session_bt_sco ( struct voice_session * session )
{
{
struct pcm_config * voice_sco_config ;
struct pcm_config * voice_sco_config ;
struct voice_data * vdata = container_of ( session , struct voice_data , session ) ;
if ( session - > pcm_sco_rx ! = NULL | | session - > pcm_sco_tx ! = NULL ) {
if ( session - > pcm_sco_rx ! = NULL | | session - > pcm_sco_tx ! = NULL ) {
ALOGW ( " %s: SCO PCMs already open! \n " , __func__ ) ;
ALOGW ( " %s: SCO PCMs already open! \n " , __func__ ) ;
@ -168,7 +180,7 @@ void start_voice_session_bt_sco(struct voice_session *session)
ALOGV ( " %s: Opening SCO PCMs " , __func__ ) ;
ALOGV ( " %s: Opening SCO PCMs " , __func__ ) ;
if ( session - > wb_amr_type > = 1 ) {
if ( vdata - > bluetooth_wb ) {
ALOGV ( " %s: pcm_config wideband " , __func__ ) ;
ALOGV ( " %s: pcm_config wideband " , __func__ ) ;
voice_sco_config = & pcm_config_voice_sco_wb ;
voice_sco_config = & pcm_config_voice_sco_wb ;
} else {
} else {
@ -372,6 +384,12 @@ bool voice_session_uses_twomic(struct voice_session *session)
bool voice_session_uses_wideband ( struct voice_session * session )
bool voice_session_uses_wideband ( struct voice_session * session )
{
{
struct voice_data * vdata = container_of ( session , struct voice_data , session ) ;
if ( session - > out_device & AUDIO_DEVICE_OUT_ALL_SCO ) {
return vdata - > bluetooth_wb ;
}
return session - > wb_amr_type > = 1 ;
return session - > wb_amr_type > = 1 ;
}
}