Github.com/flutter-web…
Windows
- libwebrtc: RTCVideoRenderer, RTCVideoFrame
- libflutter: TextureRegistrar, PixelBufferTexture
The class diagram
classDiagram
FlutterWebRTCPlugin <|-- FlutterWebRTCPluginImpl
FlutterWebRTCBase <|-- FlutterWebRTC
class FlutterWebRTCBase {
+texture_registrar_
}
FlutterVideoRendererManager <|-- FlutterWebRTC
class FlutterVideoRendererManager {
+base_
+CreateVideoRendererTexture()
+VideoRendererDispose()
}
RTCVideoRenderer <|-- FlutterVideoRenderer
class RTCVideoRenderer {
+OnFrame()
}
class FlutterVideoRenderer {
+frame_
+CopyPixelBuffer()
}
Copy the code
Sequence diagram
- Create & Destroy
sequenceDiagram
par contructor
FlutterWebRTCPluginImpl ->> FlutterWebRTC: make_unique
end
par createVideoRenderer
FlutterWebRTC ->> FlutterVideoRendererManager: CreateVideoRendererTexture
FlutterVideoRendererManager ->> FlutterVideoRenderer: constructor
FlutterVideoRenderer ->>+ PixelBufferTexture: constructor
PixelBufferTexture -->- FlutterVideoRenderer: (PixelBufferTexture)
FlutterVideoRenderer ->> TextureRegistrar: RegisterTexture
end
par videoRendererDispose
FlutterWebRTC ->> FlutterVideoRendererManager: VideoRendererDispose
FlutterVideoRendererManager ->> TextureRegistrar: UnregisterTexture
end
Copy the code
- draw
sequenceDiagram
par onFrame
RTCVideoRenderer ->> FlutterVideoRenderer: onFrame
FlutterVideoRenderer ->> TextureRegistrar: MarkTextureFrameAvailable
TextureRegistrar ->> PixelBufferTexture: CopyBufferCallback
PixelBufferTexture ->> FlutterVideoRenderer: CopyPixelBuffer
FlutterVideoRenderer ->> RTCVideoFrame: ConvertToARGB
end
Copy the code