Closed Bug 1117501 Opened 10 years ago Closed 7 years ago

[Bluetooth][FFOS7715 v2.1] When getting an incoming call, music comes out from speaker for several seconds before ringtone when user is using BT headset to listen to music

Categories

(Firefox OS Graveyard :: AudioChannel, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: ffos_st, Unassigned)

References

Details

(Whiteboard: sprd389106)

Attachments

(2 files, 2 obsolete files)

Description: When getting an incoming call, music comes out from speaker for several seconds before ringtone when user is using BT headset to listen to music Device: SPRD 7715ga Build indentifier: 20150104175050 Steps to reproduce: 1)Let your phone connected to wifi 2)Use BT headset to listen to music 3)Use another phone to call this test mobile phone Actual Result: Music comes out from speaker for several seconds before ringtone Expected Result: Music can be paused normally Repro frequency: 10/10, 100%
Whiteboard: sprd389106
Summary: [FFOS7715 v2.1] When getting an incoming call, music comes out from speaker for several seconds before ringtone when user is using BT headset to listen to music → [Bluetooth][FFOS7715 v2.1] When getting an incoming call, music comes out from speaker for several seconds before ringtone when user is using BT headset to listen to music
Attached file log.log
Hi Wayne, We have merged the patch in bug983539,mute other stream when in ringtone mode,but the issue still exist. can you help to check the issue? log is in attachment.it is about 12:44 when the issue occur.
Flags: needinfo?(waychen)
Hi Jingmei, I can't reproduce this problem by using Mozilla build at the following version. Build ID 20150107100706 Gaia Revision b04a8cb7b2482e0a44e6702b48c42283a00b5b1e Gaia Date 2015-01-05 20:06:25 Gecko Revision f6a4b637c4f59581ad64e4dfec3689442e98e268 Gecko Version 34.0 Device Name scx15_sp7715ga Firmware(Release) 4.4.2 Firmware(Incremental) eng.waynechen.20150107.095743 Firmware Date Wed Jan 7 09:57:52 CST 2015 I'll check log later. Sincerely, Wayne
Flags: needinfo?(waychen)
Hi Wayne, we can reproduce the issue in flame at the following version: OS version:2.1.0.0-prerelease Platform version:34.0 Build Identifier:20150104161204 I get the above information from flame.and this is a 5/5 issue in our locale flame. Thanks!
Hi Alastor, Could you help to check this?
update version information: Gaia-Rev 73be51f998031f06db0cd660c0e388fa621c9f4c Gecko-Rev https://hg.mozilla.org/releases/mozilla-b2g34_v2_1/rev/05dd053f1d90 Build-ID 20150104161204 Version 34.0 Device-Name flame FW-Release 4.4.2 FW-Incremental 39 FW-Date Thu Oct 16 18:19:14 CST 2014 Bootloader L1TC00011880 this is a 5/5 issue in above version. Thanks!
Hi Wayne, Is there anything wrong in the log? I have check the issue and find something improper: 01-07 16:54:30.667 123 838 E AudioPolicyManagerBase: JINGMEI mute stream:3 in setPhoneState ---》state in ringtone and mute music 01-07 16:54:30.667 123 838 E AudioPolicyManagerBase: JINGMEI mute stream:3 In setStreamMute ---》call setStreamMute mute music 01-07 16:54:30.667 123 838 E AudioPolicyManagerBase: checkAndSetVolume stream:3,volume:0.000000 ---》set music volume to 0 >it is strange device 2 is selected?? 01-07 16:54:31.057 123 830 V AudioPolicyManagerBase: getNewDevice() selected device 2 --》device 2 is selected 01-07 16:54:31.057 123 830 E AudioPolicyManagerBase: checkAndSetVolume stream:3,volume:0.801217 ---》music volume is reset to normal Is the patch exclude some corner cases? Wayne,would you please help to give some suggestions?
Flags: needinfo?(waychen)
hi Jingmei, Please try to delete AudioPolicyManagerSPRD.cpp::startOutput functions
Flags: needinfo?(waychen)
(In reply to Wayne Chen [:xwaynec] from comment #7) > hi Jingmei, > > Please try to delete AudioPolicyManagerSPRD.cpp::startOutput functions Hi Wayne, AudioPolicyManagerSPRD.cpp::startOutput is used for SPRD hardware,we can't delete it……
Hi Alastor, From log.log, I found something need your help. I think in step 2, the ring maybe need to use AUDIO_STREAM_RING = 2 to start ringtone. But from log, I'm not sure why gaia or gecko use AUDIO_STREAM_MUSIC to start a ringtone. 1. start ring 12-31 12:44:46.069 123 900 V AudioPolicyManagerBase: setPhoneState() state 1 2. start music or ringtone? 12-31 12:44:46.269 123 900 D AudioPolicyManagerSPRD: startOutput() output 2, stream 3, session 12 3. pick phone up 12-31 12:44:53.089 123 123 V AudioPolicyManagerBase: setPhoneState() state 2 Sincerely, Wayne
Flags: needinfo?(alwu)
Hi, Wanyne, Sorry for my late reply, I guess the reason that may results from the wrong usage/force? Because I see that from the log.log. "12-31 12:44:46.079 123 900 V AudioPolicyManagerBase: checkAndSetVolume() cannot set stream 6 volume with force use = 0 for comm" Because now I still not very familiar with this part, I will look for it more details.
Flags: needinfo?(alwu)
Add back ni? for tracking.
Flags: needinfo?(alwu)
Hi Wayne, AudioPolicyManagerSPRD: startOutput() might be the root_cause of the issue,but no matter in a normal or abnormal case,AudioPolicyManagerSPRD: startOutput() is called. devices changes is the main difference between the two cases: in a normal case: AudioPolicyManagerSPRD: startOutput() is_voip_set 0,stream 3, AudioPolicyManagerBase: setOutputDevice() output 2 device 0002 delayMs 0 >AudioPolicyManagerBase: setOutputDevice() prevDevice 0002, device 0002 AudioPolicyManagerBase: setOutputDevice() changing device 0002 in a abnormal case: AudioPolicyManagerSPRD: startOutput() is_voip_set 0,stream 3, AudioPolicyManagerBase: setOutputDevice() output 2 device 0002 delayMs 0 >AudioPolicyManagerBase: setOutputDevice() prevDevice 0001, device 0002 AudioPolicyManagerBase: setOutputDevice() changing device 0002 ------>we can see from the setOutputDevice that AudioPolicyManagerBase::checkDeviceMuteStrategies is called: in normal case checkDeviceMuteStrategies returned without set volume in abnormal case,maybe checkDeviceMuteStrategies call setStrategyMute and the volume is reset.
I found out when I were not listening the music, the ringtone also came from the speaker instead of BT headset. Even after I answered the phone, the sound still came from the speaker.
(In reply to Alastor Wu [:alwu] from comment #13) > I found out when I were not listening the music, the ringtone also came from > the speaker instead of BT headset. > Even after I answered the phone, the sound still came from the speaker. Hi Alastor, Do you mean the BT is useless in the process?? But BT works well in our locale: when we were not listening the music, the ringtone came from both the speaker & BT headset.
(In reply to Alastor Wu [:alwu] from comment #13) > I found out when I were not listening the music, the ringtone also came from > the speaker instead of BT headset. > Even after I answered the phone, the sound still came from the speaker. Hi Alastor, How about your android phone?
Hi Jingmei, I think you don't need to inherit SPRD::startOutput because AudioPolicyManagerBase has one. From comment 7, I just wanna sure the problem maybe is in SPRD::startOutput. Because I can't reproduce in mozilla build. Sincerely, Wayne
I tested on three different phones, them all have the wrong audio routing problem. [Test cases] case 1 : listen music, then get a incoming call case 2 : No doing anything, then get a incoming call [Test phones] 1 : Flame-kk with the the gecko version 222539. 2 : Asus Zenfone with android 4.3 3 : HTC One 801e with android 4.4.3 [Test results] 1 : Sound came from the speaker on both test cases. 2 : Sound came from the speaker on both test cases. 3 : The same problem happened in the test case 1, but not always so.
Flags: needinfo?(alwu)
In all test cases, phones have connected to BT headset.
(In reply to Wayne Chen [:xwaynec] from comment #16) Hi wayne, > From comment 7, I just wanna sure the problem maybe is in SPRD::startOutput. I can not sure now,for this is not a 5/5 issue.and I will verify the issue in a later investigation. > Because I can't reproduce in mozilla build. I can reproduce the issue for 5/5 use the flame in our locale,and the build information is in comment5. can you help to check the issue in above build? > I think you don't need to inherit SPRD::startOutput because > AudioPolicyManagerBase has one. SPRD::startOutput is a necessary in SPRD.and we change nothing from 1.4 to 2.1.
I found that I got the wrong understanding of this question, so please ignore the comment13 & comment17. Sorry about that.
Hi, Randy, I think the root cause is that the timing issue of updating audio channel's visibility. There had a timing that both audio channels are visible on their state, although the music app was on the background, its visibility still was true. So I add a "dirty" condition to avoid this problem which was caused from the updating latency. I want to know if there have a better way to fix it? Or we need to wait for the completion of audio channel refactor? Thanks!
Flags: needinfo?(rlin)
Hi Alastor, Issue still exist with the patch merged. The issue has been workaround in bug983539,I am not sure if the workaround patch has been merged in flame. In SPRD FFOS1.4,the issue is solved with the workaround patch.but in SPRD 2.1,issue occur with a low probability.
Hi jingmei, Does this issue still occur when you phase in bug 983539's patch on your 2.1 trunk?
Flags: needinfo?(rlin)
(In reply to Alastor Wu [:alwu] from comment #21) > Created attachment 8546611 [details] [diff] [review] > Temp patch for fixing this problem > > Hi, Randy, > > I think the root cause is that the timing issue of updating audio channel's > visibility. > > There had a timing that both audio channels are visible on their state, > although the music app was on the background, its visibility still was true. > > So I add a "dirty" condition to avoid this problem which was caused from the > updating latency. > > I want to know if there have a better way to fix it? Or we need to wait for > the completion of audio channel refactor? > > Thanks! To solve the visibility problem, I think the audiochannel refactor should fix it (v3), but to meet the partner requirement, we should find some workaround to avoid those problem. BTW, As the patch in bug 983539, it would mute the other's stream volume when the ringtone comes. Does the stream type is ring at that time? == public static final int STREAM_RING Constant Value: 2 (0x00000002)
Hi, jingmei, As you mentioned, so the problem is not occur with 100% probability ? I was confused about that the comment1 and comment5 says it always happened. By the way, I could fixed this problem with my patch on the gecko version "222539:70de2960aa87".
(In reply to Alastor Wu [:alwu] from comment #25) > As you mentioned, so the problem is not occur with 100% probability ? > I was confused about that the comment1 and comment5 says it always happened. Hi Alastor, In flame,it is 100%. But in SPRD device with the patch in bug 983539,this occur with a low probability.
Sorry, jingmei, I tested my patch, it seems that problem wasn't always solved. I would continue to check it again.
(In reply to Randy Lin [:rlin] from comment #23) > Hi jingmei, > Does this issue still occur when you phase in bug 983539's patch on your 2.1 > trunk? Hi Randy, Yes,with patch in bug 983539 merged,issue occur with a low probability. I have discussed with the tester in SPRD,as probability is low,we are not see it as a blocker.
Hi, Randy, I use this patch to implement that the audio channel is muted when the higher priority audio is coming. But after applying my patch, the problem would still exist, but happened not so often. So I checked the "stream type" and "visible state" of the music. All of them is correct. It means that the audio track is created correctly by the stream's content. Therefore, I guess the actual root causes may be like ... (1) Still exist the latency issue for pausing audio channels (2) The problems of AudioPolicyManager / AudioFliger.
Attachment #8546611 - Attachment is obsolete: true
Flags: needinfo?(rlin)
Previous one is a wrong patch.
Attachment #8547517 - Attachment is obsolete: true
The word "correct" in comment29, it means that the audio agent has sent a pause to its media element. But the sound was still leaking from the speaker.
Hi Jingmei, Would like to test this? I think It looks fine for v2.2. On v3, those workaround could be removed.
Flags: needinfo?(rlin) → needinfo?(jingmei.zhang)
Hi Alastor, The patch in sprd doesn't work well when I remove the workaround in APMB.music will come out from speaker when the ringtone is run.
Flags: needinfo?(jingmei.zhang)
So this bug is testing base on removing the workaround in APMB?
(In reply to Randy Lin [:rlin] from comment #34) > So this bug is testing base on removing the workaround in APMB? No,this bug is testing with the workaround in APMB. for Alastor'patch,I test base on removing the workaround in APMB.
So base on the patch in bug 983539. + if (state == AudioSystem::MODE_RINGTONE) { + for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) { + if (stream != AudioSystem::RING) { + setStreamMute(stream, true, mHardwareOutput); + } + } The mHardwareOutput is on BT output or primary output? On this case.
Although bug 983539 only mute mHardwareoutput, but actually the code on sprd server is mute all mOutputs. if (state == AudioSystem::MODE_RINGTONE) { for (size_t i = 0; i < mOutputs.size(); i++) { for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) { if (stream != AudioSystem::RING) { setStreamMute(stream, true, mOutputs.keyAt(i)); } } } } else if (oldState == AudioSystem::MODE_RINGTONE) { for (size_t i = 0; i < mOutputs.size(); i++) { for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) { if (stream != AudioSystem::RING) { setStreamMute(stream, false, mOutputs.keyAt(i)); } } } }
Hi Randy, in setStreamMute: in a normal case: AudioPolicyManagerBase: setStreamMute() stream 3, mute 1, output 7, mMuteCount 0 device 0080 in a abnormal case: AudioPolicyManagerBase: setStreamMute() stream 3, mute 1, output 2, mMuteCount 0 device 0001
Blocks: 1123554
Firefox OS is not being worked on
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: