hearingDevice->accepting_audio = true;
LOG(INFO) << __func__ << ": address=" << address
<< ", hi_sync_id=" << loghex(hearingDevice->hi_sync_id);
+
+ StartSendingAudio(*hearingDevice);
+
callbacks->OnDeviceAvailable(hearingDevice->capabilities,
hearingDevice->hi_sync_id, address);
callbacks->OnConnectionState(ConnectionState::CONNECTED, address);
-
- StartSendingAudio(*hearingDevice);
}
void StartSendingAudio(const HearingDevice& hearingDevice) {
controller_get_interface()->supports_ble_2m_phy()) {
codec_in_use = CODEC_G722_24KHZ;
codec.sample_rate = 24000;
- codec.bit_rate = 16;
- codec.data_interval_ms = 10;
} else if (codecs & (1 << CODEC_G722_16KHZ)) {
codec_in_use = CODEC_G722_16KHZ;
codec.sample_rate = 16000;
- codec.bit_rate = 16;
- codec.data_interval_ms = 10;
}
- // TODO: remove once we implement support for other codecs
- codec_in_use = CODEC_G722_16KHZ;
+ codec.bit_rate = 16;
+ codec.data_interval_ms = 10;
+
HearingAidAudioSource::Start(codec, audioReceiver);
}
}
extern const char* audio_ha_hw_dump_ctrl_event(tHEARING_AID_CTRL_CMD event);
namespace {
-int bit_rate = 16;
-int sample_rate = 16000;
-int data_interval_ms = 10 /* msec */;
+int bit_rate = -1;
+int sample_rate = -1;
+int data_interval_ms = -1;
int num_channels = 2;
alarm_t* audio_timer = nullptr;
UIPC_Ioctl(*uipc_hearing_aid, UIPC_CH_ID_AV_AUDIO, UIPC_SET_READ_POLL_TMO,
reinterpret_cast<void*>(0));
+ if (data_interval_ms != 10) {
+ LOG(FATAL) << " Unsupported data interval: " << data_interval_ms;
+ }
+
audio_timer = alarm_new_periodic("hearing_aid_data_timer");
alarm_set_on_mloop(audio_timer, data_interval_ms, send_audio_data,
nullptr);
HearingAidAudioReceiver* audioReceiver) {
localAudioReceiver = audioReceiver;
VLOG(2) << "Hearing Aid UIPC Open";
+
+ bit_rate = codecConfiguration.bit_rate;
+ sample_rate = codecConfiguration.sample_rate;
+ data_interval_ms = codecConfiguration.data_interval_ms;
+
stats.Reset();
}