From facc1d02578ba901dded4acf6e9463dbfe1f4de9 Mon Sep 17 00:00:00 2001 From: xiebo Date: Mon, 9 Sep 2024 16:20:30 +0800 Subject: [PATCH] =?UTF-8?q?alsa-lib=E9=80=82=E9=85=8D=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xiebo --- oriole/patch.yml | 3 + .../0001-adapter-audio-play-and-capture.patch | 148 ++++++++++++++++++ 2 files changed, 151 insertions(+) create mode 100644 oriole/patches/third_party/alsa-lib/0001-adapter-audio-play-and-capture.patch diff --git a/oriole/patch.yml b/oriole/patch.yml index 0401f35..e7cc971 100644 --- a/oriole/patch.yml +++ b/oriole/patch.yml @@ -23,3 +23,6 @@ third_party/opencl-headers: developtools/integration_verification: - vendor/hardmony/oriole/patches/developtools/integration_verification/0001-chipsetsdk.patch + +third_party/alsa-lib: + - vendor/hardmony/oriole/patches/third_party/alsa-lib/0001-adapter-audio-play-and-capture.patch diff --git a/oriole/patches/third_party/alsa-lib/0001-adapter-audio-play-and-capture.patch b/oriole/patches/third_party/alsa-lib/0001-adapter-audio-play-and-capture.patch new file mode 100644 index 0000000..cc4a0d8 --- /dev/null +++ b/oriole/patches/third_party/alsa-lib/0001-adapter-audio-play-and-capture.patch @@ -0,0 +1,148 @@ +From 97cb1dfa27018aa0b3495bc5ea852e00fcd897cf Mon Sep 17 00:00:00 2001 +From: xiebo +Date: Mon, 9 Sep 2024 11:07:34 +0800 +Subject: [PATCH] adapter audio play and capture + +Signed-off-by: xiebo +--- + BUILD.gn | 4 ++++ + bundle.json | 5 ++++- + include/local.h | 6 ++++++ + src/control/control_hw.c | 4 +++- + src/control/ctlparse.c | 3 +++ + src/control/hcontrol.c | 3 ++- + src/pcm/pcm.c | 5 +++-- + 7 files changed, 25 insertions(+), 5 deletions(-) + +diff --git a/BUILD.gn b/BUILD.gn +index b20442ac..6121d4fd 100644 +--- a/BUILD.gn ++++ b/BUILD.gn +@@ -162,6 +162,7 @@ ohos_source_set("alsa_lib_dynamic") { + "//third_party/alsa-lib/src/control", + "//third_party/alsa-lib/src/timer", + "{target_gen_dir}/include/", ++ "//base/hiviewdfx/hilog/interfaces/native/innerkits/include", + ] + + configs = [ ":alsa_lib_config" ] +@@ -174,6 +175,9 @@ ohos_shared_library("libasound") { + # conf files + "src/conf:alsa-lib-prebuilt-all", + ] ++ external_deps = [ ++ "hilog:libhilog" ++ ] + license_file = "./README.OpenSource" + output_extension = "so" + install_images = [ chipset_base_dir ] +diff --git a/bundle.json b/bundle.json +index ef123afd..3986cab0 100644 +--- a/bundle.json ++++ b/bundle.json +@@ -23,7 +23,10 @@ + "rom": "950KB", + "ram": "988KB", + "deps": { +- "components": [], ++ "components": [ ++ "libhilog", ++ "hilog" ++ ], + "third_party": [] + }, + "build": { +diff --git a/include/local.h b/include/local.h +index ebc9350c..59e61679 100644 +--- a/include/local.h ++++ b/include/local.h +@@ -203,6 +203,12 @@ + #include "seq_midi_event.h" + #include "list.h" + ++#include "hilog/log.h" ++#undef LOG_DOMAIN ++#undef LOG_TAG ++#define LOG_DOMAIN 0xD003F00 ++#define LOG_TAG "alsa_lib" ++ + struct _snd_async_handler { + enum { + SND_ASYNC_HANDLER_GENERIC, +diff --git a/src/control/control_hw.c b/src/control/control_hw.c +index 680f0fec..76b04f9f 100644 +--- a/src/control/control_hw.c ++++ b/src/control/control_hw.c +@@ -146,8 +146,10 @@ static int snd_ctl_hw_elem_list(snd_ctl_t *handle, snd_ctl_elem_list_t *list) + static int snd_ctl_hw_elem_info(snd_ctl_t *handle, snd_ctl_elem_info_t *info) + { + snd_ctl_hw_t *hw = handle->private_data; +- if (ioctl(hw->fd, SNDRV_CTL_IOCTL_ELEM_INFO, info) < 0) ++ if (ioctl(hw->fd, SNDRV_CTL_IOCTL_ELEM_INFO, info) < 0) { ++ HILOG_INFO(LOG_CORE,"ioctl is faild"); + return -errno; ++ } + return 0; + } + +diff --git a/src/control/ctlparse.c b/src/control/ctlparse.c +index 3ed1c647..3c77792d 100644 +--- a/src/control/ctlparse.c ++++ b/src/control/ctlparse.c +@@ -160,6 +160,7 @@ int __snd_ctl_ascii_elem_id_parse(snd_ctl_elem_id_t *dst, const char *str, + int err = -EINVAL; + char *ptr; + ++ HILOG_INFO(LOG_CORE,"ctlparse __snd_ctl_ascii_elem_id_parse enter"); + while (isspace(*str)) + str++; + if (!(*str)) +@@ -242,6 +243,8 @@ int __snd_ctl_ascii_elem_id_parse(snd_ctl_elem_id_t *dst, const char *str, + while (isdigit(*str)) + str++; + } ++ HILOG_INFO("__snd_ctl_ascii_elem_id_parse name: %{public}s, index: %{public}d, iface: %{public}d, device: %{public}d, subdevice: %{public}d", ++ dst->name, dst->index, dst->iface, dst->device, dst->subdevice); + if (*str == ',') { + str++; + } else { +diff --git a/src/control/hcontrol.c b/src/control/hcontrol.c +index 0cac8956..c7775a4a 100644 +--- a/src/control/hcontrol.c ++++ b/src/control/hcontrol.c +@@ -613,7 +613,8 @@ int snd_hctl_load(snd_hctl_t *hctl) + int res = snd_hctl_throw_event(hctl, SNDRV_CTL_EVENT_MASK_ADD, + hctl->pelems[idx]); + if (res < 0) +- return res; ++ //return res; ++ printf("snd_hctl_load snd_hctl_throw_event is faild res: %d ,idx: %d , id: %d \n",res,idx,hctl->pelems[idx]->id); + } + err = snd_ctl_subscribe_events(hctl->ctl, 1); + _end: +diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c +index 9aec52d1..054a8c12 100644 +--- a/src/pcm/pcm.c ++++ b/src/pcm/pcm.c +@@ -1356,7 +1356,8 @@ int snd_pcm_drain(snd_pcm_t *pcm) + return 0; + /* lock handled in the callback */ + if (pcm->fast_ops->drain) +- err = pcm->fast_ops->drain(pcm->fast_op_arg); ++ //err = pcm->fast_ops->drain(pcm->fast_op_arg); ++ SNDMSG("skip pcm->fast_ops->drain"); + else + err = -ENOSYS; + return err; +@@ -2895,7 +2896,7 @@ int snd_pcm_wait_nocheck(snd_pcm_t *pcm, int timeout) + } + do { + __snd_pcm_unlock(pcm->fast_op_arg); +- err_poll = poll(pfd, npfds, timeout); ++ err_poll = poll(pfd, npfds, 40); + __snd_pcm_lock(pcm->fast_op_arg); + if (err_poll < 0) { + if (errno == EINTR && !PCMINABORT(pcm)) +-- +2.18.2 + -- Gitee