Search in sources :

Example 1 with GlRectDrawer

use of org.webrtc.GlRectDrawer in project flutter-webrtc by flutter-webrtc.

the class VideoFileRenderer method initVideoEncoder.

private void initVideoEncoder() {
    MediaFormat format = MediaFormat.createVideoFormat(MIME_TYPE, outputFileWidth, outputFileHeight);
    // Set some properties.  Failing to specify some of these can cause the MediaCodec
    // configure() call to throw an unhelpful exception.
    format.setInteger(MediaFormat.KEY_COLOR_FORMAT, MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
    format.setInteger(MediaFormat.KEY_BIT_RATE, 6000000);
    format.setInteger(MediaFormat.KEY_FRAME_RATE, FRAME_RATE);
    format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, IFRAME_INTERVAL);
    // we can use for input and wrap it with a class that handles the EGL work.
    try {
        encoder = MediaCodec.createEncoderByType(MIME_TYPE);
        encoder.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
        renderThreadHandler.post(() -> {
            eglBase = EglBase.create(sharedContext, EglBase.CONFIG_RECORDABLE);
            surface = encoder.createInputSurface();
            eglBase.createSurface(surface);
            eglBase.makeCurrent();
            drawer = new GlRectDrawer();
        });
    } catch (Exception e) {
        Log.wtf(TAG, e);
    }
}
Also used : MediaFormat(android.media.MediaFormat) GlRectDrawer(org.webrtc.GlRectDrawer) IOException(java.io.IOException)

Example 2 with GlRectDrawer

use of org.webrtc.GlRectDrawer in project Signal-Android by signalapp.

the class TextureViewRenderer method init.

public void init(@NonNull EglBase eglBase) {
    if (isInitialized)
        return;
    isInitialized = true;
    this.init(eglBase.getEglBaseContext(), null, EglBase.CONFIG_PLAIN, new GlRectDrawer());
}
Also used : GlRectDrawer(org.webrtc.GlRectDrawer)

Example 3 with GlRectDrawer

use of org.webrtc.GlRectDrawer in project Signal-Android by WhisperSystems.

the class TextureViewRenderer method init.

public void init(@NonNull EglBase eglBase) {
    if (isInitialized)
        return;
    isInitialized = true;
    this.init(eglBase.getEglBaseContext(), null, EglBase.CONFIG_PLAIN, new GlRectDrawer());
}
Also used : GlRectDrawer(org.webrtc.GlRectDrawer)

Example 4 with GlRectDrawer

use of org.webrtc.GlRectDrawer in project Telegram-FOSS by Telegram-FOSS-Team.

the class VoIPFragment method initRenderers.

private void initRenderers() {
    currentUserTextureView.renderer.init(VideoCapturerDevice.getEglBase().getEglBaseContext(), new RendererCommon.RendererEvents() {

        @Override
        public void onFirstFrameRendered() {
            AndroidUtilities.runOnUIThread(() -> updateViewState());
        }

        @Override
        public void onFrameResolutionChanged(int videoWidth, int videoHeight, int rotation) {
        }
    });
    callingUserTextureView.renderer.init(VideoCapturerDevice.getEglBase().getEglBaseContext(), new RendererCommon.RendererEvents() {

        @Override
        public void onFirstFrameRendered() {
            AndroidUtilities.runOnUIThread(() -> updateViewState());
        }

        @Override
        public void onFrameResolutionChanged(int videoWidth, int videoHeight, int rotation) {
        }
    }, EglBase.CONFIG_PLAIN, new GlRectDrawer());
    callingUserMiniTextureRenderer.init(VideoCapturerDevice.getEglBase().getEglBaseContext(), null);
}
Also used : GlRectDrawer(org.webrtc.GlRectDrawer) RendererCommon(org.webrtc.RendererCommon) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint)

Example 5 with GlRectDrawer

use of org.webrtc.GlRectDrawer in project mollyim-android by mollyim.

the class TextureViewRenderer method init.

public void init(@NonNull EglBase eglBase) {
    if (isInitialized)
        return;
    isInitialized = true;
    this.init(eglBase.getEglBaseContext(), null, EglBase.CONFIG_PLAIN, new GlRectDrawer());
}
Also used : GlRectDrawer(org.webrtc.GlRectDrawer)

Aggregations

GlRectDrawer (org.webrtc.GlRectDrawer)5 SuppressLint (android.annotation.SuppressLint)1 Paint (android.graphics.Paint)1 MediaFormat (android.media.MediaFormat)1 IOException (java.io.IOException)1 RendererCommon (org.webrtc.RendererCommon)1