Require 16x16 alignment when using HardwareVideoEncoder for encoding.
It seems the Android CTS tests only verify that 16x16 aligned resolutions are supported. This change checks the validity of input frame's size when initialing or encoding processes are about to start using H/W MediaCodec. This change has additional APIs to retrieve |requested_resolution_alignment| and |apply_alignment_to_all_simulcast_layers| from JAVA VideoEncoder class and its inherited classes. HardwareVideoEncoder using MediaCodec has values of 16 and true for above variables. Bug: webrtc:13089 Change-Id: I0c4ebf94eb36da29c2e384a3edf85b82e779b7f9 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/229460 Reviewed-by: Sergey Silkin <ssilkin@webrtc.org> Reviewed-by: Åsa Persson <asapersson@webrtc.org> Commit-Queue: Sergey Silkin <ssilkin@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35169}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
3179fb2931
commit
5a79d28eba
@ -258,6 +258,39 @@ public interface VideoEncoder {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Metadata about the Encoder.
|
||||
*/
|
||||
public class EncoderInfo {
|
||||
/**
|
||||
* The width and height of the incoming video frames should be divisible by
|
||||
* |requested_resolution_alignment|
|
||||
*/
|
||||
public final int requestedResolutionAlignment;
|
||||
|
||||
/**
|
||||
* Same as above but if true, each simulcast layer should also be divisible by
|
||||
* |requested_resolution_alignment|.
|
||||
*/
|
||||
public final boolean applyAlignmentToAllSimulcastLayers;
|
||||
|
||||
public EncoderInfo(
|
||||
int requestedResolutionAlignment, boolean applyAlignmentToAllSimulcastLayers) {
|
||||
this.requestedResolutionAlignment = requestedResolutionAlignment;
|
||||
this.applyAlignmentToAllSimulcastLayers = applyAlignmentToAllSimulcastLayers;
|
||||
}
|
||||
|
||||
@CalledByNative("EncoderInfo")
|
||||
public int getRequestedResolutionAlignment() {
|
||||
return requestedResolutionAlignment;
|
||||
}
|
||||
|
||||
@CalledByNative("EncoderInfo")
|
||||
public boolean getApplyAlignmentToAllSimulcastLayers() {
|
||||
return applyAlignmentToAllSimulcastLayers;
|
||||
}
|
||||
}
|
||||
|
||||
public interface Callback {
|
||||
/**
|
||||
* Old encoders assume that the byte buffer held by `frame` is not accessed after the call to
|
||||
@ -343,4 +376,10 @@ public interface VideoEncoder {
|
||||
* called from arbitrary thread.
|
||||
*/
|
||||
@CalledByNative String getImplementationName();
|
||||
|
||||
@CalledByNative
|
||||
default EncoderInfo getEncoderInfo() {
|
||||
return new EncoderInfo(
|
||||
/* requestedResolutionAlignment= */ 1, /* applyAlignmentToAllSimulcastLayers= */ false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user