halogenOS/android_device_oneplus_oneplus2

Weird bug about audio offload

aviraxp opened this issue · 17 comments

Many in China have encountered that some music apps have no response after playing for a while.

This is a strange problem, as there is nothing wrong shows in the logcat.

As far as I know, all the roms other than PA have the problem.

For me, I delete all the code about compress offload in audio_policy.xml, and it works.

Is there a more "polite" solution?

I delete this.

compress_offload {
        sampling_rates 8000|11025|12000|16000|22050|24000|32000|44100|48000|64000|88200|96000|176400|192000
        channel_masks AUDIO_CHANNEL_OUT_MONO|AUDIO_CHANNEL_OUT_STEREO|AUDIO_CHANNEL_OUT_2POINT1|AUDIO_CHANNEL_OUT_QUAD|AUDIO_CHANNEL_OUT_PENTA|AUDIO_CHANNEL_OUT_5POINT1|AUDIO_CHANNEL_OUT_6POINT1|AUDIO_CHANNEL_OUT_7POINT1
        formats AUDIO_FORMAT_MP3|AUDIO_FORMAT_AC3|AUDIO_FORMAT_E_AC3|AUDIO_FORMAT_PCM_16_BIT_OFFLOAD|AUDIO_FORMAT_PCM_24_BIT_OFFLOAD|AUDIO_FORMAT_FLAC|AUDIO_FORMAT_AAC_LC|AUDIO_FORMAT_AAC_HE_V1|AUDIO_FORMAT_AAC_HE_V2
        devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|AUDIO_DEVICE_OUT_ALL_SCO|AUDIO_DEVICE_OUT_AUX_DIGITAL|AUDIO_DEVICE_OUT_PROXY
        flags AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING

Another bug.

When I press power button to lock, if the phone is not entirely locked yet, press on physical button will wake up the phone again.

On what build are you on?

When I press power button to lock, if the phone is not entirely locked yet, press on physical button will wake up the phone again.

This is not there for me on 0.3-beta (my build)

I delete this.

This is completely fine imo.

@regalstreak

0.4.1beta, besides, this is here with me at least on 0.3.1 beta, I think.

Besides, is there anyway to disable compress offload in build.prop?

For me, I delete all the code about compress offload in audio_policy.xml, and it works.

That works perfectly fine? No side effects? Then let's remove it.

Fine, I have posted the method on Chinese One plus BBS , and they gave thumbs up

Ok, fixed it, please check it here if it is OK like that.

OK, but I will try other ways to fix it as this way is kind of brute, guess it is because of issue about audio buffer somehow.

Besides, noticed the another bug above?

Another bug.

When I press power button to lock, if the phone is not entirely locked yet, press on physical button will wake up the phone again.

I don't get you, isn't that normal?

I mean after press power key to lock the phone, there is an anime through the phone lock, and if I press home/back/recent button, the screen will wake up again.

I never have this on CM/AOSPA, and it makes me have to lock the phone twice.

By the way, the 1344MHz issue must be in the kernel, I will try go through it.

@aviraxp
I found a difference in bitrate for audio_policy.conf
In xos it's set to 16bit, but in oos3.0.2 it's set to 24bit. Have you tried changing that?

OOS3.0.2 audio_policy.conf:

compress_offload {
        sampling_rates 8000|11025|12000|16000|22050|24000|32000|44100|48000|64000|88200|96000|176400|192000
        channel_masks AUDIO_CHANNEL_OUT_MONO|AUDIO_CHANNEL_OUT_STEREO|AUDIO_CHANNEL_OUT_2POINT1|AUDIO_CHANNEL_OUT_QUAD|AUDIO_CHANNEL_OUT_PENTA|AUDIO_CHANNEL_OUT_5POINT1|AUDIO_CHANNEL_OUT_6POINT1|AUDIO_CHANNEL_OUT_7POINT1
        #ifndef VENDOR_EDIT
        #lifei@OnePlus.MultiMediaService, 2015/12/23,add MP2 offload playback
        #formats AUDIO_FORMAT_MP3|AUDIO_FORMAT_AC3|AUDIO_FORMAT_E_AC3|AUDIO_FORMAT_PCM_24_BIT_OFFLOAD|AUDIO_FORMAT_FLAC|AUDIO_FORMAT_AAC_LC|AUDIO_FORMAT_AAC_HE_V1|AUDIO_FORMAT_AAC_HE_V2
        #else
        formats AUDIO_FORMAT_MP3|AUDIO_FORMAT_AC3|AUDIO_FORMAT_E_AC3|AUDIO_FORMAT_PCM_24_BIT_OFFLOAD|AUDIO_FORMAT_FLAC|AUDIO_FORMAT_AAC_LC|AUDIO_FORMAT_AAC_HE_V1|AUDIO_FORMAT_AAC_HE_V2|AUDIO_FORMAT_MP2|AUDIO_FORMAT_AAC
        #endif/*VENDOR_EDIT*/
        devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|AUDIO_DEVICE_OUT_ALL_SCO|AUDIO_DEVICE_OUT_AUX_DIGITAL|AUDIO_DEVICE_OUT_PROXY
        flags AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING
}

Actually, I tried to disable 16 and 24 bit PCM, and it doesn't work.

I wil try to enable deep buffer, since when bufffer was set to 1024 anr reduces a lot.

And PCM is disabled in makefile.

Yes, we picked RayManFX's commits for these, he removed all the broken audio shit

Guys can someone give me a quick summary what's going on. Seems that nobody likes me, whenever I am not here, everyone is doing stuff lol

I mean after press power key to lock the phone, there is an anime through the phone lock, and if I press home/back/recent button, the screen will wake up again.

I never have this on CM/AOSPA, and it makes me have to lock the phone twice.

Oh yeah you are right, checked again...