diff options
author | Lajos Molnar <lajos@google.com> | 2021-06-28 22:21:17 -0700 |
---|---|---|
committer | Lajos Molnar <lajos@google.com> | 2021-06-28 22:31:07 -0700 |
commit | 0c5a750ca0e4d46b3286e41e1dfca72ae0c31ed3 (patch) | |
tree | b3910c123eea29ecc04c92ffe90c00082bf370e7 | |
parent | 598c5fd593b8f8205f6a88661ce105ad05be6bba (diff) |
media: allow 0 video encoder profiles and levels.
Some of the new encoder profile and level values are 0, so allow them
to be set. StagefrightRecorder already supports 0 values, and MediaRecorderTest
also already tests negative value for failure.
Bug: 192317919
Test: atest android.hardware.camera2.cts.RecordingTest\#testBasicEncoderProfilesRecording
Change-Id: I9d286ee84c004b21830d743ad46804be456f2bc6
-rw-r--r-- | media/java/android/media/MediaRecorder.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java index 1efd4c6846e6..341bb8d5309a 100644 --- a/media/java/android/media/MediaRecorder.java +++ b/media/java/android/media/MediaRecorder.java @@ -840,7 +840,7 @@ public class MediaRecorder implements AudioRouting, setVideoSize(profile.getWidth(), profile.getHeight()); setVideoEncodingBitRate(profile.getBitrate()); setVideoEncoder(profile.getCodec()); - if (profile.getProfile() > 0) { + if (profile.getProfile() >= 0) { setVideoEncodingProfileLevel(profile.getProfile(), 0 /* level */); } } @@ -1121,10 +1121,10 @@ public class MediaRecorder implements AudioRouting, * @throws IllegalArgumentException when an invalid profile or level value is used. */ public void setVideoEncodingProfileLevel(int profile, int level) { - if (profile <= 0) { + if (profile < 0) { throw new IllegalArgumentException("Video encoding profile is not positive"); } - if (level <= 0) { + if (level < 0) { throw new IllegalArgumentException("Video encoding level is not positive"); } setParameter("video-param-encoder-profile=" + profile); |