现在的位置: 首页 > 综合 > 正文

flash’s SurfaceTexture

2014年02月20日 ⁄ 综合 ⁄ 共 2362字 ⁄ 字号 评论关闭

original, how webview go?
1. generate a MediaLayer with webview.
2. MediaLayer has a MediaTexture.
in MediaLayer generate a MediaTexture with webview.
3. MediaTexture has a TextureWrapper
(TextureWrapper has SurfaceTexture,ANativeWindow,MediaListener)
in TextureWrapper use webview to generate a MediaListener

how could flash push data to mediaLayer?
1.MediaLayer call MediaTexture's creatureTexture.
in this, create a new Wrapper
wrapper->surfaceTexture , SurfaceTexture(server proxy)
wrapper->nativeWindow, SurfaceTextureClient(so, native is a surface, it'll call the proxy's method if it want to draw)
we own the nativewindow to m_newWindow.
2. whene flash call anp_acquireNativeWindow, we call medialayer's acquireNativeWindowForVideo
Medialayer call MediaTexture's requestNativeWindowForVideo, and return the window.
3. so flash will use the nativewindow(surfacetextureclient)

how flash be the listener
MediaListener, it's will call it's callback function in it's onFrameAvailable.
1.0flash call anp_setFramerateCallback, set the layer's listener.
1.1MediaLayer will set the listener to MediaTexture
1.2MediaTexture will set listener to the wrapper's MediaListener.
2. wrapper's listener is created with nativeWindow","surfaceTexture"
so it'll call it's callback when it's onFrameAvailable is called.
and it is set as surfaceTexture's FrameAvailableListener.

how will wrapper's native window's change will be notified to wrapper's medialistener.
because medialistener was created with wrapper's native window.

how frame available will be passed from SurfaceTextureClient to Server
1.SurfaceTexture watch surface, and OPENGL etc watch SurfaceTexture
SurfaceTexture'queueBuffer->listener's onFrameAvailable
so it will call flash's onFrameAvailable.
2. flash get onFrameAvailable and call MediaLayer's drawGL
(it will call MediaTexture's draw)

process
1.flash fill the anative window, (that's the wrapper's nativewindow)
2.wrapper's mediaListener's onFrameAvailable will be called.
3.flash's FramerateCallbackProc will receive the message
4.flash will call mediaLayer's drawLayer
5.MediaLayer's will do the draw (in MediaTexture, and with opengl)
video->surfaceTexture->updateTexImage()
and m_contentTexture->surfaceTexture->updateTexImage()

what does video's surfacetexture and content's surfacetexture do with webview?
and how will the frame be drawn in the webview? 
1.MediaListen was also created with webview. so it will call webview's postInvalidate 
in onFrameAvailable (ahead of calling flash's FramerateCallbackProc).
(but still has nothing to do with webview)

when could be waiting
1.MediaLayer.acquireNativeWindowForVideo->MediaTexturer.equestNativeWindowForVideo()

抱歉!评论已关闭.