Skip to content

Exception handling for profileIdc_100 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions example/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
compileSdkVersion 27
buildToolsVersion "29.0.0"
aaptOptions {
cruncherEnabled = false
}

defaultConfig {
applicationId "net.ypresto.androidtranscoder.example"
minSdkVersion 18
targetSdkVersion 19
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"
}
Expand Down
8 changes: 4 additions & 4 deletions lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ apply plugin: 'com.android.library'
apply plugin: 'bintray-release'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
compileSdkVersion 27
buildToolsVersion "29.0.0"

defaultConfig {
minSdkVersion 18
targetSdkVersion 21
minSdkVersion 19
targetSdkVersion 29
}

buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
class MediaFormatValidator {
// Refer: http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Profiles
private static final byte PROFILE_IDC_BASELINE = 66;
private static final byte PROFILE_IDC_HI = 100;

public static void validateVideoOutputFormat(MediaFormat format) {
String mime = format.getString(MediaFormat.KEY_MIME);
Expand All @@ -36,7 +37,7 @@ public static void validateVideoOutputFormat(MediaFormat format) {
}
ByteBuffer spsBuffer = AvcCsdUtils.getSpsBuffer(format);
byte profileIdc = AvcSpsUtils.getProfileIdc(spsBuffer);
if (profileIdc != PROFILE_IDC_BASELINE) {
if (profileIdc != PROFILE_IDC_BASELINE && profileIdc != PROFILE_IDC_HI) {
throw new InvalidOutputFormatException("Non-baseline AVC video profile is not supported by Android OS, actual profile_idc: " + profileIdc);
}
}
Expand Down