|
|
Created:
6 years, 3 months ago by boliu Modified:
6 years, 3 months ago Reviewers:
whywhat, qinmin, ycheo (away) CC:
chromium-reviews, posciak+watch_chromium.org, avayvod+watch_chromium.org, jam, mcasas+watch_chromium.org, feature-media-reviews_chromium.org, darin-cc_chromium.org, wjia+watch_chromium.org, Ignacio Solla Base URL:
https://chromium.googlesource.com/chromium/src.git@master Project:
chromium Visibility:
Public. |
DescriptionClean up WebMediaPlayerAndroid needs_establish_peer_
needs_establish_peer_ has been used to skip actual estalishing a surface
texture peer based on many conditions. Not all places that modify
actually checks all these conditions so there are bound to be some bugs.
This CL aims to tease out all these different conditions and put them in
a single function EstablishSurfaceTexturePeerIfNeeded. This function
should be called any time these conditions are changed. Makes for much
saner reading.
BUG=412578
Committed: https://crrev.com/701cb640efb326aa107b5b0c25dcf91766fe765f
Cr-Commit-Position: refs/heads/master@{#294068}
Patch Set 1 #
Total comments: 12
Patch Set 2 : rebase #Patch Set 3 : review #Patch Set 4 : OnConnectedToRemoteDevice #
Total comments: 4
Patch Set 5 : remove unset is_playing_ in OnPlaybackComplete #Patch Set 6 : needs_establish_peer_ #
Total comments: 2
Patch Set 7 : nits #
Created: 6 years, 3 months ago
Messages
Total messages: 28 (6 generated)
boliu@chromium.org changed reviewers: + avayvod@chromium.org, qinmin@chromium.org, ycheo@chromium.org
PTAL Clean up of this class is waaaaaayyyyy overdue.
cc+ igsolla
LGTM. Thanks for handling this. BTW, I'll update the test result 2 days later, since Korea is thanks-giving holiday by Wednesday.
https://codereview.chromium.org/557593002/diff/1/content/renderer/media/andro... File content/renderer/media/android/webmediaplayer_android.cc (right): https://codereview.chromium.org/557593002/diff/1/content/renderer/media/andro... content/renderer/media/android/webmediaplayer_android.cc:166: needs_external_surface_ = true; why set this to true? if the video is not EME, no external surface is needed. As mentioned by the comments above, it is not determined whether a stream texture is needed or not. https://codereview.chromium.org/557593002/diff/1/content/renderer/media/andro... content/renderer/media/android/webmediaplayer_android.cc:825: // EstablishSurfaceTexturePeerIfNeeded() will not get called. As a result, the when play is called, isn't updatePlayingState() always call into EstablishSurfaceTexturePeerIfNeeded()? https://codereview.chromium.org/557593002/diff/1/content/renderer/media/andro... content/renderer/media/android/webmediaplayer_android.cc:882: peer_established_ = false; Sorry, I was confused with this call and the FullscreenController::DidEnterFullscreen() earlier. your change will cause racing issue. If EnterFullscreen() is called and we don't set peer_established_, then later on a play() call will find that it should establish the surface texture peer. So now the fullscreen surface will compete with the surface texture in the browser process to bind to the media player. https://codereview.chromium.org/557593002/diff/1/content/renderer/media/andro... content/renderer/media/android/webmediaplayer_android.cc:886: // |needs_external_surface_| is always false on non-TV devices. why removing the if statement? And why not removing the comment? https://codereview.chromium.org/557593002/diff/1/content/renderer/media/andro... content/renderer/media/android/webmediaplayer_android.cc:1224: if (stream_texture_proxy_) { why we remove the if condition? if we use external surface, we don't need to create stream texture for now https://codereview.chromium.org/557593002/diff/1/content/renderer/media/andro... content/renderer/media/android/webmediaplayer_android.cc:1264: EstablishSurfaceTexturePeerIfNeeded(); UpdatePlayingState() can be called by 4 different functions, and only play() actually requires the surface texture to be established. So why not simply put it in play()?
The changes we made during our pair programming session is the diff between PS2 and PS3. https://codereview.chromium.org/557593002/diff/1/content/renderer/media/andro... File content/renderer/media/android/webmediaplayer_android.cc (right): https://codereview.chromium.org/557593002/diff/1/content/renderer/media/andro... content/renderer/media/android/webmediaplayer_android.cc:166: needs_external_surface_ = true; On 2014/09/09 06:39:18, qinmin wrote: > why set this to true? if the video is not EME, no external surface is needed. > As mentioned by the comments above, it is not determined whether a stream > texture is needed or not. Done. https://codereview.chromium.org/557593002/diff/1/content/renderer/media/andro... content/renderer/media/android/webmediaplayer_android.cc:825: // EstablishSurfaceTexturePeerIfNeeded() will not get called. As a result, the On 2014/09/09 06:39:18, qinmin wrote: > when play is called, isn't updatePlayingState() always call into > EstablishSurfaceTexturePeerIfNeeded()? Done. https://codereview.chromium.org/557593002/diff/1/content/renderer/media/andro... content/renderer/media/android/webmediaplayer_android.cc:882: peer_established_ = false; On 2014/09/09 06:39:18, qinmin wrote: > Sorry, I was confused with this call and the > FullscreenController::DidEnterFullscreen() earlier. > > your change will cause racing issue. If EnterFullscreen() is called and we don't > set peer_established_, then later on a play() call will find that it should > establish the surface texture peer. So now the fullscreen surface will compete > with the surface texture in the browser process to bind to the media player. Done. https://codereview.chromium.org/557593002/diff/1/content/renderer/media/andro... content/renderer/media/android/webmediaplayer_android.cc:886: // |needs_external_surface_| is always false on non-TV devices. On 2014/09/09 06:39:18, qinmin wrote: > why removing the if statement? And why not removing the comment? Done. https://codereview.chromium.org/557593002/diff/1/content/renderer/media/andro... content/renderer/media/android/webmediaplayer_android.cc:1224: if (stream_texture_proxy_) { On 2014/09/09 06:39:18, qinmin wrote: > why we remove the if condition? if we use external surface, we don't need to > create stream texture for now Done. https://codereview.chromium.org/557593002/diff/1/content/renderer/media/andro... content/renderer/media/android/webmediaplayer_android.cc:1264: EstablishSurfaceTexturePeerIfNeeded(); On 2014/09/09 06:39:18, qinmin wrote: > UpdatePlayingState() can be called by 4 different functions, and only play() > actually requires the surface texture to be established. So why not simply put > it in play()? Because contract is any states change should lead to calling EstablishSurfaceTexturePeerIfNeeded. So I also put it in enterFullScreen.
then why not OnDidExitFullscreen()? > Because contract is any states change should lead to calling > EstablishSurfaceTexturePeerIfNeeded. So I also put it in enterFullScreen.
sorry, i mean OnConnectedToRemoteDevice() On 2014/09/09 21:34:22, qinmin wrote: > then why not OnDidExitFullscreen()? > > > Because contract is any states change should lead to calling > > EstablishSurfaceTexturePeerIfNeeded. So I also put it in enterFullScreen.
On 2014/09/09 21:35:54, qinmin wrote: > sorry, i mean OnConnectedToRemoteDevice() > > On 2014/09/09 21:34:22, qinmin wrote: > > then why not OnDidExitFullscreen()? > > > > > Because contract is any states change should lead to calling > > > EstablishSurfaceTexturePeerIfNeeded. So I also put it in enterFullScreen. That's a mistake. Added. Let me know if you find more. The only exception I think are Release where it only unsets peer_established_, but doesn't immdiately want to re-establish. Those have comments already.
On 2014/09/09 21:37:32, boliu wrote: > On 2014/09/09 21:35:54, qinmin wrote: > > sorry, i mean OnConnectedToRemoteDevice() > > > > On 2014/09/09 21:34:22, qinmin wrote: > > > then why not OnDidExitFullscreen()? > > > > > > > Because contract is any states change should lead to calling > > > > EstablishSurfaceTexturePeerIfNeeded. So I also put it in enterFullScreen. > > That's a mistake. Added. Let me know if you find more. > > The only exception I think are Release where it only unsets peer_established_, > but doesn't immdiately want to re-establish. Those have comments already. what about OnPlaybackComplete()
On 2014/09/09 21:38:40, qinmin wrote: > On 2014/09/09 21:37:32, boliu wrote: > > On 2014/09/09 21:35:54, qinmin wrote: > > > sorry, i mean OnConnectedToRemoteDevice() > > > > > > On 2014/09/09 21:34:22, qinmin wrote: > > > > then why not OnDidExitFullscreen()? > > > > > > > > > Because contract is any states change should lead to calling > > > > > EstablishSurfaceTexturePeerIfNeeded. So I also put it in > enterFullScreen. > > > > That's a mistake. Added. Let me know if you find more. > > > > The only exception I think are Release where it only unsets peer_established_, > > but doesn't immdiately want to re-establish. Those have comments already. > > what about OnPlaybackComplete() Can it call UpdatePlayingState(false)?
On 2014/09/09 21:42:03, boliu wrote: > On 2014/09/09 21:38:40, qinmin wrote: > > On 2014/09/09 21:37:32, boliu wrote: > > > On 2014/09/09 21:35:54, qinmin wrote: > > > > sorry, i mean OnConnectedToRemoteDevice() > > > > > > > > On 2014/09/09 21:34:22, qinmin wrote: > > > > > then why not OnDidExitFullscreen()? > > > > > > > > > > > Because contract is any states change should lead to calling > > > > > > EstablishSurfaceTexturePeerIfNeeded. So I also put it in > > enterFullScreen. > > > > > > That's a mistake. Added. Let me know if you find more. > > > > > > The only exception I think are Release where it only unsets > peer_established_, > > > but doesn't immdiately want to re-establish. Those have comments already. > > > > what about OnPlaybackComplete() > > Can it call UpdatePlayingState(false)? Removed it as discussed
https://codereview.chromium.org/557593002/diff/60001/content/renderer/media/a... File content/renderer/media/android/webmediaplayer_android.h (right): https://codereview.chromium.org/557593002/diff/60001/content/renderer/media/a... content/renderer/media/android/webmediaplayer_android.h:270: // conditions chances and it is ok to establish peer. s/chances/change/ https://codereview.chromium.org/557593002/diff/60001/content/renderer/media/a... content/renderer/media/android/webmediaplayer_android.h:408: bool peer_established_; this is a poor variable name, we never know whether peer is established or not. When we set this to true, we just send an IPC, and no idea whether browser side will establish the peer or not. And the comments on the variable is not fixed.
https://codereview.chromium.org/557593002/diff/60001/content/renderer/media/a... File content/renderer/media/android/webmediaplayer_android.h (right): https://codereview.chromium.org/557593002/diff/60001/content/renderer/media/a... content/renderer/media/android/webmediaplayer_android.h:270: // conditions chances and it is ok to establish peer. On 2014/09/09 22:13:41, qinmin wrote: > s/chances/change/ Done. https://codereview.chromium.org/557593002/diff/60001/content/renderer/media/a... content/renderer/media/android/webmediaplayer_android.h:408: bool peer_established_; On 2014/09/09 22:13:41, qinmin wrote: > this is a poor variable name, we never know whether peer is established or not. > When we set this to true, we just send an IPC, and no idea whether browser side > will establish the peer or not. And the comments on the variable is not fixed. Renamed it back to needs_establish_peer_ as I can't think of a better name. Which means every single condition is inverted. Added more comment on how this should be used.
lgtm % nits https://codereview.chromium.org/557593002/diff/100001/content/renderer/media/... File content/renderer/media/android/webmediaplayer_android.h (right): https://codereview.chromium.org/557593002/diff/100001/content/renderer/media/... content/renderer/media/android/webmediaplayer_android.h:408: // This should be unset in EstablishSurfaceTexturePeerIfNeeded only, and set nit:s/EstablishSurfaceTexturePeerIfNeeded/EstablishSurfaceTexturePeerIfNeeded()/ https://codereview.chromium.org/557593002/diff/100001/content/renderer/media/... content/renderer/media/android/webmediaplayer_android.h:414: // This is a helper state used in EstablishSurfaceTexturePeerIfNeeded. nit:s/EstablishSurfaceTexturePeerIfNeeded/EstablishSurfaceTexturePeerIfNeeded()/
The CQ bit was checked by boliu@chromium.org
The CQ bit was unchecked by boliu@chromium.org
nits fixed, submitting Thanks for the review, pair programming, and heated debates :p
The CQ bit was checked by boliu@chromium.org
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/boliu@chromium.org/557593002/120001
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: win_gpu_triggered_tests on tryserver.chromium.gpu (http://build.chromium.org/p/tryserver.chromium.gpu/builders/win_gpu_triggered...)
The CQ bit was checked by boliu@chromium.org
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/boliu@chromium.org/557593002/120001
Message was sent while issue was closed.
Committed patchset #7 (id:120001) as 55362f76228fb9fce2019b4cfbd042b1636014d5
Message was sent while issue was closed.
Patchset 7 (id:??) landed as https://crrev.com/701cb640efb326aa107b5b0c25dcf91766fe765f Cr-Commit-Position: refs/heads/master@{#294068}
Message was sent while issue was closed.
A revert of this CL (patchset #7 id:120001) has been created in https://codereview.chromium.org/562803002/ by boliu@chromium.org. The reason for reverting is: Suspected to break tough_video_cases. See crbug.com/412897 for details. BUG=412897.
Message was sent while issue was closed.
On 2014/09/11 00:23:09, boliu wrote: > A revert of this CL (patchset #7 id:120001) has been created in > https://codereview.chromium.org/562803002/ by mailto:boliu@chromium.org. > > The reason for reverting is: Suspected to break tough_video_cases. See > crbug.com/412897 for details. > > BUG=412897. FYI, it's OK that playing MSE and MSE/EME videos in WebView. |