Package org.webrtc
Class VideoSource
java.lang.Object
org.webrtc.MediaSource
org.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 org.webrtc.MediaSource
MediaSource.State
-
Field Summary
Modifier and TypeFieldDescriptionprivate final CapturerObserver
private boolean
private final NativeAndroidVideoTrackSource
private VideoProcessor
private final Object
-
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()
(package private) long
Returns a pointer to webrtc::VideoTrackSourceInterface.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 org.webrtc.MediaSource
getNativeMediaSource, runWithReference, state
-
Field Details
-
nativeAndroidVideoTrackSource
-
videoProcessorLock
-
videoProcessor
-
isCapturerRunning
private boolean isCapturerRunning -
capturerObserver
-
-
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
-
getNativeVideoTrackSource
long getNativeVideoTrackSource()Returns a pointer to webrtc::VideoTrackSourceInterface. -
dispose
public void dispose()- Overrides:
dispose
in classMediaSource
-