Closed
Bug 860584
Opened 13 years ago
Closed 12 years ago
[Buri][ACC] Speaker sound when plug out earphone.
Categories
(Firefox OS Graveyard :: Gaia, defect, P1)
Tracking
(blocking-b2g:-, b2g18+)
People
(Reporter: sync-1, Assigned: rlin)
Details
Attachments
(2 files, 5 obsolete files)
|
1.66 KB,
text/plain
|
Details | |
|
3.05 KB,
patch
|
Details | Diff | Splinter Review |
+++ This bug was initially created as a clone of Bug #424591 +++
DEFECT DESCRIPTION:
Speaker sound when plug out earphone.
REPRODUCING PROCEDURES:
1, Plug in earphone and play a song.
2, Plug out earphone, speaker also sound for a short time.
EXPECTED BEHAVIOUR:
No sound when plug out earphone.
ASSOCIATE SPECIFICATION:
TEST PLAN REFERENCE:
TOOLS AND PLATFORMS USED:
SW114
USER IMPACT:
REPRODUCING RATE:
For FT PR, Please list reference mobile's behavior:
++++++++++ end of initial bug #424591 description ++++++++++
CONTACT INFO (Name,Phone number):
DEFECT DESCRIPTION:
REPRODUCING PROCEDURES:
EXPECTED BEHAVIOUR:
ASSOCIATE SPECIFICATION:
TEST PLAN REFERENCE:
TOOLS AND PLATFORMS USED:
USER IMPACT:
REPRODUCING RATE:
For FT PR, Please list reference mobile's behavior:
| Assignee | ||
Comment 1•13 years ago
|
||
This issue comes from stoping music is too slow. We may refine the message system to avoid this sound leakage.
Maybe android do like this:
audio route change is been delayed 1000ms, and music pause immediately.
I want to know is firefox OS do with this issue like Android?
thanks!
| Assignee | ||
Comment 3•13 years ago
|
||
The android first brocast the ACTION_AUDIO_BECOMING_NOISY to let music paused audio in the WiredAccessoryObserver.java and switch patch after 1000ms.
Assignee: nobody → rlin
Updated•13 years ago
|
blocking-b2g: --- → tef?
Comment 4•13 years ago
|
||
This is not a blocker in my opinion.
Comment 5•13 years ago
|
||
We would track it for consistency
blocking-b2g: tef? → -
tracking-b2g18:
--- → +
| Assignee | ||
Comment 6•13 years ago
|
||
this patch couldn't solve the problem, and I even cannot compile code successfully with this patch.
Are you sure this patch is for solving the PR?
| Assignee | ||
Comment 8•13 years ago
|
||
This patch is generated in mozilla-central trunk. What kind of build break message do you find?
Created an attachment (id=395833)
modified patch.
I modify the error from your patch, The attachment is the new modified patch.You can diff it with your patch.
But this new patch cannot work yet.
pls confirm it.
thanks
| Reporter | ||
Comment 10•13 years ago
|
||
Created an attachment (id=395833)
modified patch.
I modify the error from your patch, The attachment is the new modified patch.You can diff it with your patch.
But this new patch cannot work yet.
pls confirm it.
thanks
| Assignee | ||
Comment 11•13 years ago
|
||
Can you try this?
Attachment #739078 -
Attachment is obsolete: true
| Assignee | ||
Comment 12•13 years ago
|
||
hg format patch, delay 1s (this value comes from WiredAccessoryObserver.java) to switch path back to speaker.
Attachment #740691 -
Attachment is obsolete: true
Attachment #740697 -
Flags: review?(mwu)
| Reporter | ||
Comment 13•13 years ago
|
||
ok. this patch works.
thanks.
Comment 14•13 years ago
|
||
This patch is a bit of a hack.
What would be best is if we could wait for all listeners of headphone event to run before switching outputs.
Comment 15•13 years ago
|
||
Hi Michael,
I think moving NotifyHeadphonesStatus() in front of InternalSetAudioRoutes() is what we should to. But I think only this can't solve this issue except we limit all corresponding actions by content process & app layer MUST response it in the blocking call.
So maybe we can composite your opinion with 1 second time out together for more safety. How about this? Thanks.
| Assignee | ||
Comment 16•13 years ago
|
||
This sound leakage comes from some PCM buffer queue in the audioflinger and media system, So we need some time to wait those buffer flush out to audio codec.
Comment 17•12 years ago
|
||
I don't mind adding a small time out if the hardware doesn't respond fast enough to stream pausing. Please check first though - if pausing/stopping the stream is fast enough, we can avoid an arbitrary delay altogether. At least to me, hitting pause in the music app appears to have very low latency.
| Assignee | ||
Comment 18•12 years ago
|
||
This delay magic number comes from
https://android.googlesource.com/platform/frameworks/base/+/0b285499db739ba50f2f839d633e763c70e67f96/services/java/com/android/server/WiredAccessoryObserver.java
L208.
| Reporter | ||
Comment 19•12 years ago
|
||
We have not got the patch in daily version.Any problem with the patch yet?
| Assignee | ||
Comment 20•12 years ago
|
||
Re-base to current mc.
We refer to android design and use the 1sec delay for switching audio path back to speaker. The short sound I think is the buffer in audio sub system. So we may need short time to wait the pcm audio data flush out and let device switch back to speaker.
Attachment #740697 -
Attachment is obsolete: true
Attachment #740697 -
Flags: review?(mwu)
Attachment #775673 -
Flags: review?(mchen)
Comment 21•12 years ago
|
||
I/GonkSwitch( 428): SwitchEventRunnable begin
I/AudioManager( 428): notify start
V/AudioFlinger( 115): ThreadBase::setParameters() routing=2
W/AudioHardwareMSM76XXA( 115): rpc_snd_set_device(6, 1, 1)
I/AudioManager( 428): notify end
I/Audiochannelmanager( 542): notify start
I/mediaelement( 542): pause start ()
I/GonkSwitch( 428): SwitchEventRunnable end
Actions above is ran on main threads of each process.
---------------------------------------------------------
Actions below is ran on non-main thread of content process.
V/AudioFlinger( 115): pause(4096), calling thread 542
V/AudioFlinger( 115): ACTIVE/RESUMING => PAUSING (4096) on thread 0x1e6aac0
E/AudioSystem( 115): AudioSystem::get_audio_policy_service 0x1e6a2c8
I/mediaelement( 542): stop
I/Audiochannelmanager( 542): notify end
This log shows that
1. switch event is sent to AudioManager on parent process first then routing path is switched to speaker already.
2. Then switch event is sent to AudioChannelManager on child process then notify the music app about headset missing.
3. Then music app start to pause the music.
4. According to decode/mediastatemachine is ran on another thread, so there is a latency there.
Conclusion: After 1, the routing path is changed to speaker already so the latency from 2 ~ 4 will cause the sound output to speaker.
Comment 22•12 years ago
|
||
Comment on attachment 775673 [details] [diff] [review]
patch v2.1
Review of attachment 775673 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/system/gonk/AudioManager.cpp
@@ +117,5 @@
>
> return false;
> }
>
> +static void ProcessDelayAudioRoutes(SwitchState aState)
ProcessDelayedAudioRoute
@@ +287,2 @@
> NotifyHeadphonesStatus(aEvent.status());
> + // Avoid speaker output the short sound when user plug out the headset when music is playing.
Could you re-phrase this comment?
Attachment #775673 -
Flags: review?(mchen)
Comment 23•12 years ago
|
||
Hi Michael,
Please refer to comment 21 for why do we need to add this delay. Thanks.
Flags: needinfo?(mwu)
| Assignee | ||
Comment 24•12 years ago
|
||
Fix nits
Attachment #775673 -
Attachment is obsolete: true
Attachment #776930 -
Flags: review?(mchen)
Comment 25•12 years ago
|
||
Comment on attachment 776930 [details] [diff] [review]
patvh v2.2
Review of attachment 776930 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/system/gonk/AudioManager.cpp
@@ +282,2 @@
> NotifyHeadphonesStatus(aEvent.status());
> + // Avoid users plug out headset and the speaker also output sounds for a short time.
How about the comment as below?
// When user pulled out the headset, a delay of routing here can avoid the leakage of audio from speaker.
Attachment #776930 -
Flags: review?(mchen) → review+
| Assignee | ||
Comment 26•12 years ago
|
||
Carry reviewer and modify comment.
| Assignee | ||
Updated•12 years ago
|
Keywords: checkin-needed
Updated•12 years ago
|
Attachment #776930 -
Attachment is obsolete: true
Comment 27•12 years ago
|
||
Keywords: checkin-needed
Comment 28•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Updated•12 years ago
|
Flags: needinfo?(mwu)
| Reporter | ||
Comment 29•12 years ago
|
||
resloved
You need to log in
before you can comment on or make changes to this bug.
Description
•