Package tvi.webrtc
Class VideoSource
java.lang.Object
tvi.webrtc.MediaSource
tvi.webrtc.VideoSource
Java wrapper of native AndroidVideoTrackSource.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Simple aspect ratio clas for use in constraining output format.Nested classes/interfaces inherited from class tvi.webrtc.MediaSource
MediaSource.State
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
adaptOutputFormat
(int width, int height, int fps) Calling this function will cause frames to be scaled down to the requested resolution.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.void
adaptOutputFormat
(VideoSource.AspectRatio targetLandscapeAspectRatio, Integer maxLandscapePixelCount, VideoSource.AspectRatio targetPortraitAspectRatio, Integer maxPortraitPixelCount, Integer maxFps) Same as above, with even more control as each constraint is optional.void
dispose()
void
setIsScreencast
(boolean isScreencast) void
setVideoProcessor
(VideoProcessor newVideoProcessor) Hook for injecting a custom video processor before frames are passed onto WebRTC.Methods inherited from class tvi.webrtc.MediaSource
getNativeMediaSource, state
-
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
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
-
dispose
public void dispose()- Overrides:
dispose
in classMediaSource
-