BYZYB / android_device_xiaomi_libra

Device configuration for Mi-4c (libra) and Mi-4s (aqua)
https://forum.xda-developers.com/t/rom-8-1-9-10-11-unofficial-lineageos-for-mi-4c-mi-4s.4008625
80 stars 13 forks source link

Call/Media volume lost control [lineage-17.1] #2

Closed BYZYB closed 3 years ago

BYZYB commented 4 years ago

Description

When playing some audio/video files with local media player (like Eleven), the media volume is out of control (always maximum). It seems that the audio output is outside Android system and sent to the speaker directly. This issue never happens when using software decoding, like playing music from a web browser. Lineage 16.0 is not affected by this issue.

Related logcat

04-14 08:57:01.072  5036  5036 W AudioManager: Use of stream types is deprecated for operations other than volume control
04-14 08:57:01.073  5036  5036 W AudioManager: See the documentation of requestAudioFocus() for what to use instead with android.media.AudioAttributes to qualify your playback use case
04-14 08:57:01.079  5036  5036 W AudioManager: Use of stream types is deprecated for operations other than volume control
04-14 08:57:01.079  5036  5036 W AudioManager: See the documentation of requestAudioFocus() for what to use instead with android.media.AudioAttributes to qualify your playback use case
04-14 08:57:01.080   457  5272 D audio_hw_extn: audio_extn_get_parameters: returns
04-14 08:57:01.081   457  5272 I hash_map_utils: key: 'EnableStereoOutput' value: ''
04-14 08:57:01.131   519   519 D NuPlayerDriver: NuPlayerDriver(0xf29ace00) created, clientPid(5036)
04-14 08:57:01.134   519   519 I Codec2Client: Creating a Codec2 client to service "software"
04-14 08:57:01.138   519   519 I Codec2Client: Client to Codec2 service "software" created
04-14 08:57:01.141   519  5347 D NuPlayer: onSetVideoSurface(0xed673800, no video decoder)
04-14 08:57:01.141  5036  5036 W MediaPlayer: Use of stream types is deprecated for operations other than volume control
04-14 08:57:01.141  5036  5036 W MediaPlayer: See the documentation of setAudioStreamType() for what to use instead with android.media.AudioAttributes to qualify your playback use case
04-14 08:57:01.159   517  5271 D MediaBufferGroup: creating MemoryDealer
04-14 08:57:01.279  5036  5036 D MediaPlayerNative: getMetadata
04-14 08:57:01.307   519  5354 I OMXClient: IOmx service obtained
04-14 08:57:01.308   525   802 I OMXMaster: makeComponentInstance(OMX.qcom.video.decoder.avc) in android.hardwar process
04-14 08:57:01.312   457  5272 D audio_hw_extn: audio_extn_get_parameters: returns
04-14 08:57:01.312   457  5272 I hash_map_utils: key: 'vr_audio_mode_on' value: ''
04-14 08:57:01.312   457  5272 I AudioFlinger: openOutput() this 0x71e7bae600, module 10 Device 0x2, SamplingRate 48000, Format 0x4000002, Channels 0x3, flags 0x31
04-14 08:57:01.312   457  5272 D audio_hw_primary: adev_open_output_stream: enter: sample_rate(48000) channel_mask(0x3) devices(0x2) flags(0x31)        stream_handle(0x7162e64b00)
04-14 08:57:01.312   457  5272 D audio_hw_primary: adev_open_output_stream: Stream (0x7162e64b00) picks up usecase (compress-offload-playback2)
04-14 08:57:01.313   457  5272 I AudioFlinger: HAL output buffer size 32768 frames, normal sink buffer size 32768 frames
04-14 08:57:01.314   457  5358 I AudioFlinger: AudioFlinger's thread 0x7162f42000 tid=5358 ready to run
04-14 08:57:01.330   457  5272 D AF::TrackHandle: OpPlayAudio: track:56 usage:1 not muted
04-14 08:57:01.339   457   963 W AudioFlinger: moveEffectChain_l() effect chain for session 0 not on source thread 0x71636f3e40
04-14 08:57:01.340   457  5358 D audio_hw_primary: out_set_parameters: enter: usecase(4: compress-offload-playback2) kvpairs: routing=2
04-14 08:57:01.342   457  5358 D audio_hw_primary: copl(0x7162e64b00):calling compress flush
04-14 08:57:01.342   457  5358 D audio_hw_primary: copl(0x7162e64b00):out of compress flush
04-14 08:57:01.343   457  5358 D audio_hw_primary: out_set_parameters: enter: usecase(4: compress-offload-playback2) kvpairs: music_offload_avg_bit_rate=96000;music_offload_sample_rate=48000
04-14 08:57:01.366   457  5361 D audio_hw_primary: start_output_stream: enter: stream(0x7162e64b00)usecase(4: compress-offload-playback2) devices(0x2)
04-14 08:57:01.367   457  5361 D audio_hw_primary: select_devices: out_snd_device(2: speaker) in_snd_device(0: )
04-14 08:57:01.367   457  5361 W msm8974_platform: Codec backend bitwidth 16, samplerate 48000
04-14 08:57:01.367   457  5361 D hardware_info: hw_info_append_hw_type : device_name = speaker
04-14 08:57:01.367   457  5361 D audio_hw_primary: enable_snd_device: snd_device(2: speaker)
04-14 08:57:01.367   457  5361 D audio_route: Apply path: speaker
04-14 08:57:01.371   457  5361 I audio_hw_primary: select_devices Selected apptype: 69936
04-14 08:57:01.371   457  5361 D ACDB-LOADER: ACDB -> send_audio_cal, acdb_id = 14, path =  0
04-14 08:57:01.371   457  5361 D ACDB-LOADER: ACDB -> send_asm_topology
04-14 08:57:01.371   457  5361 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_STREAM_TOPOLOGY_ID
04-14 08:57:01.371   457  5361 D ACDB-LOADER: ACDB -> send_adm_topology
04-14 08:57:01.371   457  5361 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_COMMON_TOPOLOGY_ID
04-14 08:57:01.371   457  5361 D ACDB-LOADER: ACDB -> send_audtable
04-14 08:57:01.371   457  5361 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_COMMON_TABLE
04-14 08:57:01.371   457  5361 D ACDB-LOADER: ACDB -> AUDIO_SET_AUDPROC_CAL
04-14 08:57:01.371   457  5361 D ACDB-LOADER: ACDB -> send_audvoltable
04-14 08:57:01.371   457  5361 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_GAIN_DEP_STEP_TABLE
04-14 08:57:01.371   457  5361 D ACDB-LOADER: ACDB -> AUDIO_SET_AUDPROC_VOL_CAL
04-14 08:57:01.371   457  5361 D ACDB-LOADER: ACDB -> send_afe_cal
04-14 08:57:01.371   457  5361 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AFE_COMMON_TABLE
04-14 08:57:01.371   457  5361 D ACDB-LOADER: ACDB -> AUDIO_SET_AFE_CAL
04-14 08:57:01.371   457  5361 D ACDB-LOADER: ACDB -> send_hw_delay : acdb_id = 14 path = 0
04-14 08:57:01.371   457  5361 D ACDB-LOADER: ACDB -> ACDB_AVSYNC_INFO: ACDB_CMD_GET_DEVICE_PROPERTY
04-14 08:57:01.372   457  5361 I audio_hw_utils: audio_extn_utils_send_app_type_cfg app_type 69936, acdb_dev_id 14, sample_rate 48000
04-14 08:57:01.372   457  5361 D audio_hw_primary: enable_audio_route: apply mixer and update path: compress-offload-playback2
04-14 08:57:01.372   457  5361 D audio_route: Apply path: compress-offload-playback2
04-14 08:57:01.372   457  5361 D audio_hw_primary: select_devices: done
04-14 08:57:01.372   457  5361 D msm8974_platform: platform_set_channel_map mixer_ctl_name:Playback Channel Map17
04-14 08:57:01.373   457  5361 D msm8974_platform: platform_set_channel_map: set mapping(1 2 0 0 0 0 0 0) for channel:2
04-14 08:57:01.411   457  5361 D audio_hw_primary: start_output_stream: exit
04-14 08:57:01.411   457  5361 D audio_hw_primary: copl(0x7162e64b00):send new gapless metadata
04-14 08:57:01.426   519  5355 D AudioSink: callbackwrapper: EVENT_UNDERRUN (discarded)
04-14 08:57:01.455   519  5355 D AudioSink: callbackwrapper: EVENT_UNDERRUN (discarded)
04-14 08:57:01.461   457  5361 D audio_hw_primary: No space available in compress driver, post msg to cb thread
04-14 08:57:01.461   457  5356 D audio_hw_primary: copl(0x7162e64b00):calling compress_wait
04-14 08:57:01.468   519  5355 D AudioSink: callbackwrapper: EVENT_UNDERRUN (discarded)
04-14 08:57:01.524   519  5353 I MediaCodec: [OMX.qcom.video.decoder.avc] setting surface generation to 531458
04-14 08:57:01.542   519  5353 I MediaCodec: MediaCodec will operate in async mode
04-14 08:57:03.928   457  5356 D audio_hw_primary: copl(0x7162e64b00):out of compress_wait
04-14 08:57:03.937   457  5361 D audio_hw_primary: No space available in compress driver, post msg to cb thread
04-14 08:57:03.938   457  5356 D audio_hw_primary: copl(0x7162e64b00):calling compress_wait
04-14 08:57:06.637   457  5356 D audio_hw_primary: copl(0x7162e64b00):out of compress_wait
04-14 08:57:06.645   457  5361 D audio_hw_primary: No space available in compress driver, post msg to cb thread
04-14 08:57:06.645   457  5356 D audio_hw_primary: copl(0x7162e64b00):calling compress_wait
04-14 08:57:09.388   457  5356 D audio_hw_primary: copl(0x7162e64b00):out of compress_wait
04-14 08:57:09.396   457  5361 D audio_hw_primary: No space available in compress driver, post msg to cb thread
04-14 08:57:09.396   457  5356 D audio_hw_primary: copl(0x7162e64b00):calling compress_wait
04-14 08:57:12.118   457  5356 D audio_hw_primary: copl(0x7162e64b00):out of compress_wait
04-14 08:57:12.128   457  5361 D audio_hw_primary: No space available in compress driver, post msg to cb thread
04-14 08:57:12.128   457  5356 D audio_hw_primary: copl(0x7162e64b00):calling compress_wait
04-14 08:57:14.578  5036  5036 V MoviePlayer: mVideoPosition is 13162
04-14 08:57:14.583   519  2607 D NuPlayerDriver: reset(0xf29ace00) at state 5
04-14 08:57:14.587   457  5358 D audio_hw_primary: copl(0x7162e64b00):pause compress driver
04-14 08:57:14.643   457   659 W AudioFlinger: moveEffectChain_l() effect chain for session 0 not on source thread 0x7162f42000
04-14 08:57:14.645   457   963 W AudioFlinger: moveEffectChain_l() effect chain for session 0 not on source thread 0x71636f3e40
04-14 08:57:14.647   457  5358 D audio_hw_primary: copl(0x7162e64b00):calling compress flush
04-14 08:57:14.649   457  5356 D audio_hw_primary: copl(0x7162e64b00):out of compress_wait
04-14 08:57:14.649   457  5358 D audio_hw_primary: copl(0x7162e64b00):out of compress flush
04-14 08:57:14.668   457  5358 D audio_hw_primary: copl(0x7162e64b00):pause compress driver
04-14 08:57:14.668   457  5358 W StreamHAL: Error from HAL stream in function pause: Function not implemented
04-14 08:57:14.668   457  5358 E AudioFlinger: Error when pausing output stream: -38
04-14 08:57:14.668   457  5358 D audio_hw_primary: copl(0x7162e64b00):calling compress flush
04-14 08:57:14.668   457  5358 D audio_hw_primary: copl(0x7162e64b00):out of compress flush
04-14 08:57:14.670   519  5347 D NuPlayerDriver: notifyResetComplete(0xf29ace00)
04-14 08:57:14.670   519  2607 D NuPlayerDriver: reset(0xf29ace00) at state 0
04-14 08:57:14.672  5036  5036 V MediaPlayer: resetDrmState:  mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
04-14 08:57:14.672  5036  5036 V MediaPlayer: cleanDrmObj: mDrmObj=null mDrmSessionId=null
04-14 08:57:14.673  5036  5036 V MediaPlayer: resetDrmState:  mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
04-14 08:57:14.673  5036  5036 V MediaPlayer: cleanDrmObj: mDrmObj=null mDrmSessionId=null
04-14 08:57:14.886   457  5356 E audio_hw_primary: offload_thread_loop: Next track returned error -1
04-14 08:57:14.891   457   659 W AudioFlinger: moveEffectChain_l() effect chain for session 0 not on source thread 0x7162f42000
04-14 08:57:14.894   457  5358 D audio_hw_primary: out_set_parameters: enter: usecase(4: compress-offload-playback2) kvpairs: routing=0
04-14 08:57:14.896   457  5358 D audio_hw_primary: out_set_parameters: enter: usecase(4: compress-offload-playback2) kvpairs: closing=true
04-14 08:57:14.899   457   659 D audio_hw_primary: out_set_parameters: enter: usecase(4: compress-offload-playback2) kvpairs: exiting=1
04-14 08:57:14.900   457  5358 D audio_hw_primary: out_standby: enter: stream (0x7162e64b00) usecase(4: compress-offload-playback2)
04-14 08:57:14.900   457  5358 D audio_hw_primary: copl(0x7162e64b00):standby
04-14 08:57:14.931   457  5358 D audio_hw_primary: disable_audio_route: reset and update mixer path: compress-offload-playback2
04-14 08:57:14.932   457  5358 D hardware_info: hw_info_append_hw_type : device_name = speaker
04-14 08:57:14.932   457  5358 D audio_hw_primary: disable_snd_device: snd_device(2: speaker)
04-14 08:57:14.934   457  5356 E audio_hw_primary: offload_thread_loop: Compress handle is NULL
04-14 08:57:14.935   457   659 D audio_hw_primary: adev_close_output_stream: enter:stream_handle(0x7162e64b00)
04-14 08:57:14.935   457   659 D audio_hw_primary: out_standby: enter: stream (0x7162e64b00) usecase(4: compress-offload-playback2)
04-14 08:57:14.998   457  5272 D audio_hw_primary: adev_set_parameters: enter: EnableStereoOutput=0
04-14 08:57:14.999   457  5272 E soundtrigger: audio_extn_sound_trigger_set_parameters: str_params NULL
04-14 08:57:15.001   457  5272 D AudioPolicyManagerCustom: setForceUse() usage 1, config 0, mPhoneState 0

Related dmesg

[    4.627677] msm8994-asoc-snd fe034000.sound: msm8994_asoc_machine_probe: No hdmi audio support
[    4.628054] msm8994-asoc-snd fe034000.sound: ASoC: CODEC tomtom_codec not registered
[   14.408472] extcodec_get_pinctrl: Unable to get pinctrl handle
[   14.540064] msm-pcm-routing qcom,msm-pcm-routing.41: ASoC: Failed to add route VOICE2_STUB_DL -> Voice2 Stub -> INTERNAL_BT_SCO_RX_Voice Mixer
[   14.540508] msm-pcm-routing qcom,msm-pcm-routing.41: ASoC: no source widget found for SLIM_0_TX
[   14.540523] msm-pcm-routing qcom,msm-pcm-routing.41: ASoC: Failed to add route SLIM_0_TX -> SLIM_0_TX -> QUAT_MI2S_RX Port Mixer
[   14.540564] msm-pcm-routing qcom,msm-pcm-routing.41: ASoC: no source widget found for SLIM_0_TX
[   14.540569] msm-pcm-routing qcom,msm-pcm-routing.41: ASoC: Failed to add route SLIM_0_TX -> SLIM_0_TX -> TERT_MI2S_RX Port Mixer
[   14.574009] msm-pcm-routing qcom,msm-pcm-routing.41: ASoC: mux SLIM_0_RX AANC MUX has no paths
[   14.575551] msm-pcm-routing qcom,msm-pcm-routing.41: ASoC: Failed to create QUAT_MI2S_DL_HL debugfs file
[   14.594257] msm-dai-q6-dev qcom,msm-dai-q6-sb-2-rx.193: ASoC: no source widget found for SLIMBUS_2_RX
[   14.594269] msm-dai-q6-dev qcom,msm-dai-q6-sb-2-rx.193: ASoC: Failed to add route SLIMBUS_2_RX -> direct -> Slimbus2 Playback
[   14.594289] msm-dai-q6-dev qcom,msm-dai-q6-sb-2-tx.194: ASoC: no sink widget found for SLIMBUS_2_TX
[   14.594293] msm-dai-q6-dev qcom,msm-dai-q6-sb-2-tx.194: ASoC: Failed to add route Slimbus2 Capture -> direct -> SLIMBUS_2_TX
[   17.223800] msm_qti_pp_get_rms_value_control, back not active to query rms be_idx:3
[   17.227803] msm_pcm_volume_ctl_get substream runtime not found
[   17.228539] msm_compr_audio_effects_config_get: stream or effects inactive
[   17.230680] msm_pcm_volume_ctl_get substream or runtime not found
[   38.403063] msm_pcm_volume_ctl_get substream runtime not found
[  138.263894] msm_pcm_routing_get_app_type_idx: App type not available, fallback to default
[  138.264225] adm_callback: cmd = 0x10335 returned error = 0x2
[  145.690488] FG: soc_work_fn: adjust_soc: s 76 r 317871 i -40130 v 4096655 t 337

Roadmap

For now, this issue has a roadmap like this:

BYZYB commented 4 years ago

Available fix (temporary)

According to user feedbacks, media volume becomes able to control again after using any of the equalizers. On lineage roms, there is an AudioFX app which could be used as prebuilt equalizer (even in "Normal" mode). For both 16.0 and 17.0, AudioFX was removed from the rom by default, and nothing wrong happened to the former one. However, things became worse on 17.0, as the call/media volume will lost control when doing normal output. Using AudioFX as equalizer to bypass this issue is surely available. But this shouldn't be the end of this issue, as the real problem has not been fixed yet.

rehork commented 4 years ago

Hi WJXXBSH,

I've recorded video regarding this issue where you can see that when music plays and by adjusting ring Call Volume you can influence sound sources what shouldn't have happened. In this case when changing Call Volume the sound is being directed to the call speaker for a moment and backs to phone speaker again. I thought that this might help you a bit. I can upload the video if like?

Regards,

rehork commented 4 years ago

Also, it doesn't matter if I call to someone using Headset or talking through a phone. I can't set Call Volume, in both cases. I have AudioFX set to normal and it doesn't change anything. This issue affects pretty essential phone function, so I am eager to help solving it as much as I am able to :-)

SunnyRaj84348 commented 4 years ago

Description

When playing some audio/video files with local media player (like Eleven), the media volume is out of control (always maximum). It seems that the audio output is outside Android system and sent to the speaker directly. This issue never happens when using software decoding, like playing music from a web browser. Lineage-16.0 is still not affected by this issue.

Generate the acdb ids from OEM provided rom's audio hal and copy the generated ids to audio_platform_info.xml.

Acdb ids generator: https://github.com/luca020400/acdb_get

Reference commit: https://github.com/SunnyRaj84348/android_device_xiaomi_riva/commit/a8b074a9c1c557553bd9a78b47dcdf2d91f551f8

BYZYB commented 4 years ago

Generate the acdb ids from OEM provided rom's audio hal and copy the generated ids to audio_platform_info.xml.

Acdb ids generator: https://github.com/luca020400/acdb_get

Reference commit: SunnyRaj84348/android_device_xiaomi_riva@a8b074a

Thanks for your help. I have added the acdb ids (generated by acdb_get, see commit 7b78cccd26afeaa9bcdc2824db35b098c956a9d8) into audio_platform_info.xml, but this issue still exists. I didn't rebuild the rom, but replaced original audio_platform_info.xml with the new one (nothing wrong with file permission).

Here are the new logs:

08-09 22:35:48.456  5090  5090 V MediaRouter: Selecting route: RouteInfo{ name=手机, description=null, status=null, category=RouteCategory{ name=系统 types=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO  groupable=false }, supportedTypes=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO , presentationDisplay=null }
08-09 22:35:48.459  5090  5090 I MediaRouter: Found default route: MediaRouter.RouteInfo{ uniqueId=android/androidx.mediarouter.media.SystemMediaRouteProvider:DEFAULT_ROUTE, name=手机, description=null, iconUri=null, enabled=true, connecting=false, connectionState=0, canDisconnect=false, playbackType=0, playbackStream=3, deviceType=0, volumeHandling=1, volume=0, volumeMax=15, presentationDisplayId=-1, extras=null, settingsIntent=null, providerPackageName=android }
08-09 22:35:48.459  5090  5090 I MediaRouter: Unselecting the current route because it is no longer selectable: null
08-09 22:35:48.576  5090  5090 V MediaRouter: Selecting route: RouteInfo{ name=手机, description=null, status=null, category=RouteCategory{ name=系统 types=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO  groupable=false }, supportedTypes=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO , presentationDisplay=null }
08-09 22:35:48.594  5090  5090 W MediaPlayer: Use of stream types is deprecated for operations other than volume control
08-09 22:35:48.594  5090  5090 W MediaPlayer: See the documentation of setAudioStreamType() for what to use instead with android.media.AudioAttributes to qualify your playback use case
08-09 22:35:48.623  5090  5090 V MediaPlayer: resetDrmState:  mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
08-09 22:35:48.623  5090  5090 V MediaPlayer: cleanDrmObj: mDrmObj=null mDrmSessionId=null
08-09 22:35:48.628   537  3821 D NuPlayerDriver: NuPlayerDriver(0xf2d2d200) created, clientPid(5090)
08-09 22:35:48.629   537  3821 I Codec2Client: Creating a Codec2 client to service "software"
08-09 22:35:48.631   537  3821 I Codec2Client: Client to Codec2 service "software" created
08-09 22:35:48.635   537  5168 D GenericSource: FileSource remote
08-09 22:35:48.656   537  5167 I GenericSource: start
08-09 22:35:48.666   450   578 D audio_hw_extn: audio_extn_get_parameters: returns
08-09 22:35:48.666   450   578 I hash_map_utils: key: 'vr_audio_mode_on' value: ''
08-09 22:35:48.666   450   578 I AudioFlinger: openOutput() this 0x7fb6782600, module 10 Device 0x2, SamplingRate 44100, Format 0x1000000, Channels 0x3, flags 0x31
08-09 22:35:48.666   450   578 D audio_hw_primary: adev_open_output_stream: enter: sample_rate(44100) channel_mask(0x3) devices(0x2) flags(0x31)        stream_handle(0x7f31532000)
08-09 22:35:48.667   450   578 D audio_hw_primary: adev_open_output_stream: Stream (0x7f31532000) picks up usecase (compress-offload-playback2)
08-09 22:35:48.667   450   578 I AudioFlinger: HAL output buffer size 32768 frames, normal sink buffer size 32768 frames
08-09 22:35:48.667   450  5175 I AudioFlinger: AudioFlinger's thread 0x7f3153c000 tid=5175 ready to run
08-09 22:35:48.673  5090  5090 V MediaRouter: Selecting route: RouteInfo{ name=手机, description=null, status=null, category=RouteCategory{ name=系统 types=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO  groupable=false }, supportedTypes=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO , presentationDisplay=null }
08-09 22:35:48.675   450   578 D AF::TrackHandle: OpPlayAudio: track:55 usage:1 not muted
08-09 22:35:48.677   450   578 W AudioFlinger: moveEffectChain_l() effect chain for session 0 not on source thread 0x7f2d8bf780
08-09 22:35:48.703   450  5175 D audio_hw_primary: out_set_parameters: enter: usecase(4: compress-offload-playback2) kvpairs: routing=2
08-09 22:35:48.706   450  5175 D audio_hw_primary: copl(0x7f31532000):calling compress flush
08-09 22:35:48.706   450  5175 D audio_hw_primary: copl(0x7f31532000):out of compress flush
08-09 22:35:48.709   450  5175 D audio_hw_primary: out_set_parameters: enter: usecase(4: compress-offload-playback2) kvpairs: delay_samples=576;music_offload_avg_bit_rate=320000;music_offload_sample_rate=44100;padding_samples=1681
08-09 22:35:48.731   450  5177 D audio_hw_primary: start_output_stream: enter: stream(0x7f31532000)usecase(4: compress-offload-playback2) devices(0x2)
08-09 22:35:48.731   450  5177 E audio_hw_extn: audio_extn_perf_lock_acquire: Incorrect params, Failed to acquire perf lock, err
08-09 22:35:48.731   450  5177 D audio_hw_primary: select_devices: out_snd_device(2: speaker) in_snd_device(0: )
08-09 22:35:48.731   450  5177 W msm8974_platform: Codec backend bitwidth 16, samplerate 48000
08-09 22:35:48.731   450  5177 D hardware_info: hw_info_append_hw_type : device_name = speaker
08-09 22:35:48.731   450  5177 D audio_hw_primary: enable_snd_device: snd_device(2: speaker)
08-09 22:35:48.731   450  5177 D audio_route: Apply path: speaker
08-09 22:35:48.736   450  5177 I audio_hw_primary: select_devices Selected apptype: 69936
08-09 22:35:48.736   450  5177 D ACDB-LOADER: ACDB -> send_audio_cal, acdb_id = 14, path =  0
08-09 22:35:48.736   450  5177 D ACDB-LOADER: ACDB -> send_asm_topology
08-09 22:35:48.736   450  5177 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_STREAM_TOPOLOGY_ID
08-09 22:35:48.736   450  5177 D ACDB-LOADER: ACDB -> send_adm_topology
08-09 22:35:48.736   450  5177 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_COMMON_TOPOLOGY_ID
08-09 22:35:48.736   450  5177 D ACDB-LOADER: ACDB -> send_audtable
08-09 22:35:48.736   450  5177 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_COMMON_TABLE
08-09 22:35:48.736   450  5177 D ACDB-LOADER: ACDB -> AUDIO_SET_AUDPROC_CAL
08-09 22:35:48.736   450  5177 D ACDB-LOADER: ACDB -> send_audvoltable
08-09 22:35:48.736   450  5177 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_GAIN_DEP_STEP_TABLE
08-09 22:35:48.736   450  5177 D ACDB-LOADER: ACDB -> AUDIO_SET_AUDPROC_VOL_CAL
08-09 22:35:48.736   450  5177 D ACDB-LOADER: ACDB -> send_afe_cal
08-09 22:35:48.736   450  5177 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AFE_COMMON_TABLE
08-09 22:35:48.736   450  5177 D ACDB-LOADER: ACDB -> AUDIO_SET_AFE_CAL
08-09 22:35:48.736   450  5177 D ACDB-LOADER: ACDB -> send_hw_delay : acdb_id = 14 path = 0
08-09 22:35:48.736   450  5177 D ACDB-LOADER: ACDB -> ACDB_AVSYNC_INFO: ACDB_CMD_GET_DEVICE_PROPERTY
08-09 22:35:48.737   450  5177 I audio_hw_utils: audio_extn_utils_send_app_type_cfg app_type 69936, acdb_dev_id 14, sample_rate 48000
08-09 22:35:48.737   450  5177 D audio_hw_primary: enable_audio_route: apply mixer and update path: compress-offload-playback2
08-09 22:35:48.737   450  5177 D audio_route: Apply path: compress-offload-playback2
08-09 22:35:48.737   450  5177 D audio_hw_primary: select_devices: done
08-09 22:35:48.737   450  5177 D msm8974_platform: platform_set_channel_map mixer_ctl_name:Playback Channel Map17
08-09 22:35:48.738   450  5177 D msm8974_platform: platform_set_channel_map: set mapping(1 2 0 0 0 0 0 0) for channel:2
08-09 22:35:48.773   450  5177 E audio_hw_extn: audio_extn_perf_lock_release: Perf lock release error
08-09 22:35:48.773   450  5177 D audio_hw_primary: start_output_stream: exit
08-09 22:35:48.773   450  5177 D audio_hw_primary: copl(0x7f31532000):send new gapless metadata
08-09 22:35:48.784   450  5177 D audio_hw_primary: No space available in compress driver, post msg to cb thread
08-09 22:35:48.785   450  5173 D audio_hw_primary: copl(0x7f31532000):calling compress_wait
08-09 22:35:48.910   406  5178 E ResolverController: No valid NAT64 prefix (100, <unspecified>/0)
08-09 22:35:49.466   450  5173 D audio_hw_primary: copl(0x7f31532000):out of compress_wait
08-09 22:35:49.468   450  5177 D audio_hw_primary: No space available in compress driver, post msg to cb thread
08-09 22:35:49.469   450  5173 D audio_hw_primary: copl(0x7f31532000):calling compress_wait
08-09 22:35:50.270   537   537 D NuPlayerDriver: pause(0xf2d2d200)
08-09 22:35:50.271   450  5175 D audio_hw_primary: copl(0x7f31532000):pause compress driver
08-09 22:35:50.276   450  5173 D audio_hw_primary: copl(0x7f31532000):out of compress_wait
08-09 22:35:50.327   450   569 W AudioFlinger: moveEffectChain_l() effect chain for session 0 not on source thread 0x7f3153c000
08-09 22:35:51.505   537   537 D NuPlayerDriver: stop(0xf2d2d200)
08-09 22:35:51.505  5090  5090 V MediaPlayer: resetDrmState:  mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
08-09 22:35:51.505  5090  5090 V MediaPlayer: cleanDrmObj: mDrmObj=null mDrmSessionId=null
08-09 22:35:51.505   537   537 D NuPlayerDriver: reset(0xf2d2d200) at state 8
08-09 22:35:51.509   450  5175 D audio_hw_primary: out_set_parameters: enter: usecase(4: compress-offload-playback2) kvpairs: routing=0
08-09 22:35:51.510   450  5175 D audio_hw_primary: out_set_parameters: enter: usecase(4: compress-offload-playback2) kvpairs: closing=true
08-09 22:35:51.512   537  5167 D NuPlayerDriver: notifyResetComplete(0xf2d2d200)
08-09 22:35:51.513   450   569 D audio_hw_primary: out_set_parameters: enter: usecase(4: compress-offload-playback2) kvpairs: exiting=1
08-09 22:35:51.514   450  5175 D audio_hw_primary: copl(0x7f31532000):calling compress flush
08-09 22:35:51.514   537   537 W AMessage: failed to post message as target looper for handler 0 is gone.
08-09 22:35:51.515   450  5175 D audio_hw_primary: copl(0x7f31532000):out of compress flush
08-09 22:35:51.515   450  5175 D audio_hw_primary: out_standby: enter: stream (0x7f31532000) usecase(4: compress-offload-playback2)
08-09 22:35:51.515   450  5175 D audio_hw_primary: copl(0x7f31532000):standby
08-09 22:35:51.517  5090  5090 W MediaPlayer: mediaplayer went away with unhandled events
08-09 22:35:51.535   450  5175 D audio_hw_primary: disable_audio_route: reset and update mixer path: compress-offload-playback2
08-09 22:35:51.536   450  5175 D hardware_info: hw_info_append_hw_type : device_name = speaker
08-09 22:35:51.536   450  5175 D audio_hw_primary: disable_snd_device: snd_device(2: speaker)
08-09 22:35:51.538   450   569 D audio_hw_primary: adev_close_output_stream: enter:stream_handle(0x7f31532000)
08-09 22:35:51.538   450   569 D audio_hw_primary: out_standby: enter: stream (0x7f31532000) usecase(4: compress-offload-playback2)
rehork commented 4 years ago

WJXXBSH what I remember usually on Android the default action for volume +/- buttons was changing ring volume when pressed on Desktop. Here I can see that I manipulate Media Volume. Is that normal or intentional?

BYZYB commented 4 years ago

WJXXBSH what I remember usually on Android the default action for volume +/- buttons was changing ring volume when pressed on Desktop. Here I can see that I manipulate Media Volume. Is that normal or intentional?

When using previous version of Android, the volume keys are surely controlling ring volume. But on Android 9 or newer, the default action is changed to media volume, which is normal.

SunnyRaj84348 commented 4 years ago

Generate the acdb ids from OEM provided rom's audio hal and copy the generated ids to audio_platform_info.xml. Acdb ids generator: https://github.com/luca020400/acdb_get Reference commit: SunnyRaj84348/android_device_xiaomi_riva@a8b074a

Thanks for your help. I have added the acdb ids (generated by acdb_get, see commit 7b78ccc) into audio_platform_info.xml, but this issue still exists. I didn't rebuild the rom, but replaced original audio_platform_info.xml with the new one (nothing wrong with file permission).

Try the acdb ids from similar soc device and check, in my case it didn't worked with Redmi 5A(riva) stock audio hal acdb data but worked with Redmi 4A (rolex) acdb data.

BYZYB commented 4 years ago

Try the acdb ids from similar soc device and check, in my case it didn't worked with Redmi 5A(riva) stock audio hal acdb data but worked with Redmi 4A (rolex) acdb data.

I tried to use the acdb data from some similar devices, but nothing changed in each test. After searching for more audio_platform_info.xml from those devices as references, I noticed that the current one has only two sections: "acdb_ids" and "bit_width_configs". However, other devices has more sections in this xml file (like "pcm_ids" or "backend_names"). So I did many tests (to find out what effect one section has), and confirmed that "pcm_ids" section is necessary to solve this issue. After taking "pcm_ids" from mido ("acdb_ids" is dumped from stock rom), the media volume is back to normal again.

<pcm_ids>
    <usecase name="USECASE_AUDIO_PLAYBACK_OFFLOAD2" type="out" id="24" />
    <usecase name="USECASE_AUDIO_PLAYBACK_OFFLOAD3" type="out" id="27" />
    <usecase name="USECASE_AUDIO_PLAYBACK_OFFLOAD4" type="out" id="28" />
    <usecase name="USECASE_AUDIO_PLAYBACK_OFFLOAD5" type="out" id="29" />
    <usecase name="USECASE_AUDIO_PLAYBACK_OFFLOAD6" type="out" id="30" />
    <usecase name="USECASE_AUDIO_PLAYBACK_OFFLOAD7" type="out" id="31" />
    <usecase name="USECASE_AUDIO_PLAYBACK_OFFLOAD8" type="out" id="32" />
    <usecase name="USECASE_AUDIO_PLAYBACK_OFFLOAD9" type="out" id="33" />
    <usecase name="USECASE_VOICEMMODE1_CALL" type="in" id="34" />
    <usecase name="USECASE_VOICEMMODE1_CALL" type="out" id="34" />
    <usecase name="USECASE_VOICEMMODE2_CALL" type="in" id="35" />
    <usecase name="USECASE_VOICEMMODE2_CALL" type="out" id="35" />
</pcm_ids>

But some other problems appeared:

Obviously, part of those values are not right, more works need to be done.

SunnyRaj84348 commented 4 years ago

Try the acdb ids from similar soc device and check, in my case it didn't worked with Redmi 5A(riva) stock audio hal acdb data but worked with Redmi 4A (rolex) acdb data.

I tried to use the acdb data from some similar devices, but nothing changed in each test. After searching for more audio_platform_info.xml from those devices as references, I noticed that the current one has only two sections: "acdb_ids" and "bit_width_configs". However, other devices has more sections in this xml file (like "pcm_ids" or "backend_names"). So I did many tests (to find out what effect one section has), and confirmed that "pcm_ids" section is necessary to solve this issue. After taking "pcm_ids" from mido ("acdb_ids" is dumped from stock rom), the media volume is back to normal again.

But some other problems appeared:

  • audio recording broken (using lineage recorder app), but video recording works properly
  • audio player stucks when playing music for the first time after reboot (eg. stops at 00:00 with no audio output when playing), but backs to normal when playing again Obviously, part of those values are not right, more works need to be done.

Try to add config_params backend_names snd_dev from https://source.codeaurora.org/quic/la/platform/hardware/qcom/audio/tree/configs/msm8937/audio_platform_info.xml?h=LA.UM.8.6.r1-04700-89xx.0

Check for further required changes of mic characteristics.

rehork commented 4 years ago

Has your newest build implemented solution for this issue? I have upgraded your ROM, but Phone volume hasn't been resolved in my device. Also new bug has arrived: I can't turn on Bluetooth, at all. It's starting, but can't be turned on :-(

BYZYB commented 4 years ago

Has your newest build implemented solution for this issue? I have upgraded your ROM, but Phone volume hasn't been resolved in my device. Also new bug has arrived: I can't turn on Bluetooth, at all. It's starting, but can't be turned on :-(

The phone volume is different from media volume (uses different ways to output), as this new build is for testing media volume (works without AudioFX or other equalizer apps). For the Bluetooth issue, installing this new kernel will fix it (sorry for my mistake, I just noticed this issue last night when connecting to my Mi-band).

rehork commented 4 years ago

OMG: I thought this is this issue. I'm waiting for the fix. OK, so I installed from the scratch your build lineage-17.1-20200714 (with wipe everything, including Internal Storage). From some time I cannot control Volume of a phone call, at all (it might be from the beginning of using this ROM). My speaker wants to explode from the phone and my ear is aching and what's more everything is audible what my interlocutor saying. Should I create another bug to not mix up issues? Please help as this is an essential functionality for me and I'm on the edge of deciding to go back to Lineage 14.1 as beside the design was awkward it was the most stable one for me.

BYZYB commented 4 years ago

OMG: I thought this is this issue. I'm waiting for the fix. OK, so I installed from the scratch your build lineage-17.1-20200714 (with wipe everything, including Internal Storage). From some time I cannot control Volume of a phone call, at all (it might be from the beginning of using this ROM). My speaker wants to explode from the phone and my ear is aching and what's more everything is audible what my interlocutor saying. Should I create another bug to not mix up issues? Please help as this is an essential functionality for me and I'm on the edge of deciding to go back to Lineage 14.1 as beside the design was awkward it was the most stable one for me.

Sorry for the inconvenience about this issue, but I'm eager to fix it too. The same audio configuration has no issue on lineage-16.0 (exactly, most things are also the same), and there is other roms like Mokee which also uses such audio configs with no issue after all. It's kind of confused to make a full fix currently, as I just started to fix this issue days ago.

rehork commented 4 years ago

I'm not much advanced user, but if there's anyway I can help I am eager to do so. Thank you for the kernel. Bluetooth is working fine now. I tested Mokee 9.0 and I had an issue with Call Volume, but it was different. No matter what Volume level was set at the beginning, when I called anyone the volume was at the highest level (even though mixer shows that Call Volume was at the lowest level). However, I could use hardware Volume button - to decrease the volume. Here in your build I have no control at all. What's more Mokee has SELinux in permissive mode permanently.

rehork commented 4 years ago

Just a few ideas about possible root cause of the issue(s):

  1. Could that issue be connected with Kernel anyhow?
  2. I haven't noticed any issues with Media Volume I have issue with Call Volume so could that be connected with installed applications?
  3. Could that be caused be any specific settings, not only sound settings?

Some time ago I was comparing Mokee, eOS, your and MIUI.eu BUILD.PROP I've noticed that for instance Mokee's BUILD.PROP is very similar to MIUI.eu. I'm just pointing out some other aspects which you might not take into consideration, although it's only my limited view on the subject :-) I thought that, cause you mentioned that in your build based on Lineage 16.0 everything worked fine or using the same audio configs as Mokee in your ROM there's an issue.

BYZYB commented 4 years ago

Just a few ideas about possible root cause of the issue(s):

  1. Could that issue be connected with Kernel anyhow?
  2. I haven't noticed any issues with Media Volume I have issue with Call Volume so could that be connected with installed applications?
  3. Could that be caused be any specific settings, not only sound settings?

Some time ago I was comparing Mokee, eOS, your and MIUI.eu BUILD.PROP I've noticed that for instance Mokee's BUILD.PROP is very similar to MIUI.eu. I'm just pointing out some other aspects which you might not take into consideration, although it's only my limited view on the subject :-) I thought that, cause you mentioned that in your build based on Lineage 16.0 everything worked fine or using the same audio configs as Mokee in your ROM there's an issue.

For question 1

If you think the kernel causes this issue, you could install the "boot.img" from Mokee roms then test audio output (I think the device will boot up with something broken, so make a backup first).

For question 2

The media volume has been fixed (partially, may have bugs) in the latest pre-release (20200812), so there should be nothing wrong with it. I don't think this issue is casued by 3rd-party apps, even a clean install will change nothing (if you've made a full backup, you could try).

For question 3

I can't deny this question, but I don't remember related settings about this. A clean install should also give an answer.

Related logcat

This might be the reason why the call volume lost control (seems different from media volume):

08-15 22:45:58.288   452  1522 D AudioPolicyManagerCustom: setForceUse() usage 7, config 0, mPhoneState 2
08-15 22:45:58.290   452  1522 D APM_AudioPolicyManager: setVolumeCurveIndex: wrong index 0 min=1 max=7
08-15 22:45:58.290   452  1522 E APM_AudioPolicyManager: setVolumeIndexForAttributes failed to set curve index for group 2 device 0x2
08-15 22:45:58.290   645  2030 E AudioSystem-JNI: Command failed for android_media_AudioSystem_setStreamVolumeIndex: -22
08-15 22:45:58.290   452  1522 D APM_AudioPolicyManager: setVolumeCurveIndex: wrong index 0 min=1 max=7
08-15 22:45:58.290   452  1522 E APM_AudioPolicyManager: setVolumeIndexForAttributes failed to set curve index for group 2 device 0x40000000
08-15 22:45:58.290   645  2030 E AudioSystem-JNI: Command failed for android_media_AudioSystem_setStreamVolumeIndex: -22
rehork commented 4 years ago

Kernel from Mokee_10 - 202008150857 doesn't solve the issue with Phone Call Volume. I did totally clean install of your latest Build from August without installing and doing anything. The issue with lost control of Phone Call Volume exists from the beginning :-(((((((

fAiL-ix commented 3 years ago
* [ ]  Fix audio recoding issue (caused by the first one, priority: 2)

One thing i observed regarding this issue: It looks like the phone wants to use the headphone audio. And when a headphone is connected it works without problems.

Logcat:

11-04 20:33:57.654 19750 19750 W AudioManager: Use of stream types is deprecated for operations other than volume control
11-04 20:33:57.655 19750 19750 W AudioManager: See the documentation of requestAudioFocus() for what to use instead with android.media.AudioAttributes to qualify your playback use case
11-04 20:33:57.657   648 14654 I MediaFocusControl: requestAudioFocus() from uid/pid 10108/19750 clientId=android.media.AudioManager@4ef75e8org.telegram.messenger.-$$Lambda$MediaController$AYThFpEB5vymBiwCJfiKA5jTkJ4@9521401 callingPack=org.telegram.messenger req=2 flags=0x0 sdk=28
11-04 20:33:57.667   433   433 I VibratorService: Voltage set to: 99
11-04 20:33:57.750   451  2409 D audio_hw_primary: adev_open_input_stream: enter: sample_rate(16000) channel_mask(0x10) devices(0x80000004)        stream_handle(0x7fb6791cc0) io_handle(54) source(1)
11-04 20:33:57.753   451 21511 I AudioFlinger: AudioFlinger's thread 0x7f1a03d500 tid=21511 ready to run
11-04 20:33:57.753   451 21511 D audio_hw_primary: in_standby: enter: stream (0x7fb6791cc0) usecase(16: audio-record)
11-04 20:33:57.755   451 21511 D audio_hw_primary: in_standby: enter: stream (0x7fb6791cc0) usecase(16: audio-record)
11-04 20:33:57.770   451 21511 D audio_hw_primary: in_set_parameters: enter: kvpairs=bottom=;input_source=1;routing=-2147483644
11-04 20:33:57.773   451 21512 D audio_hw_primary: start_input_stream: enter: stream(0x7fb6791cc0)usecase(16: audio-record)
11-04 20:33:57.773   451 21512 E audio_hw_extn: audio_extn_perf_lock_acquire: Incorrect params, Failed to acquire perf lock, err 
11-04 20:33:57.773   451 21512 D audio_hw_primary: select_devices: out_snd_device(0: ) in_snd_device(36: handset-mic)
11-04 20:33:57.773   451 21512 D hardware_info: hw_info_append_hw_type : device_name = handset-mic
11-04 20:33:57.773   451 21512 D audio_hw_primary: enable_snd_device: snd_device(36: handset-mic)
11-04 20:33:57.773   451 21512 E msm8974_platform: platform_send_audio_calibration: Could not find acdb id for device(36)
11-04 20:33:57.773   451 21512 D audio_hw_primary: enable_audio_route: apply mixer and update path: audio-record
11-04 20:33:57.773   451 21512 D audio_route: Apply path: audio-record
11-04 20:33:57.774   451 21512 D audio_hw_primary: select_devices: done
11-04 20:33:57.792   451 21512 E audio_hw_extn: audio_extn_perf_lock_release: Perf lock release error 
11-04 20:33:57.792   451 21512 D audio_hw_primary: start_input_stream: exit
11-04 20:33:59.613   594   594 I MSM-irqbalance: Decided to move IRQ128 from CPU2 to CPU1
11-04 20:34:01.674   523   523 I cnss-daemon: RTM_NEWROUTE Indication
BYZYB commented 3 years ago
* [ ]  Fix audio recoding issue (caused by the first one, priority: 2)

One thing i observed regarding this issue: It looks like the phone wants to use the headphone audio. And when a headphone is connected it works without problems.

It might not be the real reason. I got some logs when using the original version of "audio_platform_info.xml" (using Lineage Recoder for audio recording). My device used the same acdb id (36: handset-mic) just like line 1~14 in your logs but not failed like line 15. Maybe I could replace some (totally 7 of them) acdb-ids in "audio_platform_info.xml" by the ones from original version (if "device name" is the same). Note: "36: handset-mic" is not the mic on headphone, as "53: headset-mic" should be the correct one for headset. Plug the headphone to the device, then acdb-id 53 should be used for audio recording.

Related logcat

11-05 14:23:57.798 11308 11308 D SoundRecorderService: Sound recorder service started recording…
11-05 14:23:57.832   442   634 D audio_hw_primary: adev_open_input_stream: enter: sample_rate(44100) channel_mask(0x10) devices(0x80000004)        stream_handle(0x7fb6791080) io_handle(46) source(1)
11-05 14:23:57.834   442 11340 I AudioFlinger: AudioFlinger's thread 0x7f2b118dc0 tid=11340 ready to run
11-05 14:23:57.834   442 11340 D audio_hw_primary: in_standby: enter: stream (0x7fb6791080) usecase(16: audio-record)
11-05 14:23:57.837   442 11340 D audio_hw_primary: in_standby: enter: stream (0x7fb6791080) usecase(16: audio-record)
11-05 14:23:57.854   442 11340 D audio_hw_primary: in_set_parameters: enter: kvpairs=bottom=;input_source=1;routing=-2147483644
11-05 14:23:57.863   442 11344 D audio_hw_primary: start_input_stream: enter: stream(0x7fb6791080)usecase(16: audio-record)
11-05 14:23:57.864   442 11344 E audio_hw_extn: audio_extn_perf_lock_acquire: Incorrect params, Failed to acquire perf lock, err
11-05 14:23:57.864   442 11344 D audio_hw_primary: select_devices: out_snd_device(0: ) in_snd_device(36: handset-mic)
11-05 14:23:57.864   442 11344 D hardware_info: hw_info_append_hw_type : device_name = handset-mic
11-05 14:23:57.864   442 11344 D audio_hw_primary: enable_snd_device: snd_device(36: handset-mic)
11-05 14:23:57.864   442 11344 D audio_route: Apply path: handset-mic
11-05 14:23:57.875   442 11344 D ACDB-LOADER: ACDB -> send_audio_cal, acdb_id = 4, path =  1
11-05 14:23:57.875   442 11344 D ACDB-LOADER: ACDB -> send_asm_topology
11-05 14:23:57.875   442 11344 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_STREAM_TOPOLOGY_ID
11-05 14:23:57.875   442 11344 D ACDB-LOADER: ACDB -> send_adm_topology
11-05 14:23:57.875   442 11344 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_COMMON_TOPOLOGY_ID
11-05 14:23:57.875   442 11344 D ACDB-LOADER: ACDB -> send_audtable
11-05 14:23:57.875   442 11344 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_COMMON_TABLE
11-05 14:23:57.876   442 11344 D ACDB-LOADER: ACDB -> AUDIO_SET_AUDPROC_CAL
11-05 14:23:57.876   442 11344 D ACDB-LOADER: ACDB -> send_audvoltable
11-05 14:23:57.876   442 11344 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_GAIN_DEP_STEP_TABLE
11-05 14:23:57.876   442 11344 D         : Failed to fetch the lookup information of the device 00000004
11-05 14:23:57.876   442 11344 E ACDB-LOADER: Error: ACDB AudProc vol returned = -19
11-05 14:23:57.876   442 11344 D ACDB-LOADER: ACDB -> AUDIO_SET_AUDPROC_VOL_CAL
11-05 14:23:57.876   442 11344 D ACDB-LOADER: ACDB -> send_afe_cal
11-05 14:23:57.876   442 11344 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AFE_COMMON_TABLE
11-05 14:23:57.877   442 11344 D         : Failed to fetch the lookup information of the device 00000004
11-05 14:23:57.877   442 11344 E ACDB-LOADER: Error: ACDB AFE returned = -19
11-05 14:23:57.877   442 11344 D ACDB-LOADER: ACDB -> AUDIO_SET_AFE_CAL
11-05 14:23:57.877   442 11344 D ACDB-LOADER: ACDB -> send_hw_delay : acdb_id = 4 path = 1
11-05 14:23:57.877   442 11344 D ACDB-LOADER: ACDB -> ACDB_AVSYNC_INFO: ACDB_CMD_GET_DEVICE_PROPERTY
11-05 14:23:57.877   442 11344 D audio_hw_primary: enable_audio_route: apply mixer and update path: audio-record
11-05 14:23:57.877   442 11344 D audio_route: Apply path: audio-record
11-05 14:23:57.878   442 11344 D audio_hw_primary: select_devices: done
11-05 14:23:57.912   442 11344 E audio_hw_extn: audio_extn_perf_lock_release: Perf lock release error
11-05 14:23:57.912   442 11344 D audio_hw_primary: start_input_stream: exit
11-05 14:24:03.510 11308 11308 D SoundRecorderService: Sound recorder service stopped recording
11-05 14:24:03.534   442 11340 D audio_hw_primary: in_standby: enter: stream (0x7fb6791080) usecase(16: audio-record)
11-05 14:24:03.626   442 11340 D audio_hw_primary: disable_audio_route: reset and update mixer path: audio-record
11-05 14:24:03.627   442 11340 D hardware_info: hw_info_append_hw_type : device_name = handset-mic
11-05 14:24:03.627   442 11340 D audio_hw_primary: disable_snd_device: snd_device(36: handset-mic)
11-05 14:24:03.644   442 11340 D audio_hw_primary: in_set_parameters: enter: kvpairs=routing=0
11-05 14:24:03.663   442  1949 D audio_hw_primary: adev_close_input_stream: enter:stream_handle(0x7fb6791080)
11-05 14:24:03.664   442  1949 D audio_hw_primary: in_standby: enter: stream (0x7fb6791080) usecase(16: audio-record)
BYZYB commented 3 years ago

After commit 34601cde7042d7f919174dc0c5088a1b6c27983d, both media volume and audio recording should work properly. Most unnecessary sections were removed from "audio_platform_info.xml", and the original acdb_ids before commit 34601cde7042d7f919174dc0c5088a1b6c27983d were taken back (since they're correct).

There are only one known bug currently:

Fortunately, it only happens after a reboot and won't happen again after a successful playback. As a temporary fix, play an audio file for the first time (it should fail), wait for few seconds, then stop ⏹ (not pause ⏸) and try playing again (it should success).

Thanks to fAiL-ix for assistance.

dibyanugraha commented 3 years ago

Sorry, but I still curious about this. Apparently, normal audio these days doesn't have any stop button. And if it were replaced by switching between song, no, in my case, it still won't play with hardware decoder.

I've look at my logcat, it is very similar to yours. And it mentioned that somehow device "/dev/snd/comprC0D24" is missing, thus I believe, it failed to send the audio stream to the pcm device, thus no playback.

I have tried to compare with previous build of Lineage 16.0 - yours and Mokee (they're still releasing stable based on that), I did not found that "/dev/snd/comprC0D24", yet the audio plays fine in speaker, bluetooth, or earphone. It's definitely something happened in either Linageos 17.1 or msm8994 tree (I noticed when I run cat /proc/asound/cards, I found msm8994 audio?) that might screw the audio streaming process. It is just my opinion.

BYZYB commented 3 years ago

Sorry, but I still curious about this. Apparently, normal audio these days doesn't have any stop button. And if it were replaced by switching between song, no, in my case, it still won't play with hardware decoder.

I've look at my logcat, it is very similar to yours. And it mentioned that somehow device "/dev/snd/comprC0D24" is missing, thus I believe, it failed to send the audio stream to the pcm device, thus no playback.

I have tried to compare with previous build of Lineage 16.0 - yours and Mokee (they're still releasing stable based on that), I did not found that "/dev/snd/comprC0D24", yet the audio plays fine in speaker, bluetooth, or earphone. It's definitely something happened in either Linageos 17.1 or msm8994 tree (I noticed when I run cat /proc/asound/cards, I found msm8994 audio?) that might screw the audio streaming process. It is just my opinion.

If there is no stop button in some APPs, try playing an audio file for some seconds, then exit and restart the APP.

Firstly, I cannot deny that I don't know much about audio in Android system. That's why I'm also curious about this Android 10+ only problem, as the same audio configs had a different result on Mi-4c. I once replaced most things about audio (list all files) with the ones from Mokee (other things were kept unchanged), but the problem was not fixed at all. I have also compared the differences of audio configs between Mokee sources and mine, and found nothing valuable (except the code format and indent). Some users even tried to install the kernel of Mokee on the top of my Lineage 17.1 (by flashing "boot.img"), still nothing changed.

In fact, this repo is a fork of these repos (android_device_xiaomi_libra + android_device_xiaomi_msm8994-common) from Mokee, you could also see many similar things between these ones. That's why I feel a little confused about this problem, the (almost) same things have a different result on similar custom ROMs. The solution used currently is to specify the pcm_ids of all usecase (also see https://github.com/BYZYB/android_device_xiaomi_libra/issues/2#issuecomment-671000230), which fixed (or hide) this problem in most conditions, but may not be a good solution.

BYZYB commented 3 years ago

Similar issue here, @GuaiYiHu . Using AudioFX is surely the most simple and working solution to this problem (enable "Mono audio" in accessibility settings is another way). My solution (see the changes of audio_platform_info.xml) could fix (or hide) this problem without using APPs or change settings, but not perfect (see https://github.com/BYZYB/android_device_xiaomi_libra/issues/2#issuecomment-722348201). Also, this way has no effect to phone call volume (AudioFX have no effect on phone call either, I remember).

GuaiYiHu commented 3 years ago

From your method, I found you can hardly understand the audio of Android. Fixed via a simple commit. https://github.com/xiaomi-classic-dev/android_device_xiaomi_msm8994-common/commit/7c6419636bfa9c0e332b91d49cf6b5159d126286

BYZYB commented 3 years ago

From your method, I found you can hardly understand the audio of Android. Fixed via a simple commit. xiaomi-classic-dev/android_device_xiaomi_msm8994-common@7c64196

I admit what you said, but still thanks for your reply. I'll test this solution on Android 10 later.

[Update] Both phone call and media volume issue has been fixed (in Android 10), thanks again. This issue will be closed now.

GuaiYiHu commented 3 years ago

Updated. https://github.com/xiaomi-classic-dev/android_device_xiaomi_msm8994-common/commit/da3ce0fc00a5fcd233b18eef67209cecdf5da28e