flash's SurfaceTexture

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()
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值