forked from androidx/media
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 16 KB page support for decoder extensions on Android 15
We need to rebuild any native components of the app to prevent crashes on devices with 16 KB page support. Tested on a device that supports 16 KB pages and runs Android 15, as well as on older Android devices. Issue: androidx#1685 PiperOrigin-RevId: 684488244
- Loading branch information
1 parent
b676ac3
commit 73cf33a
Showing
14 changed files
with
176 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// Copyright 2024 The Android Open Source Project | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
apply from: "$gradle.ext.androidxMediaSettingsDir/common_library_config.gradle" | ||
|
||
android { | ||
namespace 'androidx.media3.decoder.iamf' | ||
|
||
sourceSets { | ||
androidTest.assets.srcDir '../test_data/src/test/assets' | ||
} | ||
|
||
defaultConfig { | ||
externalNativeBuild { | ||
cmake { | ||
targets "iamfJNI" | ||
} | ||
} | ||
} | ||
|
||
// TODO(Internal: b/372449691): Remove packagingOptions once AGP is updated | ||
// to version 8.5.1 or higher. | ||
packagingOptions { | ||
jniLibs { | ||
useLegacyPackaging true | ||
} | ||
} | ||
} | ||
|
||
// Configure the native build only if libiamf is present to avoid gradle sync | ||
// failures if libiamf hasn't been built according to the README instructions. | ||
if (project.file('src/main/jni/libiamf').exists()) { | ||
android.externalNativeBuild.cmake { | ||
path = 'src/main/jni/CMakeLists.txt' | ||
version = '3.21.0+' | ||
if (project.hasProperty('externalNativeBuildDir')) { | ||
if (!new File(externalNativeBuildDir).isAbsolute()) { | ||
ext.externalNativeBuildDir = | ||
new File(rootDir, it.externalNativeBuildDir) | ||
} | ||
buildStagingDirectory = "${externalNativeBuildDir}/${project.name}" | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation project(modulePrefix + 'lib-decoder') | ||
// TODO(b/203752526): Remove this dependency. | ||
implementation project(modulePrefix + 'lib-exoplayer') | ||
implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion | ||
compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion | ||
testImplementation project(modulePrefix + 'test-utils') | ||
testImplementation 'org.robolectric:robolectric:' + robolectricVersion | ||
androidTestImplementation project(modulePrefix + 'test-utils') | ||
androidTestImplementation 'androidx.test:runner:' + androidxTestRunnerVersion | ||
androidTestImplementation 'androidx.test.ext:junit:' + androidxTestJUnitVersion | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# | ||
# Copyright 2024 The Android Open Source Project | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
cmake_minimum_required(VERSION 3.21.0 FATAL_ERROR) | ||
|
||
# Enable C++11 features. | ||
set(CMAKE_CXX_STANDARD 11) | ||
|
||
# Define project name for your JNI module | ||
project(libiamfJNI C CXX) | ||
|
||
set(libiamf_jni_root "${CMAKE_CURRENT_SOURCE_DIR}") | ||
|
||
# Build libiamf. | ||
add_subdirectory("${libiamf_jni_root}/libiamf/code" | ||
EXCLUDE_FROM_ALL) | ||
|
||
# Add the include directory from libiamf. | ||
include_directories ("${libiamf_jni_root}/libiamf/code/include") | ||
|
||
# Build libiamfJNI. | ||
add_library(iamfJNI | ||
SHARED | ||
iamf_jni.cc) | ||
|
||
# Locate NDK log library. | ||
find_library(android_log_lib log) | ||
|
||
# Link libgav1JNI against used libraries. | ||
target_link_libraries(iamfJNI | ||
PRIVATE android | ||
PRIVATE iamf | ||
PRIVATE ${android_log_lib}) | ||
|
||
# Enable 16 KB ELF alignment. | ||
target_link_options(iamfJNI | ||
PRIVATE "-Wl,-z,max-page-size=16384") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters