Android Video: Don't destroy a video texture in the destructor until it's returned.
commit5448f9b40a752355169ed78dc70584d9a6410db0
authordongseong.hwang@intel.com <dongseong.hwang@intel.com@0039d316-1c4b-4281-b951-d872f2087c98>
Tue, 1 Apr 2014 15:21:20 +0000 (1 15:21 +0000)
committerdongseong.hwang@intel.com <dongseong.hwang@intel.com@0039d316-1c4b-4281-b951-d872f2087c98>
Tue, 1 Apr 2014 15:21:20 +0000 (1 15:21 +0000)
treea7eff1668013e8d569fa63816607f03f55f90416
parent5efcce1721748e6d61b8dfbc9b314da24771540c
Android Video: Don't destroy a video texture in the destructor until it's returned.

This CL fixes the bug that WMPA makes the compositor get following gl error.
E/chromium(12686): [12686:12717:0327/005938:110608389551:ERROR:gles2_cmd_decoder.cc(10082)]
[.BrowserCompositor-0x62cdff20]GL ERROR :GL_INVALID_OPERATION : glConsumeTextureCHROMIUM:
invalid mailbox name

Currently, WebMediaPlayerAndroid deletes a texture, even if the texture is
used by the clients. This CL makes "release callback" be able to delete in-display
texture even after WebMediaPlayerAndroid is destructed.

This pattern is very similar that GpuVideoDecoder, accelerated 2d canvas and
WebGL release remained mailboxes. See GpuVideoDecoder.

Major changes:
1. Make StreamTextureFactory ref-counted to use it even after WMPA is destructed.
2. Speaking stream texture, texture_id_ is origin and all VideoFrame objects refer to texture_id_.
When all VideoFrame objects and texture_id_ are deleted, the stream texture is deleted.
3. Delete redundant StreamTextureFactory::DestroyStreamTexture().

Test=Run following tests on Nexus 5.
- http://www.quirksmode.org/html5/tests/video.html for HW Video.
- http://html5demos.com/video-canvas for Accelerated 2D Canvas.
- http://people.mozilla.org/~bjacob/mdn_samples_webgl_sample8/index.html for WebGL.
BUG=350925

Review URL: https://codereview.chromium.org/192813003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260871 0039d316-1c4b-4281-b951-d872f2087c98
content/browser/android/in_process/synchronous_compositor_factory_impl.cc
content/browser/android/in_process/synchronous_compositor_factory_impl.h
content/renderer/android/synchronous_compositor_factory.h
content/renderer/media/android/stream_texture_factory_android.h
content/renderer/media/android/stream_texture_factory_android_impl.cc
content/renderer/media/android/stream_texture_factory_android_impl.h
content/renderer/media/android/stream_texture_factory_android_synchronous_impl.cc
content/renderer/media/android/stream_texture_factory_android_synchronous_impl.h
content/renderer/media/android/webmediaplayer_android.cc
content/renderer/media/android/webmediaplayer_android.h
content/renderer/render_view_impl.cc