Package tvi.webrtc

Class VideoSource

public class VideoSource extends MediaSource
Java wrapper of native AndroidVideoTrackSource.
  • Constructor Details

    • VideoSource

      public VideoSource(long nativeSource)
  • Method Details

    • adaptOutputFormat

      public void adaptOutputFormat(int width, int height, int fps)
      Calling this function will cause frames to be scaled down to the requested resolution. Also, frames will be cropped to match the requested aspect ratio, and frames will be dropped to match the requested fps. The requested aspect ratio is orientation agnostic and will be adjusted to maintain the input orientation, so it doesn't matter if e.g. 1280x720 or 720x1280 is requested.
    • adaptOutputFormat

      public void adaptOutputFormat(int landscapeWidth, int landscapeHeight, int portraitWidth, int portraitHeight, int fps)
      Same as above, but allows setting two different target resolutions depending on incoming frame orientation. This gives more fine-grained control and can e.g. be used to force landscape video to be cropped to portrait video.
    • adaptOutputFormat

      public void adaptOutputFormat(VideoSource.AspectRatio targetLandscapeAspectRatio, @Nullable Integer maxLandscapePixelCount, VideoSource.AspectRatio targetPortraitAspectRatio, @Nullable Integer maxPortraitPixelCount, @Nullable Integer maxFps)
      Same as above, with even more control as each constraint is optional.
    • setIsScreencast

      public void setIsScreencast(boolean isScreencast)
    • setVideoProcessor

      public void setVideoProcessor(@Nullable VideoProcessor newVideoProcessor)
      Hook for injecting a custom video processor before frames are passed onto WebRTC. The frames will be cropped and scaled depending on CPU and network conditions before they are passed to the video processor. Frames will be delivered to the video processor on the same thread they are passed to this object. The video processor is allowed to deliver the processed frames back on any thread.
    • getCapturerObserver

      public CapturerObserver getCapturerObserver()
    • dispose

      public void dispose()
      dispose in class MediaSource