12
12
import org .webrtc .EglBase ;
13
13
import org .webrtc .MediaStream ;
14
14
import org .webrtc .RendererCommon .RendererEvents ;
15
- import org .webrtc .SurfaceViewRenderer ;
16
15
import org .webrtc .VideoTrack ;
17
16
18
17
import io .flutter .plugin .common .EventChannel ;
@@ -21,7 +20,6 @@ public class FlutterRTCVideoRenderer implements EventChannel.StreamHandler {
21
20
22
21
private static final String TAG = FlutterWebRTCPlugin .TAG ;
23
22
private final SurfaceTexture texture ;
24
- private final Context context ;
25
23
private int id = -1 ;
26
24
27
25
public void Dispose (){
@@ -98,12 +96,12 @@ public void onFrameResolutionChanged(
98
96
EventChannel eventChannel ;
99
97
EventChannel .EventSink eventSink ;
100
98
101
- public FlutterRTCVideoRenderer (SurfaceTexture texture , Context context ) {
102
- this .surfaceTextureRenderer = new SurfaceTextureRenderer (context , texture );
103
- SurfaceViewRenderer svr = new SurfaceViewRenderer (context );
99
+ public FlutterRTCVideoRenderer (SurfaceTexture texture ) {
100
+ this .surfaceTextureRenderer = new SurfaceTextureRenderer ("" );
101
+ surfaceTextureRenderer .init (EglUtils .getRootEglBaseContext (), rendererEvents );
102
+ surfaceTextureRenderer .surfaceCreated (texture );
104
103
105
104
this .texture = texture ;
106
- this .context = context ;
107
105
this .eventSink = null ;
108
106
}
109
107
@@ -195,8 +193,8 @@ private void tryAddRendererToVideoTrack() {
195
193
}
196
194
197
195
surfaceTextureRenderer .release();
198
- surfaceTextureRenderer = new SurfaceTextureRenderer (context , texture );
199
196
surfaceTextureRenderer .init (sharedContext , rendererEvents );
197
+ surfaceTextureRenderer .surfaceCreated (texture );
200
198
201
199
videoTrack .addSink (surfaceTextureRenderer );
202
200
}
0 commit comments