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}
diff --git a/sdk/android/api/org/webrtc/VideoSource.java b/sdk/android/api/org/webrtc/VideoSource.java
index 1b40231..6c528fd 100644
--- a/sdk/android/api/org/webrtc/VideoSource.java
+++ b/sdk/android/api/org/webrtc/VideoSource.java
@@ -114,6 +114,10 @@
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
diff --git a/sdk/android/src/java/org/webrtc/NativeAndroidVideoTrackSource.java b/sdk/android/src/java/org/webrtc/NativeAndroidVideoTrackSource.java
index 48690fb..cdc9b53 100644
--- a/sdk/android/src/java/org/webrtc/NativeAndroidVideoTrackSource.java
+++ b/sdk/android/src/java/org/webrtc/NativeAndroidVideoTrackSource.java
@@ -72,6 +72,10 @@
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 @@
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,
diff --git a/sdk/android/src/jni/android_video_track_source.cc b/sdk/android/src/jni/android_video_track_source.cc
index df0f722..b9e0562 100644
--- a/sdk/android/src/jni/android_video_track_source.cc
+++ b/sdk/android/src/jni/android_video_track_source.cc
@@ -86,6 +86,11 @@
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,
diff --git a/sdk/android/src/jni/android_video_track_source.h b/sdk/android/src/jni/android_video_track_source.h
index d272275..6fcf5cd 100644
--- a/sdk/android/src/jni/android_video_track_source.h
+++ b/sdk/android/src/jni/android_video_track_source.h
@@ -84,10 +84,12 @@
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_;
};