Loading system/audio_bluetooth_hw/stream_apis.cc +23 −19 Original line number Diff line number Diff line Loading @@ -27,6 +27,8 @@ #include <time.h> #include <unistd.h> #include <memory> #include "BluetoothAudioSession.h" #include "stream_apis.h" #include "utils.h" Loading Loading @@ -697,7 +699,7 @@ int adev_open_output_stream(struct audio_hw_device* dev, struct audio_stream_out** stream_out, const char* address __unused) { *stream_out = nullptr; auto* out = new BluetoothStreamOut{}; auto out = std::make_unique<BluetoothStreamOut>(); if (::aidl::android::hardware::bluetooth::audio::BluetoothAudioSession:: IsAidlAvailable()) { out->bluetooth_output_ = std::make_unique< Loading @@ -711,7 +713,6 @@ int adev_open_output_stream(struct audio_hw_device* dev, if (!out->bluetooth_output_->SetUp(devices)) { out->bluetooth_output_ = nullptr; LOG(ERROR) << __func__ << ": cannot init HAL"; delete out; return -EINVAL; } LOG(VERBOSE) << __func__ << ": device=" << StringPrintf("%#x", devices); Loading Loading @@ -782,18 +783,21 @@ int adev_open_output_stream(struct audio_hw_device* dev, out->frames_rendered_ = 0; out->frames_presented_ = 0; BluetoothStreamOut* out_ptr = out.release(); { auto* bluetooth_device = reinterpret_cast<BluetoothAudioDevice*>(dev); std::lock_guard<std::mutex> guard(bluetooth_device->mutex_); bluetooth_device->opened_stream_outs_.push_back(out); bluetooth_device->opened_stream_outs_.push_back(out_ptr); } *stream_out = &out->stream_out_; LOG(INFO) << __func__ << ": state=" << out->bluetooth_output_->GetState() << ", sample_rate=" << out->sample_rate_ << ", channels=" << StringPrintf("%#x", out->channel_mask_) << ", format=" << out->format_ << ", preferred_data_interval_us=" << out->preferred_data_interval_us << ", frames=" << out->frames_count_; *stream_out = &out_ptr->stream_out_; LOG(INFO) << __func__ << ": state=" << out_ptr->bluetooth_output_->GetState() << ", sample_rate=" << out_ptr->sample_rate_ << ", channels=" << StringPrintf("%#x", out_ptr->channel_mask_) << ", format=" << out_ptr->format_ << ", preferred_data_interval_us=" << out_ptr->preferred_data_interval_us << ", frames=" << out_ptr->frames_count_; return 0; } Loading Loading @@ -1203,7 +1207,7 @@ int adev_open_input_stream(struct audio_hw_device* dev, const char* address __unused, audio_source_t source __unused) { *stream_in = nullptr; auto* in = new BluetoothStreamIn{}; auto in = std::make_unique<BluetoothStreamIn>(); if (::aidl::android::hardware::bluetooth::audio::BluetoothAudioSession:: IsAidlAvailable()) { in->bluetooth_input_ = std::make_unique< Loading @@ -1217,7 +1221,6 @@ int adev_open_input_stream(struct audio_hw_device* dev, if (!in->bluetooth_input_->SetUp(devices)) { in->bluetooth_input_ = nullptr; LOG(ERROR) << __func__ << ": cannot init HAL"; delete in; return -EINVAL; } Loading Loading @@ -1273,13 +1276,14 @@ int adev_open_input_stream(struct audio_hw_device* dev, frame_count(in->preferred_data_interval_us, in->sample_rate_); in->frames_presented_ = 0; *stream_in = &in->stream_in_; LOG(INFO) << __func__ << ": state=" << in->bluetooth_input_->GetState() << ", sample_rate=" << in->sample_rate_ << ", channels=" << StringPrintf("%#x", in->channel_mask_) << ", format=" << in->format_ << ", preferred_data_interval_us=" << in->preferred_data_interval_us << ", frames=" << in->frames_count_; BluetoothStreamIn* in_ptr = in.release(); *stream_in = &in_ptr->stream_in_; LOG(INFO) << __func__ << ": state=" << in_ptr->bluetooth_input_->GetState() << ", sample_rate=" << in_ptr->sample_rate_ << ", channels=" << StringPrintf("%#x", in_ptr->channel_mask_) << ", format=" << in_ptr->format_ << ", preferred_data_interval_us=" << in_ptr->preferred_data_interval_us << ", frames=" << in_ptr->frames_count_; return 0; } Loading Loading
system/audio_bluetooth_hw/stream_apis.cc +23 −19 Original line number Diff line number Diff line Loading @@ -27,6 +27,8 @@ #include <time.h> #include <unistd.h> #include <memory> #include "BluetoothAudioSession.h" #include "stream_apis.h" #include "utils.h" Loading Loading @@ -697,7 +699,7 @@ int adev_open_output_stream(struct audio_hw_device* dev, struct audio_stream_out** stream_out, const char* address __unused) { *stream_out = nullptr; auto* out = new BluetoothStreamOut{}; auto out = std::make_unique<BluetoothStreamOut>(); if (::aidl::android::hardware::bluetooth::audio::BluetoothAudioSession:: IsAidlAvailable()) { out->bluetooth_output_ = std::make_unique< Loading @@ -711,7 +713,6 @@ int adev_open_output_stream(struct audio_hw_device* dev, if (!out->bluetooth_output_->SetUp(devices)) { out->bluetooth_output_ = nullptr; LOG(ERROR) << __func__ << ": cannot init HAL"; delete out; return -EINVAL; } LOG(VERBOSE) << __func__ << ": device=" << StringPrintf("%#x", devices); Loading Loading @@ -782,18 +783,21 @@ int adev_open_output_stream(struct audio_hw_device* dev, out->frames_rendered_ = 0; out->frames_presented_ = 0; BluetoothStreamOut* out_ptr = out.release(); { auto* bluetooth_device = reinterpret_cast<BluetoothAudioDevice*>(dev); std::lock_guard<std::mutex> guard(bluetooth_device->mutex_); bluetooth_device->opened_stream_outs_.push_back(out); bluetooth_device->opened_stream_outs_.push_back(out_ptr); } *stream_out = &out->stream_out_; LOG(INFO) << __func__ << ": state=" << out->bluetooth_output_->GetState() << ", sample_rate=" << out->sample_rate_ << ", channels=" << StringPrintf("%#x", out->channel_mask_) << ", format=" << out->format_ << ", preferred_data_interval_us=" << out->preferred_data_interval_us << ", frames=" << out->frames_count_; *stream_out = &out_ptr->stream_out_; LOG(INFO) << __func__ << ": state=" << out_ptr->bluetooth_output_->GetState() << ", sample_rate=" << out_ptr->sample_rate_ << ", channels=" << StringPrintf("%#x", out_ptr->channel_mask_) << ", format=" << out_ptr->format_ << ", preferred_data_interval_us=" << out_ptr->preferred_data_interval_us << ", frames=" << out_ptr->frames_count_; return 0; } Loading Loading @@ -1203,7 +1207,7 @@ int adev_open_input_stream(struct audio_hw_device* dev, const char* address __unused, audio_source_t source __unused) { *stream_in = nullptr; auto* in = new BluetoothStreamIn{}; auto in = std::make_unique<BluetoothStreamIn>(); if (::aidl::android::hardware::bluetooth::audio::BluetoothAudioSession:: IsAidlAvailable()) { in->bluetooth_input_ = std::make_unique< Loading @@ -1217,7 +1221,6 @@ int adev_open_input_stream(struct audio_hw_device* dev, if (!in->bluetooth_input_->SetUp(devices)) { in->bluetooth_input_ = nullptr; LOG(ERROR) << __func__ << ": cannot init HAL"; delete in; return -EINVAL; } Loading Loading @@ -1273,13 +1276,14 @@ int adev_open_input_stream(struct audio_hw_device* dev, frame_count(in->preferred_data_interval_us, in->sample_rate_); in->frames_presented_ = 0; *stream_in = &in->stream_in_; LOG(INFO) << __func__ << ": state=" << in->bluetooth_input_->GetState() << ", sample_rate=" << in->sample_rate_ << ", channels=" << StringPrintf("%#x", in->channel_mask_) << ", format=" << in->format_ << ", preferred_data_interval_us=" << in->preferred_data_interval_us << ", frames=" << in->frames_count_; BluetoothStreamIn* in_ptr = in.release(); *stream_in = &in_ptr->stream_in_; LOG(INFO) << __func__ << ": state=" << in_ptr->bluetooth_input_->GetState() << ", sample_rate=" << in_ptr->sample_rate_ << ", channels=" << StringPrintf("%#x", in_ptr->channel_mask_) << ", format=" << in_ptr->format_ << ", preferred_data_interval_us=" << in_ptr->preferred_data_interval_us << ", frames=" << in_ptr->frames_count_; return 0; } Loading