Add SetIsScreencast method to VideoSource.

Bug: None
Change-Id: Iec0bb066b8100fa1d4bd095f78a0473933d1e30d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/159689
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29785}
This commit is contained in:
Jakob Ivarsson 2019-11-12 17:30:45 +01:00 committed by Commit Bot
parent c1dac38aec
commit c5ec54e51b
4 changed files with 18 additions and 1 deletions

View File

@ -114,6 +114,10 @@ public class VideoSource extends MediaSource {
maxLandscapePixelCount, targetPortraitAspectRatio, maxPortraitPixelCount, maxFps);
}
public void setIsScreencast(boolean isScreencast) {
nativeAndroidVideoTrackSource.setIsScreencast(isScreencast);
}
/**
* 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

View File

@ -72,6 +72,10 @@ class NativeAndroidVideoTrackSource {
targetPortraitAspectRatio.height, maxPortraitPixelCount, maxFps);
}
public void setIsScreencast(boolean isScreencast) {
nativeSetIsScreencast(nativeAndroidVideoTrackSource, isScreencast);
}
@CalledByNative
static VideoProcessor.FrameAdaptationParameters createFrameAdaptationParameters(int cropX,
int cropY, int cropWidth, int cropHeight, int scaleWidth, int scaleHeight, long timestampNs,
@ -80,6 +84,8 @@ class NativeAndroidVideoTrackSource {
cropX, cropY, cropWidth, cropHeight, scaleWidth, scaleHeight, timestampNs, drop);
}
private static native void nativeSetIsScreencast(
long nativeAndroidVideoTrackSource, boolean isScreencast);
private static native void nativeSetState(long nativeAndroidVideoTrackSource, boolean isLive);
private static native void nativeAdaptOutputFormat(long nativeAndroidVideoTrackSource,
int landscapeWidth, int landscapeHeight, @Nullable Integer maxLandscapePixelCount,

View File

@ -86,6 +86,11 @@ bool AndroidVideoTrackSource::remote() const {
return false;
}
void AndroidVideoTrackSource::SetIsScreencast(JNIEnv* env,
jboolean j_is_screencast) {
is_screencast_ = j_is_screencast;
}
ScopedJavaLocalRef<jobject> AndroidVideoTrackSource::AdaptFrame(
JNIEnv* env,
jint j_width,

View File

@ -84,10 +84,12 @@ class AndroidVideoTrackSource : public rtc::AdaptedVideoTrackSource {
const JavaRef<jobject>& j_max_portrait_pixel_count,
const JavaRef<jobject>& j_max_fps);
void SetIsScreencast(JNIEnv* env, jboolean j_is_screencast);
private:
rtc::Thread* signaling_thread_;
std::atomic<SourceState> state_;
const bool is_screencast_;
bool is_screencast_;
rtc::TimestampAligner timestamp_aligner_;
const bool align_timestamps_;
};