Add checks to HW codecs to ensure unsupported features are not used.
Add checks to ensure encoder is not used below API level 19. Removes global @TargetApi from MediaCodecUtils since it is also used by the decoder. Ensures that texture mode is never enabled below API level 18. Bug: webrtc:9821 Change-Id: I2ca1014bf8995719c970eb1449b0acbf7b3c883e Reviewed-on: https://webrtc-review.googlesource.com/c/103701 Reviewed-by: Paulina Hensman <phensman@webrtc.org> Commit-Queue: Sami Kalliomäki <sakal@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24990}
This commit is contained in:

committed by
Commit Bot

parent
24ee167a3d
commit
d5806b289f
@ -64,6 +64,11 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
|
||||
@Nullable
|
||||
@Override
|
||||
public VideoEncoder createEncoder(VideoCodecInfo input) {
|
||||
// HW encoding is not supported below Android Kitkat.
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
return null;
|
||||
}
|
||||
|
||||
VideoCodecType type = VideoCodecType.valueOf(input.name);
|
||||
MediaCodecInfo info = findCodecForType(type);
|
||||
|
||||
@ -100,6 +105,11 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
|
||||
|
||||
@Override
|
||||
public VideoCodecInfo[] getSupportedCodecs() {
|
||||
// HW encoding is not supported below Android Kitkat.
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
return new VideoCodecInfo[0];
|
||||
}
|
||||
|
||||
List<VideoCodecInfo> supportedCodecInfos = new ArrayList<VideoCodecInfo>();
|
||||
// Generate a list of supported codecs in order of preference:
|
||||
// VP8, VP9, H264 (high profile), and H264 (baseline profile).
|
||||
|
Reference in New Issue
Block a user