< >
Platform: RK3288
OS: Android 7.1.2
Kernel: v4.4.143
问题:
HDMI输出给个别电视机时,电视机无声音
分析步骤:
1、用以下命令测试HDMI是否有输出
tinyplay 44.1k_2ch_16b_1k_15s.wav -D 0 -d 1 -c 2 -b 16 -r 44100 指令播放附件wav文件
结论:该命令HDMI有声音输出
2、打开音频相关的日志输出并提供Logcat日志给RK
diff --git a/tinyalsa_hal/alsa_route.c b/tinyalsa_hal/alsa_route.c
index f28f3a6..b550b91 100755
--- a/tinyalsa_hal/alsa_route.c
+++ b/tinyalsa_hal/alsa_route.c
@@ -43,7 +43,7 @@
#define LOG_TAG "alsa_route"
-//#define LOG_NDEBUG 0
+#define LOG_NDEBUG 0
#include
#include
diff --git a/tinyalsa_hal/audio_hw.c b/tinyalsa_hal/audio_hw.c
index a7445ba..18164f2 100755
--- a/tinyalsa_hal/audio_hw.c
+++ b/tinyalsa_hal/audio_hw.c
@@ -70,7 +70,7 @@
* @date 2015-08-24
*/
-//#define LOG_NDEBUG 0
+#define LOG_NDEBUG 0
#define LOG_TAG "AudioHardwareTiny"
#include "alsa_audio.h"
@@ -854,7 +854,7 @@ static int start_output_stream(struct stream_out *out)
int ret = 0;
int card = (int)SND_OUT_SOUND_CARD_UNKNOWN;
- ALOGD("%s device: %x",__FUNCTION__, out->device);
+ ALOGD("%s out->device=0x%x,out->pcm_device=0x%d n",__FUNCTION__,out->device,out->pcm_device);
if (out == adev->outputs[OUTPUT_HDMI_MULTI]) {
force_non_hdmi_out_standby(adev);
} else if (adev->outputs[OUTPUT_HDMI_MULTI] && !adev->outputs[OUTPUT_HDMI_MULTI]->standby) {
3、根据RK的方法修改如下
diff --git a/tinyalsa_hal/audio_hw.c b/tinyalsa_hal/audio_hw.c
index 0a35b80..f091c97 100755
--- a/tinyalsa_hal/audio_hw.c
+++ b/tinyalsa_hal/audio_hw.c
@@ -644,7 +644,7 @@ static int start_output_stream(struct stream_out *out)
}
#endif
#endif
- out->pcm[PCM_CARD_HDMI] = pcm_open(PCM_CARD_HDMI, out->pcm_device,
+ out->pcm[PCM_CARD_HDMI] = pcm_open(0, 1,
PCM_OUT | PCM_MONOTONIC, &out->config);
if (out->pcm[PCM_CARD_HDMI] &&
!pcm_is_ready(out->pcm[PCM_CARD_HDMI])) {
原理:
1、查找头文件audio_hw.h对PCM_CARD_HDMI的声明如下
#ifdef BOX_HAL
int PCM_CARD = 0;
int PCM_CARD_HDMI = 0;
int PCM_CARD_SPDIF = 1;
#else
int PCM_CARD = 0;
int PCM_CARD_HDMI = 1;
int PCM_CARD_SPDIF = 2;
#endif
如上代码对pcm设备进行了选配,根据Android.mk文件选配。
2、调试:获取当前声卡的编号 cat /proc/asound/cards
< >
Platform: RK3288
OS: Android 7.1.2
Kernel: v4.4.143
问题:
HDMI输出给个别电视机时,电视机无声音
分析步骤:
1、用以下命令测试HDMI是否有输出
tinyplay 44.1k_2ch_16b_1k_15s.wav -D 0 -d 1 -c 2 -b 16 -r 44100 指令播放附件wav文件
结论:该命令HDMI有声音输出
2、打开音频相关的日志输出并提供Logcat日志给RK
diff --git a/tinyalsa_hal/alsa_route.c b/tinyalsa_hal/alsa_route.c
index f28f3a6..b550b91 100755
--- a/tinyalsa_hal/alsa_route.c
+++ b/tinyalsa_hal/alsa_route.c
@@ -43,7 +43,7 @@
#define LOG_TAG "alsa_route"
-//#define LOG_NDEBUG 0
+#define LOG_NDEBUG 0
#include
#include
diff --git a/tinyalsa_hal/audio_hw.c b/tinyalsa_hal/audio_hw.c
index a7445ba..18164f2 100755
--- a/tinyalsa_hal/audio_hw.c
+++ b/tinyalsa_hal/audio_hw.c
@@ -70,7 +70,7 @@
* @date 2015-08-24
*/
-//#define LOG_NDEBUG 0
+#define LOG_NDEBUG 0
#define LOG_TAG "AudioHardwareTiny"
#include "alsa_audio.h"
@@ -854,7 +854,7 @@ static int start_output_stream(struct stream_out *out)
int ret = 0;
int card = (int)SND_OUT_SOUND_CARD_UNKNOWN;
- ALOGD("%s device: %x",__FUNCTION__, out->device);
+ ALOGD("%s out->device=0x%x,out->pcm_device=0x%d n",__FUNCTION__,out->device,out->pcm_device);
if (out == adev->outputs[OUTPUT_HDMI_MULTI]) {
force_non_hdmi_out_standby(adev);
} else if (adev->outputs[OUTPUT_HDMI_MULTI] && !adev->outputs[OUTPUT_HDMI_MULTI]->standby) {
3、根据RK的方法修改如下
diff --git a/tinyalsa_hal/audio_hw.c b/tinyalsa_hal/audio_hw.c
index 0a35b80..f091c97 100755
--- a/tinyalsa_hal/audio_hw.c
+++ b/tinyalsa_hal/audio_hw.c
@@ -644,7 +644,7 @@ static int start_output_stream(struct stream_out *out)
}
#endif
#endif
- out->pcm[PCM_CARD_HDMI] = pcm_open(PCM_CARD_HDMI, out->pcm_device,
+ out->pcm[PCM_CARD_HDMI] = pcm_open(0, 1,
PCM_OUT | PCM_MONOTONIC, &out->config);
if (out->pcm[PCM_CARD_HDMI] &&
!pcm_is_ready(out->pcm[PCM_CARD_HDMI])) {
原理:
1、查找头文件audio_hw.h对PCM_CARD_HDMI的声明如下
#ifdef BOX_HAL
int PCM_CARD = 0;
int PCM_CARD_HDMI = 0;
int PCM_CARD_SPDIF = 1;
#else
int PCM_CARD = 0;
int PCM_CARD_HDMI = 1;
int PCM_CARD_SPDIF = 2;
#endif
如上代码对pcm设备进行了选配,根据Android.mk文件选配。
2、调试:获取当前声卡的编号 cat /proc/asound/cards
举报