RK3588 Android13配置耳机和hdmi同时出声音

1、关掉BOARD_SUPPORT_MULTIAUDIO宏
2、frameworks/av修改

 using content::AttributionSourceState;
diff --git a/services/audiopolicy/enginedefault/src/Engine.cpp b/services/audiopolicy/enginedefault/src/Engine.cpp
old mode 100644
new mode 100755
index 9626483fd4..3dad282d13
--- a/services/audiopolicy/enginedefault/src/Engine.cpp
+++ b/services/audiopolicy/enginedefault/src/Engine.cpp
@@ -418,10 +418,32 @@ DeviceVector Engine::getDevicesForStrategyInt(legacy_strategy strategy,
         }
         DeviceVector devices3;
         if (strategy == STRATEGY_MEDIA) {
-            // ARC and AUX_LINE can co-exist with others.
-            devices3 = availableOutputDevices.getDevicesFromTypes({
-                    AUDIO_DEVICE_OUT_HDMI_ARC, AUDIO_DEVICE_OUT_HDMI_EARC,
-                    AUDIO_DEVICE_OUT_AUX_LINE, });
+            DeviceVector device_headset = availableOutputDevices.getDevicesFromType(
+                    AUDIO_DEVICE_OUT_WIRED_HEADSET);
+            DeviceVector device_headphone = availableOutputDevices.getDevicesFromType(
+                    AUDIO_DEVICE_OUT_WIRED_HEADPHONE);
+            if (device_headset.isEmpty() && device_headphone.isEmpty()) {
+                devices3 = availableOutputDevices.getDevicesFromTypes({
+                        AUDIO_DEVICE_OUT_SPEAKER,
+                        AUDIO_DEVICE_OUT_AUX_DIGITAL, VX_ROCKCHIP_OUT_HDMI0,
+                        AUDIO_DEVICE_OUT_SPDIF, VX_ROCKCHIP_OUT_SPDIF0,
+                        AUDIO_DEVICE_OUT_HDMI_ARC, AUDIO_DEVICE_OUT_HDMI_EARC,
+                        AUDIO_DEVICE_OUT_AUX_LINE, });
+            } else if (device_headset.isEmpty() && !device_headphone.isEmpty()) {
+                devices3 = availableOutputDevices.getDevicesFromTypes({
+                        AUDIO_DEVICE_OUT_WIRED_HEADPHONE,
+                        AUDIO_DEVICE_OUT_AUX_DIGITAL, VX_ROCKCHIP_OUT_HDMI0,
+                        AUDIO_DEVICE_OUT_SPDIF, VX_ROCKCHIP_OUT_SPDIF0,
+                        AUDIO_DEVICE_OUT_HDMI_ARC, AUDIO_DEVICE_OUT_HDMI_EARC,
+                        AUDIO_DEVICE_OUT_AUX_LINE, });
+            } else if (!device_headset.isEmpty() && device_headphone.isEmpty()) {
+                devices3 = availableOutputDevices.getDevicesFromTypes({
+                        AUDIO_DEVICE_OUT_WIRED_HEADSET,
+                        AUDIO_DEVICE_OUT_AUX_DIGITAL, VX_ROCKCHIP_OUT_HDMI0,
+                        AUDIO_DEVICE_OUT_SPDIF, VX_ROCKCHIP_OUT_SPDIF0,
+                        AUDIO_DEVICE_OUT_HDMI_ARC, AUDIO_DEVICE_OUT_HDMI_EARC,
+                        AUDIO_DEVICE_OUT_AUX_LINE, });
+            }
         }
 
         devices2.add(devices3);
(END)

3、/hardware/rockchip/audio

diff --git a/tinyalsa_hal/audio_hw.c b/tinyalsa_hal/audio_hw.c
index 9dd81eb..e1244bf 100755
--- a/tinyalsa_hal/audio_hw.c
+++ b/tinyalsa_hal/audio_hw.c
@@ -326,9 +326,9 @@ unsigned getOutputRouteFromDevice(uint32_t device)
     case AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT:
         return BLUETOOTH_NORMAL_ROUTE;
     case AUDIO_DEVICE_OUT_AUX_DIGITAL:
-#ifdef SUPPORT_VX_ROCKCHIP
+//#ifdef SUPPORT_VX_ROCKCHIP
     case VX_ROCKCHIP_OUT_HDMI0:
-#endif
+//#endif
         return HDMI_NORMAL_ROUTE;
     default:
         return PLAYBACK_OFF_ROUTE;
@@ -494,6 +494,7 @@ struct dev_proc_info SPEAKER_OUT_NAME[] = /* add codes& dai name here*/
     {"rockchiprt5670c", NULL,},
     {"rockchiprt5672c", NULL,},
     {"rk3528acodec",    NULL},
+       {"rockchipi2ssoun", NULL,},
     {NULL, NULL}, /* Note! Must end with NULL, else will cause crash */
 };
 
@@ -557,6 +558,7 @@ struct dev_proc_info MIC_IN_NAME[] =
     {"rockchiprt5640c", NULL,},
     {"rockchiprt5670c", NULL,},
     {"rockchiprt5672c", NULL,},
+       {"rockchipi2ssoun", NULL,},
     {NULL, NULL}, /* Note! Must end with NULL, else will cause crash */
 };
 
@@ -1265,7 +1267,7 @@ static int start_output_stream(struct stream_out *out)
             }
         }
 
-#ifdef SUPPORT_VX_ROCKCHIP
+//#ifdef SUPPORT_VX_ROCKCHIP
         if (out->devices[i] == VX_ROCKCHIP_OUT_SPDIF0) {
             card = adev->dev_out[SND_OUT_SOUND_CARD_SPDIF_1].card;
             device = adev->dev_out[SND_OUT_SOUND_CARD_SPDIF_1].device;
@@ -1279,7 +1281,7 @@ static int start_output_stream(struct stream_out *out)
             ret = open_pcm(card, device, (int)SND_OUT_SOUND_CARD_HDMI_1, out);
             if (ret < 0) return ret;
         }
-#endif
+//#endif
 
         if (audio_is_bluetooth_out_sco_device(out->devices[i])) {
             card = adev->dev_out[SND_OUT_SOUND_CARD_BT].card;

4、/device/rockchip/common

diff --git a/audio_policy_configuration.xml b/audio_policy_configuration.xml
old mode 100644
new mode 100755
index 91f0232..4519e4f
--- a/audio_policy_configuration.xml
+++ b/audio_policy_configuration.xml
@@ -81,8 +81,12 @@
                 <devicePort tagName="BT SCO Car Kit" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT" role="sink">
                 </devicePort>
                 <devicePort tagName="HDMI Out" type="AUDIO_DEVICE_OUT_AUX_DIGITAL" role="sink">
+                </devicePort>
+                               <devicePort tagName="HDMI_1 Out" type="VX_ROCKCHIP_OUT_HDMI0" role="sink">
                 </devicePort>
                 <devicePort tagName="SPDIF Out" type="AUDIO_DEVICE_OUT_SPDIF" role="sink">
+                </devicePort>
+                               <devicePort tagName="SPDIF_1 Out" type="VX_ROCKCHIP_OUT_SPDIF0" role="sink">
                 </devicePort>
 
                 <devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source">
@@ -109,8 +113,12 @@
                        sources="primary output"/>
                 <route type="mix" sink="HDMI Out"
                        sources="primary output,hdmi_bitstream"/>
+                               <route type="mix" sink="HDMI_1 Out"
+                       sources="primary output"/>         
                 <route type="mix" sink="SPDIF Out"
                        sources="primary output,spdif_passthrough"/>
+                               <route type="mix" sink="SPDIF_1 Out"
+                       sources="primary output"/>
                 <route type="mix" sink="primary input"
                        sources="Built-In Mic,Wired Headset Mic,BT SCO Headset Mic,HDMIIn"/>
             </routes>
diff --git a/device.mk b/device.mk
old mode 100644
new mode 100755
index 02be5f7..22960d3
--- a/device.mk

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值