[FFOS7715 v2.1] [dolphin][video][Audio] Video sounds can be heard after receiving the call

NEW
Unassigned

Status

Firefox OS
Gaia::Video
--
major
3 years ago
3 years ago

People

(Reporter: lin.hui@spreadtrum.com, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [sprd 436257])

Attachments

(2 attachments, 1 obsolete attachment)

(Reporter)

Description

3 years ago
Steps to reproduce:
----------------------------------------------------
Step 1: Place SIM card in respective slot;
Step 2: Open browser,and go www.grammy.com;
Step 3: Select one video and playing it;
Step 4: When video playing,receiving a call on device;
Step 5: Answer the telephone,then click speaker;
Step 6: you can hearing video sounds playing in speaker  --KO

Reproduce rate:  5/5
(Reporter)

Comment 1

3 years ago
Dear vance:

What I found about this issue as follows:

1. Open www.grammy.com site,selected one video to playing, the audio channel type is AudioChannel::Normal;
05-14 19:58:48.135   808   808 I lin.hui ==>: AudioChannelAgent - setVisibilityState...visible:1.
05-14 19:58:48.145   808   808 I lin.hui ==>: AudioChannelServiceChild - GetState: aAgent:0xaf303920, aElementHidden:0.
05-14 19:58:48.145   131   131 I lin.hui ==>: AudioChannelService::GetStateInternal , aChannel:0
05-14 19:58:48.165   131   131 I lin.hui ==>: AudioChannelService::CheckTelephonyPolicy, aChannel:0.
05-14 19:58:52.355   808   808 I lin.hui ==>: AudioChannelServiceChild - GetState: aAgent:0xaf303920, aElementHidden:0.
05-14 19:58:52.365   131   131 I lin.hui ==>: AudioChannelService::GetStateInternal , aChannel:0
05-14 19:58:52.365   131   131 I lin.hui ==>: AudioChannelService::CheckTelephonyPolicy, aChannel:0.
05-14 19:58:52.375   808   808 I lin.hui ==>: AudioChannelServiceChild - GetState: aAgent:0xaf303920, aElementHidden:0.
05-14 19:58:52.375   131   131 I lin.hui ==>: AudioChannelService::GetStateInternal , aChannel:0
05-14 19:58:52.375   131   131 I lin.hui ==>: AudioChannelService::CheckTelephonyPolicy, aChannel:0.
05-14 19:58:52.375   808   808 I lin.hui ==>: AudioChannelAgent::NotifyAudioChannelStateChanged,state:0.
05-14 19:58:52.515   808   808 I lin.hui ==>: AudioChannelServiceChild - GetState: aAgent:0xaf303920, aElementHidden:0.
05-14 19:58:52.515   131   131 I lin.hui ==>: AudioChannelService::GetStateInternal , aChannel:0
05-14 19:58:52.515   131   131 I lin.hui ==>: AudioChannelService::CheckTelephonyPolicy, aChannel:0.
05-14 19:58:52.515   808   808 I lin.hui ==>: AudioChannelServiceChild - GetState: aAgent:0xaf303920, aElementHidden:0.
05-14 19:58:52.515   131   131 I lin.hui ==>: AudioChannelService::GetStateInternal , aChannel:0
05-14 19:58:52.515   131   131 I lin.hui ==>: AudioChannelService::CheckTelephonyPolicy, aChannel:0.
05-14 19:58:52.515   808   808 I lin.hui ==>: AudioChannelAgent::NotifyAudioChannelStateChanged,state:0.

2. Then ,receving a call, the audio channel has registed to Ringer;
05-14 19:59:32.125   131   131 I lin.hui ==>: AudioChannelService::GetStateInternal , aChannel:5
05-14 19:59:32.125   131   131 I lin.hui ==>: AudioChannelService::CheckTelephonyPolicy, aChannel:5.
05-14 19:59:32.945   131   131 I lin.hui ==>: AudioChannelAgent - setVisibilityState...visible:1.
05-14 19:59:32.945   131   131 I lin.hui ==>: AudioChannelService::GetStateInternal , aChannel:5
05-14 19:59:32.945   131   131 I lin.hui ==>: AudioChannelService::CheckTelephonyPolicy, aChannel:5.
05-14 19:59:33.115   131   131 I lin.hui ==>: AudioChannelService::GetStateInternal , aChannel:5
05-14 19:59:33.115   131   131 I lin.hui ==>: AudioChannelService::CheckTelephonyPolicy, aChannel:5.
05-14 19:59:33.115   131   131 I lin.hui ==>: AudioChannelService::GetStateInternal , aChannel:5
05-14 19:59:33.115   131   131 I lin.hui ==>: AudioChannelService::CheckTelephonyPolicy, aChannel:5.
05-14 19:59:33.115   131   131 I lin.hui ==>: AudioChannelAgent::NotifyAudioChannelStateChanged,state:0.

3.Click the answer button;
05-14 19:59:33.895   131   131 I lin.hui ==>: DispatchInputEvent.
05-14 19:59:33.945   131   131 I lin.hui ==>: DispatchInputEvent.
05-14 19:59:33.995   131   131 I lin.hui ==>: DispatchInputEvent.
05-14 19:59:34.005   131   131 I lin.hui ==>: DispatchInputEvent.

4.Ringer‘s channel has unregisted,切then swap to telephony channel;
05-14 19:59:34.565   131   131 I lin.hui ==>: AudioChannelService::UnregisterType aChannel:5,aElementHidden:0.
05-14 19:59:34.615   131   131 I lin.hui ==>: AudioChannelService::UnregisterType aChannel:5,aElementHidden:0.
05-14 19:59:34.645   131   131 I lin.hui ==>: AudioChannelService::GetStateInternal , aChannel:4
05-14 19:59:34.655   131   131 I lin.hui ==>: AudioChannelService::CheckTelephonyPolicy, aChannel:4.

5. Then I click the speaker button open the speaker;
05-14 19:59:34.915   131   131 I lin.hui ==>: DispatchInputEvent.
05-14 19:59:34.945   131   131 I lin.hui ==>: DispatchInputEvent.
05-14 19:59:35.025   131   131 I lin.hui ==>: DispatchInputEvent.
05-14 19:59:35.025   131   131 I lin.hui ==>: DispatchInputEvent.

6.At the same time, we can see the channel swap to normal automatically, cause the video sounds coming out from speaker;
05-14 19:59:38.755   808   808 I lin.hui ==>: AudioChannelServiceChild - GetState: aAgent:0xaf303920, aElementHidden:0.
05-14 19:59:38.775   131   131 I lin.hui ==>: AudioChannelService::GetStateInternal , aChannel:0
05-14 19:59:38.775   131   131 I lin.hui ==>: AudioChannelService::CheckTelephonyPolicy, aChannel:0.
05-14 19:59:38.775   808   808 I lin.hui ==>: AudioChannelServiceChild - GetState: aAgent:0xaf303920, aElementHidden:0.
05-14 19:59:38.785   131   131 I lin.hui ==>: AudioChannelService::GetStateInternal , aChannel:0
05-14 19:59:38.785   131   131 I lin.hui ==>: AudioChannelService::CheckTelephonyPolicy, aChannel:0.
05-14 19:59:38.785   808   808 I lin.hui ==>: AudioChannelAgent::NotifyAudioChannelStateChanged,state:0.
05-14 19:59:38.805   808   808 I lin.hui ==>: AudioChannelServiceChild - GetState: aAgent:0xaf303920, aElementHidden:0.
05-14 19:59:38.815   131   131 I lin.hui ==>: AudioChannelService::GetStateInternal , aChannel:0
05-14 19:59:38.815   131   131 I lin.hui ==>: AudioChannelService::CheckTelephonyPolicy, aChannel:0.
05-14 19:59:38.815   808   808 I lin.hui ==>: AudioChannelServiceChild - GetState: aAgent:0xaf303920, aElementHidden:0.
05-14 19:59:38.815   131   131 I lin.hui ==>: AudioChannelService::GetStateInternal , aChannel:0
05-14 19:59:38.815   131   131 I lin.hui ==>: AudioChannelService::CheckTelephonyPolicy, aChannel:0.
05-14 19:59:38.815   808   808 I lin.hui ==>: AudioChannelAgent::NotifyAudioChannelStateChanged,state:0.
05-14 19:59:39.175   808   808 I lin.hui ==>: AudioChannelServiceChild - GetState: aAgent:0xaf303920, aElementHidden:0.
05-14 19:59:39.175   131   131 I lin.hui ==>: AudioChannelService::GetStateInternal , aChannel:0
05-14 19:59:39.175   131   131 I lin.hui ==>: AudioChannelService::CheckTelephonyPolicy, aChannel:0.
05-14 19:59:39.185   808   808 I lin.hui ==>: AudioChannelServiceChild - GetState: aAgent:0xaf303920, aElementHidden:0.
05-14 19:59:39.185   131   131 I lin.hui ==>: AudioChannelService::GetStateInternal , aChannel:0
05-14 19:59:39.185   131   131 I lin.hui ==>: AudioChannelService::CheckTelephonyPolicy, aChannel:0.
05-14 19:59:39.185   808   808 I lin.hui ==>: AudioChannelAgent::NotifyAudioChannelStateChanged,state:0.
05-14 19:59:39.695   808   808 I lin.hui ==>: AudioChannelAgent - setVisibilityState...visible:0.
05-14 19:59:39.695   808   808 I lin.hui ==>: AudioChannelServiceChild - GetState: aAgent:0xaf303920, aElementHidden:1.
05-14 19:59:39.705   131   131 I lin.hui ==>: AudioChannelService::GetStateInternal , aChannel:0
05-14 19:59:40.155   808   808 I lin.hui ==>: AudioChannelServiceChild - GetState: aAgent:0xaf303920, aElementHidden:1.
05-14 19:59:40.155   131   131 I lin.hui ==>: AudioChannelService::GetStateInternal , aChannel:0
05-14 19:59:40.155   808   808 I lin.hui ==>: AudioChannelServiceChild - GetState: aAgent:0xaf303920, aElementHidden:1.
05-14 19:59:40.155   131   131 I lin.hui ==>: AudioChannelService::GetStateInternal , aChannel:0
05-14 19:59:40.155   808   808 I lin.hui ==>: AudioChannelAgent::NotifyAudioChannelStateChanged,state:1.

I also captured a video about this issue, please go following path to download:
   ftp://ftp.spreadtrum.com/for_sprd_mozilla/Mozilla_bug1164827/    file name:Video_sound_issue.MOV
   username: mouzhi
   password: mouZHI$$61​

Vance, could you help to find some one familiar with the audio channel to investigate this issue? 

Thanks!
Flags: needinfo?(vchen)
I will check it later.
Keep ni for tracking.
Flags: needinfo?(vchen) → needinfo?(alwu)
(Reporter)

Comment 4

3 years ago
Update my further investigation.

I have added the same debug log in dolphin and flame build(flame is original code).

On flame device:
1.Playing video in grammy site;
05-15 11:07:38.673 I/lin.hui ==>( 6222): AudioChannelAgent - setVisibilityState...mAudioChannelType:0,visible:1.
05-15 11:07:38.823 I/lin.hui ==>( 6222): AudioChannelAgent::NotifyAudioChannelStateChanged,mAudioChannelType:0, state:0.
05-15 11:07:38.833 I/lin.hui ==>( 6222): AudioChannelAgent::NotifyAudioChannelStateChanged,mAudioChannelType:0, state:0.

2. Receving one call on device,when ringer once coming, the normal channel muted quickly,
05-15 11:09:03.073 I/lin.hui ==>( 5671): AudioChannelAgent - setVisibilityState...mAudioChannelType:5,visible:1.           ==> Ringer channel visible: true
05-15 11:09:03.213 I/lin.hui ==>( 5671): AudioChannelAgent::NotifyAudioChannelStateChanged,mAudioChannelType:5, state:0.
05-15 11:09:04.153 I/lin.hui ==>( 6222): AudioChannelAgent::NotifyAudioChannelStateChanged,mAudioChannelType:0, state:0.
05-15 11:09:04.933 I/lin.hui ==>( 6222): AudioChannelAgent - setVisibilityState...mAudioChannelType:0,visible:0.           ==> normal channel visible: flase
05-15 11:09:04.933 I/lin.hui ==>( 5671): AudioChannelAgent::NotifyAudioChannelStateChanged,mAudioChannelType:5, state:0.   ===>ringer channel playing
05-15 11:09:05.003 I/lin.hui ==>( 6222): AudioChannelAgent::NotifyAudioChannelStateChanged,mAudioChannelType:0, state:1.   ==> normal channel muted

But on dolphin, when ringer coming, the normal channel muted is very slowlly, consume about 5-10 seconds,so when I click the answer-button, the video sounds coming out, logs as follows:
05-15 11:35:00.016 I/lin.hui ==>(  898): AudioChannelAgent - setVisibilityState...mAudioChannelType:5,visible:1.       ==> Ringer channel visible:true
05-15 11:35:00.416 I/lin.hui ==>(  898): AudioChannelAgent::NotifyAudioChannelStateChanged,mAudioChannelType:5, state:0.   ==>Ringer starting

05-15 11:35:05.336 I/lin.hui ==>( 1171): AudioChannelAgent - setVisibilityState...mAudioChannelType:0,visible:1.
05-15 11:35:09.176 I/lin.hui ==>( 1171): AudioChannelAgent::NotifyAudioChannelStateChanged,mAudioChannelType:0, state:0.
05-15 11:35:09.206 I/lin.hui ==>( 1171): AudioChannelAgent::NotifyAudioChannelStateChanged,mAudioChannelType:0, state:0.
05-15 11:35:09.256 I/lin.hui ==>( 1171): AudioChannelAgent::NotifyAudioChannelStateChanged,mAudioChannelType:0, state:0.
05-15 11:35:10.916 I/lin.hui ==>( 1171): AudioChannelAgent - setVisibilityState...mAudioChannelType:0,visible:0.         ==> normal channel visible:false
05-15 11:35:12.136 I/lin.hui ==>( 1171): AudioChannelAgent::NotifyAudioChannelStateChanged,mAudioChannelType:0, state:1.    ==> normal channel muted.

As we can see, the ringer coming at "05-15 11:35:00.416", but normal channel muted at "05-15 11:35:12.136", so during the 12 seconds, we can hearing video sounds coming out.

Thanks!
Created attachment 8606241 [details] [diff] [review]
Change the correspond android type of the AudioChannel::Normal

Hi, LinHui, 
Could you try this patch?
Thanks!
Flags: needinfo?(alwu) → needinfo?(lin.hui)
(Reporter)

Comment 6

3 years ago
(In reply to Alastor Wu [:alwu] from comment #5)
> Created attachment 8606241 [details] [diff] [review]
> Change the correspond android type of the AudioChannel::Normal
> 
> Hi, LinHui, 
> Could you try this patch?
> Thanks!
After applying this patch, the issue still exist, maybe we should try another way.

Thanks for your help!
Flags: needinfo?(lin.hui) → needinfo?(alwu)
(Reporter)

Comment 7

3 years ago
Hi Alastor:

When flame is single core, we can also repro this problem on it, maybe this issue is performance related.

Playing video in grammy site, the CPU info about flame as follows: 

User 72%, System 20%, IOW 0%, IRQ 0%
User 48 + Nice 42 + Sys 25 + Idle 8 + IOW 0 + IRQ 0 + SIRQ 1 = 124

  PID PR CPU% S  #THR     VSS     RSS PCY UID      Name
 1301  0  38% S    31 165636K  81660K     u0_a1301 /system/b2g/b2g
  232  0  34% S    58 227664K  86520K     root     /system/b2g/b2g
  213  0   8% S    16  59332K   8112K  fg media    /system/bin/mediaserver
 2108  0   4% R     1   1312K    548K     root     top

User 59%, System 27%, IOW 0%, IRQ 0%
User 34 + Nice 42 + Sys 35 + Idle 16 + IOW 0 + IRQ 0 + SIRQ 0 = 127

  PID PR CPU% S  #THR     VSS     RSS PCY UID      Name
 1301  0  37% S    31 165764K  78836K     u0_a1301 /system/b2g/b2g
  232  0  26% S    58 227664K  86784K     root     /system/b2g/b2g
  213  0   7% S    16  59332K   8112K  fg media    /system/bin/mediaserver
 2108  0   5% R     1   1312K    548K     root     top 

But on dolphin, this value will be more higher,it is close to 100%:

User 64%, System 33%, IOW 0%, IRQ 2%
User 63 + Nice 24 + Sys 45 + Idle 0 + IOW 0 + IRQ 0 + SIRQ 3 = 135

  PID PR CPU% S  #THR     VSS     RSS PCY UID      Name
  130  0  40% R    64 223436K  96016K  fg root     /system/b2g/b2g
 1012  0  28% R    30 145268K  81920K  fg u0_a1012 /system/b2g/b2g
  125  0   9% S    17  48316K   8396K  fg media    /system/bin/mediaserver
  616  0   7% S     5   6008K    828K  fg root     /system/bin/slog

User 72%, System 27%, IOW 0%, IRQ 0%
User 68 + Nice 22 + Sys 34 + Idle 0 + IOW 0 + IRQ 0 + SIRQ 1 = 125

  PID PR CPU% S  #THR     VSS     RSS PCY UID      Name
  130  0  49% R    63 222732K  96140K  fg root     /system/b2g/b2g
 1012  0  28% R    30 145280K  81444K  fg u0_a1012 /system/b2g/b2g
  125  0  10% S    17  48316K   8408K  fg media    /system/bin/mediaserver
  616  0   8% S     5   6008K    828K  fg root     /system/bin/slog

User 72%, System 26%, IOW 0%, IRQ 0%
User 76 + Nice 17 + Sys 34 + Idle 0 + IOW 0 + IRQ 0 + SIRQ 1 = 128

  PID PR CPU% S  #THR     VSS     RSS PCY UID      Name
  130  0  47% R    63 222540K  95872K  fg root     /system/b2g/b2g
 1012  0  29% R    30 145344K  82208K  fg u0_a1012 /system/b2g/b2g
  125  0  10% S    17  48316K   8408K  fg media    /system/bin/mediaserver
  616  0   8% S     5   6008K    828K  fg root     /system/bin/slog

User 66%, System 30%, IOW 0%, IRQ 3%
User 60 + Nice 35 + Sys 43 + Idle 0 + IOW 0 + IRQ 0 + SIRQ 5 = 143

  PID PR CPU% S  #THR     VSS     RSS PCY UID      Name
  130  0  37% R    63 222284K  95684K  fg root     /system/b2g/b2g
 1012  0  34% R    30 145344K  82392K  fg u0_a1012 /system/b2g/b2g
  125  0   9% S    17  48316K   8408K  fg media    /system/bin/mediaserver
  616  0   7% S     5   6008K    828K  fg root     /system/bin/slog
If it is performance issue, I think I can't help with this.
We would check the visibility of the process to decide whether muted the process, and it seems that the video decoding has some problems which disturbs the delivery of the visibility notification .

BTW, when I played the video in Dolphin, the video can't display anything (black image), but the sound is normal.

---

Hi, Blake,
Could you help me to check this issue?
Very appreciate :)
Flags: needinfo?(alwu) → needinfo?(bwu)
(Reporter)

Comment 9

3 years ago
(In reply to Alastor Wu [:alwu] from comment #8)
> BTW, when I played the video in Dolphin, the video can't display anything
> (black image), but the sound is normal.
Reference Bug 1067224 - [Dolphin][Video]: There is no video output when playing MP4 file
This bug's patch has already landed on 2.1s version.

Thanks.
(Reporter)

Comment 10

3 years ago
Hi Blake:

This issue may make user experience very badly when watching video in browser then receiving a call on device, so please help to check this bug ASAP, if any information required, please let me know.

Thank you.
After syncing with Alwu, his phone is not using 2.1s code base, so he saw the black issue. He will re-check again after updating the code base to 2.1s.
Flags: needinfo?(bwu)
Created attachment 8606956 [details]
Delay of the visibility event

Here is the logcat which indicates the delay of the visibility event.
Attachment #8606241 - Attachment is obsolete: true
Chens, 
Per discussing offline, Alastor and I found the visibility change is sent out quite late after pushing home key to push browser to the background. Current audio channel policy replies on this notification of visibility change to mute the audio and even release video codec.  
Could you help to have a look?
Thanks!
Flags: needinfo?(chens)
(Reporter)

Comment 14

3 years ago
Hi Chens:

After some debug, as Blake says, the visibility change event is transfered to browser is quite late, cause the audio channel mute the video sound delay, then cause the audio coming out within 5-10 seconds.
 
05-19 14:10:10.502   I lin.hui : DispatchInputEvent.
05-19 14:10:10.712   I lin.hui : DispatchInputEvent.       ===> Press home button.

05-19 14:10:14.992   I lin.hui : HTMLMediaElement::NotifyOwnerDocumentActivityChanged, active:1,hidden:1                ===> HTMLMediaElement receiving visibility change event.   
05-19 14:10:14.992   I lin.hui : HTMLMediaElement::NotifyOwnerDocumentActivityChanged, active:1,hidden:1
05-19 14:10:14.992  1278  1278 I lin.hui : AudioChannelAgent - setVisibilityState...mAudioChannelType:0,visible:0.       ===> audio channel 0 visible: false
05-19 14:10:15.162  1278  1278 I lin.hui : AudioChannelService::NotifyEnumerator 1
05-19 14:10:15.172  1278  1278 I lin.hui : AudioChannelAgent::NotifyAudioChannelStateChanged,mAudioChannelType:0, state:1.   ===> normal channel muted

From the log, we can see there about 5 seconds delay when I press the home key back to the homescreen, please help to have a look.

Thank you.
Created attachment 8607377 [details]
measure home button to setVisible time

Lin Hui, 

Could you try this patch and measure the time between:
1. publish home event - app window setVisible
2. app window setVisible - visibility change event received
3. visibility change event - normal audio channel muted

Thanks.
Flags: needinfo?(chens) → needinfo?(lin.hui)
(Reporter)

Comment 16

3 years ago
(In reply to Sherman Chen [:chens] from comment #15)
> Could you try this patch and measure the time between:
> 1. publish home event - app window setVisible
> 2. app window setVisible - visibility change event received
> 3. visibility change event - normal audio channel muted
Hi Sherman -

Log as follows:

05-19 16:08:35.405   131   131 I lin.hui ==>: DispatchInputEvent.
05-19 16:08:35.535   131   131 I lin.hui ==>: DispatchInputEvent.
05-19 16:08:35.955   131   131 E GeckoConsole: Content JS LOG at app://system.gaiamobile.org/js/app_window.js:224 in aw_setVisible: lin.hui:[AppWindow]Homescreen set visibility ->  true
05-19 16:08:35.975   131   131 E GeckoConsole: Content JS LOG at app://system.gaiamobile.org/js/hardware_buttons.js:327 in HardwareButtonsHomeState.prototype.process: lin.hui:[HardwareButtons] publish home event

05-19 16:08:36.545   131   131 E GeckoConsole: Content JS LOG at app://system.gaiamobile.org/js/app_window.js:224 in aw_setVisible: lin.hui:[AppWindow]Homescreen set visibility ->  true
05-19 16:08:36.625   131   131 E GeckoConsole: Content JS LOG at app://system.gaiamobile.org/js/app_window.js:224 in aw_setVisible: lin.hui:[AppWindow]Homescreen set visibility ->  true
05-19 16:08:36.855   131   131 E GeckoConsole: Content JS LOG at app://system.gaiamobile.org/js/app_window.js:224 in aw_setVisible: lin.hui:[AppWindow]http://www.grammy.com/videos/ok-go-perform-the-writings-on-the-wall set visibility ->  false

05-19 16:08:38.655   799   799 I lin.hui ==>: HTMLMediaElement::NotifyOwnerDocumentActivityChanged, active:1,hidden:1
05-19 16:08:38.655   799   799 I lin.hui ==>: AudioChannelAgent - setVisibilityState...mAudioChannelType:0,visible:0.
05-19 16:08:38.715   799   799 I lin.hui ==>: HTMLMediaElement::NotifyOwnerDocumentActivityChanged, active:1,hidden:1

05-19 16:08:39.015   799   799 I lin.hui ==>: AudioChannelAgent::NotifyAudioChannelStateChanged,mAudioChannelType:0, state:1.   ===> muted ?

When playing video in grammy or youku site, then receiving a call, this delay will quite obviously. 

Thank you.
Flags: needinfo?(lin.hui) → needinfo?(chens)
Hi Hui lin -

You mentioned that the symptom is quite obvious while visiting the Youku or Grammy website, just wondering how about Youtube or Dailymotion? Do you still observe the same problem?

Thanks
Flags: needinfo?(lin.hui)
(Reporter)

Comment 18

3 years ago
(In reply to Vance Chen [:vchen][vchen@mozilla.com] from comment #17)
> Hi Hui lin -
> 
> You mentioned that the symptom is quite obvious while visiting the Youku or
> Grammy website, just wondering how about Youtube or Dailymotion? Do you
> still observe the same problem?
Hi Vance:

In Youtube or Dailymotion, I can still reproduce this issue, but the probability is very low, when playing video in Youtube or Dailymotion, the CPU resource consume about 80%~90%, but in grammy or youku, as I mentioned in comment 7, CPU consume will close to 100%.

Thanks.
Flags: needinfo?(lin.hui)
(In reply to lin.hui@spreadtrum.com from comment #16)

From the log we found the time cost between these events are:
(16:08:35.975) 1. publish home event
(16:08:36.855) 2. app window setVisible to false
(16:08:38.655) 3. received visibility change event
(16:08:39.015) 4. normal audio channel muted

Step 1-2 takes 880ms, and step 2-3 takes 1800 ms. The problem could be in step 2-3, under high cpu loading, gecko got slow respond to visibility change in iframe.
Flags: needinfo?(chens)
(Reporter)

Comment 20

3 years ago
(In reply to Sherman Chen [:chens] from comment #19)
> (In reply to lin.hui@spreadtrum.com from comment #16)
> 
> From the log we found the time cost between these events are:
> (16:08:35.975) 1. publish home event
> (16:08:36.855) 2. app window setVisible to false
> (16:08:38.655) 3. received visibility change event
> (16:08:39.015) 4. normal audio channel muted
> 
> Step 1-2 takes 880ms, and step 2-3 takes 1800 ms. The problem could be in
> step 2-3, under high cpu loading, gecko got slow respond to visibility
> change in iframe.
1800ms is a normal scene, most of times at step 2-3 will takes 5 seconds to respond the visibility change in iframe, so the sounds will coming out with 5 seconds.

From the customer's point of view, we just playing a video on device, and without other operation, when receiving a call, the video sounds coming out in phone is badly experience, and when flame is single core, I can also repro this issue, so please help to solve this problem.

Thank you.
Flags: needinfo?(chens)
Hi Hui Lin -

We will see what we can do here. But I have to point out that if it is truly caused by the CPU limitation, then probably there won't be much room for improvement(with single core, maybe this is as good as we can get...)

Thanks
(Reporter)

Comment 22

3 years ago
(In reply to Vance Chen [:vchen][vchen@mozilla.com] from comment #21)
> Hi Hui Lin -
> 
> We will see what we can do here. But I have to point out that if it is truly
> caused by the CPU limitation, then probably there won't be much room for
> improvement(with single core, maybe this is as good as we can get...)
Hi Vance:

Sorry, my fault, maybe I'm too worried about this issue, I know if it is truly caused by the CPU limitation, then probably there won't be much room for improvement, but we will try to do some improve to avoid it.

Thank you for your great help.
Hands are tied in gaia, in system app we have nothing to do after set visible attribute on an iframe.
Flags: needinfo?(chens)
(Reporter)

Comment 24

3 years ago
Hi Vance & shawn:

Sorry to trouble your again!

About this issue, we can see when playing video in Youtube or Dailymotion site, this bug will not happened, but when in Youku or Grammy, the issue repro, I think Youtube or Dailymotion site side may make some optimization for Firefox OS, so we can visit those site very smoothly, and when receiving a call, the visibility triggered quickly.

Now our idea is tend to another better way: Mozillan could  cooperation with Youku's engineer  to make some optimization of the Youku site for Firefox OS, this optimization may have great help for this delay issue.

How about this suggestion? looking forward to your reply.

Thanks!
Flags: needinfo?(vchen)
Flags: needinfo?(sku)
(Reporter)

Comment 25

3 years ago
According to Bug 916205 - Create and enable dynamic UA override list in B2G, we add and package UA override list.

The change like this:

diff --git a/b2g/app/ua-update.json.in b/b2g/app/ua-update.json.in
new file mode 100644
index 0000000..141055f
--- /dev/null
+++ b/b2g/app/ua-update.json.in
@@ -0,0 +1,276 @@
+// Comments must be on their own lines and must start with "//"
+
+// Send these sites a custom user-agent. Bugs to remove each override after
+// evangelism are included.
+{
+  // bug 802981, maps.google.com
+  "maps.google.com": "\\(Mobile#(Android; Mobile",
+  // bug 826330, uol.com.br
+  "uol.com.br": "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
+  // bug 826332, live.com
+  "live.com": "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
+  // bug 826335, globo.com
+  "globo.com": "\\(Mobile#(Android; Mobile",
+  // bug 826338, yahoo.com
+  "yahoo.com": "\\(Mobile#(Android; Mobile",
+  // bug 826342, mercadolivre.com.br
+  "mercadolivre.com.br": "\\(Mobile#(Android; Mobile",
+  // bug 826343, ig.com.br
+  "ig.com.br": "\\(Mobile#(Android; Mobile",
+  // bug 826344, abril.com.br
+  "abril.com.br": "\\(Mobile#(Android; Mobile",
+  // bug 826347, msn.com
+  "msn.com": "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
+  // bug 826348, linkedin.com
+  "linkedin.com": "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
+  // bug 826353, itau.com.br
+  "itau.com.br": "\\(Mobile#(Android; Mobile",
+  // bug 826504, orkut.com.br
+  "orkut.com.br": "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
+  // bug 826510, r7.com
+  "r7.com": "\\(Mobile#(Android; Mobile",
+  // bug 826514, estadao.com.br
+  "estadao.com.br": "\\(Mobile#(Android; Mobile",
+  // bug 826517, letras.mus.br
+  "letras.mus.br": "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
+  // bug 826711, bb.com.br
+  "bb.com.br": "\\(Mobile#(Android; Mobile",
+  // bug 826712, orkut.com

So when we visit site like Youtube or hao123.com, we got the mobile site seen, but we didn't add the youku or grammy site to that file, cause those site like a PC site seen.

I tried to modified ua-update.json.in, added the youku or grammy site to it, but changes seem doesn't work, maybe someone could help me or give me some advices.

My modifications as follows:
diff --git a/b2g/app/ua-update.json.in b/b2g/app/ua-update.json.in
index 1a59bef..d441120 100644
--- a/b2g/app/ua-update.json.in
+++ b/b2g/app/ua-update.json.in
@@ -29,6 +29,10 @@
   "groupon.com.br": "\\(Mobile#(Android; Mobile",
   // bug 827633, hao123.com
   "hao123.com": "\\(Mobile#(Android; Mobile",
+  // youku.com
+  "youku.com": "\\(Mobile#(Android; Mobile",
+  // grammy.com
+  "grammy.com": "\\(Mobile#(Android; Mobile",
   // bug 827573, webmotors.com.br
   "webmotors.com.br": "\\(Mobile#(Android; Mobile",
   // bug 827670, elpais.com.co

Thanks.
Hi Lin hui -

I am not sure if that will fix this problem since in ua-update.json.in I didn't see we send Youtube or Dailymotion a specific User Agent string. Do you see somewhere else in the code we customized the UA string for Youtube or Dailymotion?
Flags: needinfo?(vchen)
Flags: needinfo?(sku)
Flags: needinfo?(lin.hui)
(Reporter)

Comment 27

3 years ago
(In reply to Vance Chen [:vchen][vchen@mozilla.com] from comment #26)
> Hi Lin hui -
> 
> I am not sure if that will fix this problem since in ua-update.json.in I
> didn't see we send Youtube or Dailymotion a specific User Agent string. Do
> you see somewhere else in the code we customized the UA string for Youtube
> or Dailymotion?

Hi Vance:

Yes I can not see the Youtube or Dailymotion in ua-update.json.in files.

Bug 819210 - Add UA overrides for top Brazil sites, in this bug, I can see the youtube and dailymotion site using the UA:

diff --git a/build/ua-override-prefs.js b/build/ua-override-prefs.js
index 7a9b9d0..4b22628 100644
--- a/build/ua-override-prefs.js
+++ b/build/ua-override-prefs.js
@@ -1,8 +1,47 @@
 
 // Send these sites a custom user-agent.
 pref("general.useragent.override.facebook.com", "\(Mobile#(Android; Mobile");
 pref("general.useragent.override.youtube.com", "\(Mobile#(Android; Mobile");
 pref("general.useragent.override.yelp.com", "\(Mobile#(Android; Mobile");
 pref("general.useragent.override.dailymotion.com", "\(Mobile#(Android; Mobile");
 pref("general.useragent.override.accounts.google.com", "\(Mobile#(Android; Mobile");
 pref("general.useragent.override.maps.google.com", "\(Mobile#(Android; Mobile");
+pref("general.useragent.override.uol.com.br", "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19");
+pref("general.useragent.override.live.com", "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19");
+pref("general.useragent.override.globo.com", "\(Mobile#(Android; Mobile");
+pref("general.useragent.override.yahoo.com", "\(Mobile#(Android; Mobile");
+pref("general.useragent.override.mercadolivre.com.br", "\(Mobile#(Android; Mobile");
+pref("general.useragent.override.ig.com.br", "\(Mobile#(Android; Mobile");

But since Bug 916205 - Create and enable dynamic UA override list in B2G was resolved, we deleted the ua-override-prefs.js and using ua-update.json.in instead, in ua-update.json.in, we didn't added Youtube or Dailymotion.

Until now, we can see youtube or dailymotion we displayed as a mobile site seen, but the youku and Grammy is not, they displayed like a PC site, so when we visit those site CPU consumes very highest, I think we can make some optimization about those site, maybe we can change those site displayed in Firefox OS as a mobile site firstly.

Thank you.
Flags: needinfo?(lin.hui)
I see...

Your modification seems OK to me, not sure why it doesn't work...could you also help to check that all parts of the patch of Bug#916205 are included in your code base?

https://hg.mozilla.org/releases/mozilla-aurora/rev/6390b4803456

Thanks

Vance
Flags: needinfo?(lin.hui)
(Reporter)

Comment 29

3 years ago
(In reply to Vance Chen [:vchen][vchen@mozilla.com] from comment #28)
> Your modification seems OK to me, not sure why it doesn't work...could you
> also help to check that all parts of the patch of Bug#916205 are included in
> your code base?
> 
> https://hg.mozilla.org/releases/mozilla-aurora/rev/6390b4803456
Hi Vance:

I checked those related files carefully, I can see all the patches of Bug 916205 are included in my code base, but when I added Youku or Grammy, it doesn't work, could you help to find someone to have a look?

Thank you!
Flags: needinfo?(lin.hui)
Hi Jim -

Our partner wants to send a customized UA string to YouKo and Grammy website such that the website can return the mobile version of the website. As Comment#25 they try to modify the ua-update.json.in but it doesn't work. Is there anything else they should do to enable the dynamically UA string override?

Also  Lin Hui, you mentioned that it doesn't work, have you check the data log(via wireshark or some other tools) to see what the UA string actually is while accessing the Youku/Grammy website after your modification?
Flags: needinfo?(nchen)
Flags: needinfo?(lin.hui)
(Reporter)

Comment 31

3 years ago
Hi Vance:

After reset the phone(settings->device information->reset phone), reboot it again, this time the function working seems well, Youku will displayed like a mobile site, but when I repeated open the www.youku.com, after several times, the site displayed as PC site again, here the video what I captured:
   ftp://ftp.spreadtrum.com/for_sprd_mozilla/Mozilla_bug1164827/        file name: Youku.mov
   username: mouzhi
   password: mouZHI$$61​

If the Youku displayed in mobile mode, when watching video, the video container don't showing the play/pause button.
Hi Vance,

ua-update.json.in is a file we automatically download from a Mozilla server, periodically. If you change the file locally, it will eventually be replaced by a downloaded version, and your changes will be lost.

To make the changes permanent, you need to commit your changes to the mozilla-central repository, and the changes will be automatically sync'd to the Mozilla server.

Another option is to add prefs, for example,

> pref("general.useragent.override.youku.com", "\(Mobile#(Android; Mobile");
> pref("general.useragent.override.grammy.com", "\(Mobile#(Android; Mobile");

to one of the pref files (e.g. /b2g/app/b2g.js).
Flags: needinfo?(nchen)
> To make the changes permanent, you need to commit 
> your changes to the mozilla-central repository, 
> and the changes will be automatically sync'd to 
> the Mozilla server.

to complete what Jim said. You need to open a bug in Tech Evangelism :: Mobile

1. explain what is the issue
2. analyze it and find the source of the issue
3. propose a fix for the code
4. propose a UA override as a temporary solution and which one.
5. demonstrate that the UA override is not breaking anything else. (it's happening often).

Then we can modify the UA override. ^_^
Flags: needinfo?(vchen)
(Reporter)

Comment 34

3 years ago
(In reply to Jim Chen [:jchen] [:darchons] from comment #32)
> ua-update.json.in is a file we automatically download from a Mozilla server,
> periodically. If you change the file locally, it will eventually be replaced
> by a downloaded version, and your changes will be lost.
Hi Jim:

If ua-update.json.in file is automatically download from a Mozilla server, Is this a timer to update this file? whether can I modified this code to prevent the update?  In my local build, this change will lost after several times I open the same site, you can get the video I captured in comment 31.
 pref("general.useragent.enable_overrides", true);
+// See ua-update.json.in for the packaged UA override list
+pref("general.useragent.updates.enabled", true);
+pref("general.useragent.updates.url", "");
+pref("general.useragent.updates.interval", 604800); // 1 week             ===>
+pref("general.useragent.updates.retry", 86400); // 1 day                  ===>

> Another option is to add prefs, for example,
> 
> > pref("general.useragent.override.youku.com", "\(Mobile#(Android; Mobile");
> > pref("general.useragent.override.grammy.com", "\(Mobile#(Android; Mobile");
If I added the UA in prefs, the site will always displayed like mobile site?

Thanks you for your great help!
Flags: needinfo?(lin.hui) → needinfo?(nchen)
Lin, 

> If ua-update.json.in file is automatically download from a Mozilla server, Is this a timer to update this file?

Yes it is updated automatically. Each time, there's an update. That's a feature.

> In my local build, this change will lost after several times

For testing purpose, You can set up 
   pref("general.useragent.enable_overrides", false);

This will locally stop the UA override. And you can decide to locally test with a different UA in your preferences. 

> If I added the UA in prefs, the site will always displayed like mobile site?

See my Comment #33
Flags: needinfo?(nchen)
youku.com is in Bug 988761
grammy.com is already a responsive Web site. It doesn't need UA override.
(In reply to Karl Dubost :karlcow from comment #36)
> youku.com is in Bug 988761
> grammy.com is already a responsive Web site. It doesn't need UA override.

Hi Karl -

So looks like for now, we still need UA override for Youku website, right?
Flags: needinfo?(vchen) → needinfo?(kdubost)
Vance, 
comments about youku in Bug 988761 please :)
Flags: needinfo?(kdubost)
(In reply to Karl Dubost :karlcow from comment #38)
> Vance, 
> comments about youku in Bug 988761 please :)

Sorry Karl, I am not that familiar with the UA override mechanism... In https://bugzilla.mozilla.org/show_bug.cgi?id=988761#c4 you mentioned that the Firefox OS is receiving desktop content and we need to contact them. But before Youku make any change, shouldn't we use UA override to force Youku to send Firefox OS the mobile content?
Flags: needinfo?(kdubost)
See Bug 988761 for my answer. 
This bug seems to be about another topic entirely and I think we already abused the comments.
Flags: needinfo?(kdubost)
You need to log in before you can comment on or make changes to this bug.