Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: webrtc/sdk/android/api/org/webrtc/HardwareVideoEncoderFactory.java

Issue 2977153003: Add texture support to HardwareVideoEncoder. (Closed)
Patch Set: Fix logging and matrix helper Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/sdk/android/api/org/webrtc/RendererCommon.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/sdk/android/api/org/webrtc/HardwareVideoEncoderFactory.java
diff --git a/webrtc/sdk/android/api/org/webrtc/HardwareVideoEncoderFactory.java b/webrtc/sdk/android/api/org/webrtc/HardwareVideoEncoderFactory.java
index 9b904431b567e352740ae76b8ffa25c83bd26857..ea84bc4335bc0bb11510c1e40e9cb3da0d369bbb 100644
--- a/webrtc/sdk/android/api/org/webrtc/HardwareVideoEncoderFactory.java
+++ b/webrtc/sdk/android/api/org/webrtc/HardwareVideoEncoderFactory.java
@@ -55,14 +55,28 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
private static final String H264_CONSTRAINED_HIGH_3_1 =
H264_PROFILE_CONSTRAINED_HIGH + H264_LEVEL_3_1;
+ private final EglBase14.Context sharedContext;
private final boolean enableIntelVp8Encoder;
private final boolean enableH264HighProfile;
- public HardwareVideoEncoderFactory(boolean enableIntelVp8Encoder, boolean enableH264HighProfile) {
+ public HardwareVideoEncoderFactory(
+ EglBase.Context sharedContext, boolean enableIntelVp8Encoder, boolean enableH264HighProfile) {
+ // Texture mode requires EglBase14.
+ if (sharedContext instanceof EglBase14.Context) {
+ this.sharedContext = (EglBase14.Context) sharedContext;
+ } else {
+ Logging.w(TAG, "No shared EglBase.Context. Encoders will not use texture mode.");
+ this.sharedContext = null;
+ }
this.enableIntelVp8Encoder = enableIntelVp8Encoder;
this.enableH264HighProfile = enableH264HighProfile;
}
+ @Deprecated
+ public HardwareVideoEncoderFactory(boolean enableIntelVp8Encoder, boolean enableH264HighProfile) {
+ this(null, enableIntelVp8Encoder, enableH264HighProfile);
+ }
+
@Override
public VideoEncoder createEncoder(VideoCodecInfo input) {
VideoCodecType type = VideoCodecType.valueOf(input.name);
@@ -74,11 +88,14 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
String codecName = info.getName();
String mime = type.mimeType();
- int colorFormat = MediaCodecUtils.selectColorFormat(
- MediaCodecUtils.ENCODER_COLOR_FORMATS, info.getCapabilitiesForType(mime));
+ int colorFormat = MediaCodecUtils.selectColorFormat(sharedContext == null
+ ? MediaCodecUtils.ENCODER_COLOR_FORMATS
+ : MediaCodecUtils.TEXTURE_COLOR_FORMATS,
+ info.getCapabilitiesForType(mime));
return new HardwareVideoEncoder(codecName, type, colorFormat, getKeyFrameIntervalSec(type),
- getForcedKeyFrameIntervalMs(type, codecName), createBitrateAdjuster(type, codecName));
+ getForcedKeyFrameIntervalMs(type, codecName), createBitrateAdjuster(type, codecName),
+ sharedContext);
}
@Override
@@ -127,8 +144,10 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
return false;
}
// Check for a supported color format.
- if (MediaCodecUtils.selectColorFormat(
- MediaCodecUtils.ENCODER_COLOR_FORMATS, info.getCapabilitiesForType(type.mimeType()))
+ if (MediaCodecUtils.selectColorFormat(sharedContext == null
+ ? MediaCodecUtils.ENCODER_COLOR_FORMATS
+ : MediaCodecUtils.TEXTURE_COLOR_FORMATS,
+ info.getCapabilitiesForType(type.mimeType()))
== null) {
return false;
}
« no previous file with comments | « no previous file | webrtc/sdk/android/api/org/webrtc/RendererCommon.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698