New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 675950 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Email to this user bounced
Closed: Jan 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

Audio sound from the video continues to come out even if device moves to other pages while playing back video in the "News pass" application.

Reported by somcs...@gmail.com, Dec 20 2016

Issue description

Example URL:

Steps to reproduce the problem:
1. Launch "News pass" application.
2. Choose article from video distribution site of "TV Asahi news" and tap "Read the original" link in the article.
3. Play video in the destination page.
4. While playing back video, tap the back-button at top left of the screen or back-button on the device.

What is the expected behavior?
Audio sound should stop when device moves from the video playing page to other pages. 

What went wrong?
Audio sound from the video continues to come out even if device moves to other pages

Did this work before? N/A 

Is it a problem with Flash or HTML5? N/A

Does this work in other browsers? N/A

Chrome version: 55.0.2883.91  Channel: n/a
OS Version: 6.1 
Flash Version: 

Contents of chrome://gpu:
 

Comment 1 by somcs...@gmail.com, Dec 20 2016

Pls find the attachment. 
WebViewFactory: Loading com.android.chrome version 53.0.2785.124 (code 278512452)
Nexus.txt
7.6 MB View Download
Components: Mobile>WebView
Cc: mlamouri@chromium.org
Owner: ti...@chromium.org
Status: Assigned (was: Unconfirmed)
Assigning to Tima

Comment 4 by ti...@chromium.org, Jan 12 2017

marlin-userdebug 7.1.1 NMF26U 3562008 dev-keys WebView 57.0.2977.0

I could reproduce the issue by pressing phone back button.
There is a short pause, and after that the audio resumes.

// Normal playback steady state
01-11 17:28:50.122  1151  3408 I MediaFocusControl:  AudioFocus  requestAudioFocus() from uid/pid 10118/22256 clientId=android.media.AudioManager@44f88acorg.chromium.content.browser.AudioFocusDelegate@289c975 req=1 flags=0x0

01-11 17:29:04.918 22256 22285 D SessionClientState: Session Paused: 62e11a86-20170112-012726035
01-11 17:29:04.918 22256 22285 V SessionClientState: Firing Session Event: _session.pause
01-11 17:29:04.945 22256 22296 D SessionClientState: Firing Session Event: _session.resume
01-11 17:29:04.945 22256 22296 I SessionClientState: Session Resumed: 62e11a86-20170112-012726035

// The activity is gone
01-11 17:29:05.012 22256 22256 I cr_AwContents: org.chromium.android_webview.AwContents@b209ba8 onWindowVisibilityChanged 8

01-11 17:29:05.144 22256 22516 W cr_MediaCodecBridge: calling MediaCodec.release() on OMX.qcom.video.decoder.avc
01-11 17:29:05.281 22256 22256 I cr_AwContents: org.chromium.android_webview.AwContents@b209ba8 onDetachedFromWindow

// Request audio focus again
01-11 17:29:05.315  1151  6678 I MediaFocusControl:  AudioFocus  requestAudioFocus() from uid/pid 10118/22256 clientId=android.media.AudioManager@44f88acorg.chromium.content.browser.AudioFocusDelegate@289c975 req=1 flags=0x0

// Initialize video again
01-11 17:29:05.324   638   638 I MediaPlayerService: MediaPlayerService::getOMX
01-11 17:29:05.325 22256 22535 I OMXClient: MuxOMX ctor
01-11 17:29:05.328   635  3128 I OMXMaster: makeComponentInstance(OMX.qcom.video.decoder.avc) in mediacodec process
01-11 17:29:05.330   635  3128 I OMX-VDEC-1080P: Video slvp perflock acquired
01-11 17:29:05.331   635  3128 I OMX-VDEC-1080P: component_init: OMX.qcom.video.decoder.avc : fd=8
01-11 17:29:05.344   635  3128 I OMX-VDEC-1080P: omx_vdec::component_init() success : fd=8

// After ~9 seconds we receive abandonAudioFocus and the audio stops
01-11 17:29:34.270  1151  2674 I MediaFocusControl:  AudioFocus  abandonAudioFocus() from uid/pid 10118/22256 clientId=android.media.AudioManager@44f88acorg.chromium.content.browser.AudioFocusDelegate@289c975

Comment 5 by ti...@chromium.org, Jan 17 2017

Cc: -mlamouri@chromium.org boliu@chromium.org
Components: -Internals>Media
I press the back button on the phone while playing.

First, AwContents properly hides the view:

01-16 17:06:23.822 10108 10108 I cr_AwContents: org.chromium.android_webview.AwContents@8f392d2 onWindowVisibilityChanged
01-16 17:06:23.822 10108 10108 I cr_AwContents: org.chromium.android_webview.AwContents$AwViewMethodsImpl@2f9a2a0 AwViewMethodsImpl.onWindowVisibilityChanged
01-16 17:06:23.822 10108 10108 I cr_AwContents: org.chromium.android_webview.AwContents@8f392d2 setWindowVisibilityInternal visible:false
01-16 17:06:23.822 10108 10108 I cr_AwContents: org.chromium.android_webview.AwContents@8f392d2 postUpdateContentViewCoreVisibility
01-16 17:06:23.836 10108 10108 V timav   : [10108/10108] 17:06:23.836 [browser_view_renderer.cc:492] IsClientVisible this:0x74f69b4c60 is_paused:0 attached_to_window_:1 window_visible_: 0 result:0
01-16 17:06:23.836 10108 10108 I cr_AwContents: org.chromium.android_webview.AwContents@8f392d2 updateContentViewCoreVisibility nativeIsVisible:false

Eventually this propagates to the player:

01-16 17:06:23.883 10108 10715 V timav   : [10108/10715] 17:06:23.883 [webmediaplayer_impl.cc:1356] OnHidden this:0x74c5ade800

This OnHidden suspends (and does not destroy) the media pipeline.

But then AwContents receives detach from window and it generates OnShown:

01-16 17:06:24.071 10108 10108 I cr_AwContents: org.chromium.android_webview.AwContents@8f392d2 onDetachedFromWindow
01-16 17:06:24.071 10108 10108 I cr_AwContents: org.chromium.android_webview.AwContents$AwViewMethodsImpl@2f9a2a0 AwViewMethodsImpl.onDetachedFromWindow
01-16 17:06:24.071 10108 10108 I cr_AwContents: org.chromium.android_webview.AwContents@8f392d2 hideAutofillPopup
01-16 17:06:24.077 10108 10284 I DefaultDeliveryClient: Successful submission of 9 events
01-16 17:06:24.086 10108 10108 I cr_AwContents: org.chromium.android_webview.AwContents@8f392d2 postUpdateContentViewCoreVisibility
01-16 17:06:24.087 10108 10284 V DefaultDeliveryClient: Time of attemptDelivery: 391
01-16 17:06:24.102 10108 10108 V timav   : [10108/10108] 17:06:24.102 [browser_view_renderer.cc:492] IsClientVisible this:0x74f69b4c60 is_paused:0 attached_to_window_:0 window_visible_: 0 result:1
01-16 17:06:24.102 10108 10108 I cr_AwContents: org.chromium.android_webview.AwContents@8f392d2 updateContentViewCoreVisibility nativeIsVisible:true

and it propagated to the player again:

01-16 17:06:24.107 10108 10715 V timav   : [10108/10715] 17:06:24.107 [webmediaplayer_impl.cc:1382] OnShown this:0x74c5ade800

This OnShown resumes the pipeline in the background. I suspect the browser_view_renderer wrongly reports the visibility in

IsClientVisible this:0x74f69b4c60 is_paused:0 attached_to_window_:0 window_visible_: 0 result:1

Comment 6 by ti...@chromium.org, Jan 17 2017

https://codereview.chromium.org/1475843004 modified the method IsClientVisible() last time but even before this CL the method would return true.

Comment 7 by boliu@chromium.org, Jan 17 2017

yeah that's expected, there are apps that expect webview to behave correctly when it's detached, which means we can't take window visibility into computing webview visibility if webview is detached

maybe we can do a different heuristic though, if webview is never attached, then it stays visible, but if it ever gets attached, then detaching it will make it invisible

Comment 8 by ti...@chromium.org, Jan 17 2017

Yes, thank you, I was thinking about a state machine -like behavior for visibility.
Project Member

Comment 9 by bugdroid1@chromium.org, Jan 19 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/9288679e3eb12c219b520c6327ac5ab9a7741cb5

commit 9288679e3eb12c219b520c6327ac5ab9a7741cb5
Author: timav <timav@chromium.org>
Date: Thu Jan 19 01:29:12 2017

[android_webview] Do not declare WebView visible on detaching from window.

We have been pretending that WebView is visible for the Blink API
(OnShown/OnHidden) if WebView is not attached to a window. This makes
some operations work in background.

This CL eliminates the case when the WebView is declared visible
upon detach from window. Now the WebView is considered visible if it
has never been attached, but once it is attached, every subsequent
detach sets it invisible.

BUG= 675950 

Review-Url: https://codereview.chromium.org/2637273002
Cr-Commit-Position: refs/heads/master@{#444588}

[modify] https://crrev.com/9288679e3eb12c219b520c6327ac5ab9a7741cb5/android_webview/browser/browser_view_renderer.cc
[modify] https://crrev.com/9288679e3eb12c219b520c6327ac5ab9a7741cb5/android_webview/browser/browser_view_renderer.h
[modify] https://crrev.com/9288679e3eb12c219b520c6327ac5ab9a7741cb5/android_webview/browser/browser_view_renderer_unittest.cc

Comment 10 by ti...@chromium.org, Jan 19 2017

Status: Fixed (was: Assigned)

Sign in to add a comment