EglRenderer

tee3.webrtc

## 类 EglRenderer

- java.lang.Object
- - tee3.webrtc.EglRenderer

- 所有已实现的接口:
    VideoRenderer.Callbacks, VideoSink
  直接已知子类:
    SurfaceEglRenderer

      public class EglRenderer
      extends java.lang.Object
      implements VideoRenderer.Callbacks, VideoSink

  Implements VideoRenderer.Callbacks by displaying the video stream on an EGL Surface. This class is intended to be used as a helper class for rendering on SurfaceViews and TextureViews.

- - ### 嵌套类概要

    嵌套类
    限定符和类型 | 类和说明
    --- | ---
    `static interface` | `EglRenderer.FrameListener`

  - ### 字段概要

    字段
    限定符和类型 | 字段和说明
    --- | ---
    `protected java.lang.String` | `name`

  - ### 构造器概要

    构造器
    构造器和说明
    `EglRenderer(java.lang.String name)` Standard constructor.

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `void` | `addFrameListener(EglRenderer.FrameListener listener, float scale)` Register a callback to be invoked when a new video frame has been received.
    `void` | `addFrameListener(EglRenderer.FrameListener listener, float scale, RendererCommon.GlDrawer drawerParam)` Register a callback to be invoked when a new video frame has been received.
    `void` | `addFrameListener(EglRenderer.FrameListener listener, float scale, RendererCommon.GlDrawer drawerParam, boolean applyFpsReduction)` Register a callback to be invoked when a new video frame has been received.
    `void` | `clearImage()` Post a task to clear the surface to a transparent uniform color.
    `void` | `clearImage(float r, float g, float b, float a)` Post a task to clear the surface to a specific color.
    `void` | `createEglSurface(android.view.Surface surface)`
    `void` | `createEglSurface(android.graphics.SurfaceTexture surfaceTexture)`
    `void` | `disableFpsReduction()`
    `void` | `init(EglBase.Context sharedContext, int[] configAttributes, RendererCommon.GlDrawer drawer)` Initialize this class, sharing resources with |sharedContext|.
    `void` | `invalidDrawFrame(boolean invalid)` fix greenScreen
    `void` | `onFrame(VideoFrame frame)` Implementations should call frame.retain() if they need to hold a reference to the frame after this function returns.
    `void` | `pauseVideo()`
    `void` | `printStackTrace()`
    `void` | `release()` Block until any pending frame is returned and all GL resources released, even if an interrupt occurs.
    `void` | `releaseEglSurface(java.lang.Runnable completionCallback)` Release EGL surface.
    `void` | `removeFrameListener(EglRenderer.FrameListener listener)` Remove any pending callback that was added with addFrameListener.
    `void` | `renderFrame(VideoRenderer.I420Frame frame)`
    `void` | `setFpsReduction(float fps)` Limit render framerate.
    `void` | `setLayoutAspectRatio(float layoutAspectRatio)` Set layout aspect ratio.
    `void` | `setMirror(boolean mirror)` Set if the video stream should be mirrored or not.

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 字段详细资料

    - #### name

          protected final java.lang.String name

  - ### 构造器详细资料

    - #### EglRenderer

          public EglRenderer(java.lang.String name)

      Standard constructor. The name will be used for the render thread name and included when logging. In order to render something, you must first call init() and createEglSurface.

  - ### 方法详细资料

    - #### init

          public void init(@Nullable
                           EglBase.Context sharedContext,
                           int[] configAttributes,
                           RendererCommon.GlDrawer drawer)

      Initialize this class, sharing resources with |sharedContext|. The custom |drawer| will be used for drawing frames on the EGLSurface. This class is responsible for calling release() on |drawer|. It is allowed to call init() to reinitialize the renderer after a previous init()/release() cycle.

    - #### createEglSurface

          public void createEglSurface(android.view.Surface surface)

    - #### createEglSurface

          public void createEglSurface(android.graphics.SurfaceTexture surfaceTexture)

    - #### invalidDrawFrame

          public void invalidDrawFrame(boolean invalid)

      fix greenScreen
      参数:
        `invalid` -

    - #### release

          public void release()

      Block until any pending frame is returned and all GL resources released, even if an interrupt occurs. If an interrupt occurs during release(), the interrupt flag will be set. This function should be called before the Activity is destroyed and the EGLContext is still valid. If you don't call this function, the GL resources might leak.

    - #### printStackTrace

          public void printStackTrace()

    - #### setMirror

          public void setMirror(boolean mirror)

      Set if the video stream should be mirrored or not.

    - #### setLayoutAspectRatio

          public void setLayoutAspectRatio(float layoutAspectRatio)

      Set layout aspect ratio. This is used to crop frames when rendering to avoid stretched video. Set this to 0 to disable cropping.

    - #### setFpsReduction

          public void setFpsReduction(float fps)

      Limit render framerate.
      参数:
        `fps` - Limit render framerate to this value, or use Float.POSITIVE_INFINITY to disable fps reduction.

    - #### disableFpsReduction

          public void disableFpsReduction()

    - #### pauseVideo

          public void pauseVideo()

    - #### addFrameListener

          public void addFrameListener(EglRenderer.FrameListener listener,
                                       float scale)

      Register a callback to be invoked when a new video frame has been received. This version uses the drawer of the EglRenderer that was passed in init.
      参数:
        `listener` - The callback to be invoked. The callback will be invoked on the render thread. It should be lightweight and must not call removeFrameListener.
        `scale` - The scale of the Bitmap passed to the callback, or 0 if no Bitmap is required.

    - #### addFrameListener

          public void addFrameListener(EglRenderer.FrameListener listener,
                                       float scale,
                                       RendererCommon.GlDrawer drawerParam)

      Register a callback to be invoked when a new video frame has been received.
      参数:
        `listener` - The callback to be invoked. The callback will be invoked on the render thread. It should be lightweight and must not call removeFrameListener.
        `scale` - The scale of the Bitmap passed to the callback, or 0 if no Bitmap is required.
        `drawer` - Custom drawer to use for this frame listener or null to use the default one.

    - #### addFrameListener

          public void addFrameListener(EglRenderer.FrameListener listener,
                                       float scale,
                                       @Nullable
                                       RendererCommon.GlDrawer drawerParam,
                                       boolean applyFpsReduction)

      Register a callback to be invoked when a new video frame has been received.
      参数:
        `listener` - The callback to be invoked. The callback will be invoked on the render thread. It should be lightweight and must not call removeFrameListener.
        `scale` - The scale of the Bitmap passed to the callback, or 0 if no Bitmap is required.
        `drawer` - Custom drawer to use for this frame listener or null to use the default one.
        `applyFpsReduction` - This callback will not be called for frames that have been dropped by FPS reduction.

    - #### removeFrameListener

          public void removeFrameListener(EglRenderer.FrameListener listener)

      Remove any pending callback that was added with addFrameListener. If the callback is not in the queue, nothing happens. It is ensured that callback won't be called after this method returns.
      参数:
        `runnable` - The callback to remove.

    - #### renderFrame

          public void renderFrame(VideoRenderer.I420Frame frame)

      指定者:
        `renderFrame` 在接口中 `VideoRenderer.Callbacks`

    - #### onFrame

          public void onFrame(VideoFrame frame)

      从接口复制的说明: `VideoSink`
      Implementations should call frame.retain() if they need to hold a reference to the frame after this function returns. Each call to retain() should be followed by a call to frame.release() when the reference is no longer needed.
      指定者:
        `onFrame` 在接口中 `VideoSink`

    - #### releaseEglSurface

          public void releaseEglSurface(java.lang.Runnable completionCallback)

      Release EGL surface. This function will block until the EGL surface is released.

    - #### clearImage

          public void clearImage()

      Post a task to clear the surface to a transparent uniform color.

    - #### clearImage

          public void clearImage(float r,
                                 float g,
                                 float b,
                                 float a)

      Post a task to clear the surface to a specific color.