### Install APK Source: https://github.com/platform/frameworks/av/blob/main/media/tests/SampleVideoEncoder/README.md Install the application on a connected device. ```bash adb install SampleVideoEncoder.apk ``` -------------------------------- ### Launch Application Source: https://github.com/platform/frameworks/av/blob/main/media/tests/SampleVideoEncoder/README.md Start the application using the ADB shell. ```bash adb shell am start -n "com.android.media.samplevideoencoder/com.android.media.samplevideoencoder.MainActivity" ``` -------------------------------- ### Install 64-bit Benchmark APK Source: https://github.com/platform/frameworks/av/blob/main/media/tests/benchmark/README.md Install the 64-bit Benchmark application APK onto the device. The -f flag allows a file system update, and -r re-installs the app if already present. ```bash adb install -f -r $OUT/testcases/MediaBenchmarkTest/arm64/MediaBenchmarkTest.apk ``` -------------------------------- ### Install 32-bit Benchmark APK Source: https://github.com/platform/frameworks/av/blob/main/media/tests/benchmark/README.md Install the 32-bit Benchmark application APK onto the device. The -f flag allows a file system update, and -r re-installs the app if already present. ```bash adb install -f -r $OUT/testcases/MediaBenchmarkTest/arm/MediaBenchmarkTest.apk ``` -------------------------------- ### Create and Configure AImageReader Source: https://context7.com/platform/frameworks/llms.txt Initializes an AImageReader with specified dimensions, format, and buffer size. Sets up the image available callback and retrieves the native window for output. Handles potential creation and listener setup errors. ```c int createImageReader(ImageReaderContext *ctx, int width, int height, int format) { ctx->width = width; ctx->height = height; ctx->imageCount = 0; // Create image reader // maxImages determines the buffer pool size media_status_t status = AImageReader_new( width, height, format, 4, // maxImages - allow up to 4 images in flight &ctx->reader); if (status != AMEDIA_OK) { printf("Failed to create image reader: %d\n", status); return -1; } // Set image available callback AImageReader_ImageListener listener = { .context = ctx, .onImageAvailable = onImageAvailable }; status = AImageReader_setImageListener(ctx->reader, &listener); if (status != AMEDIA_OK) { printf("Failed to set listener: %d\n", status); AImageReader_delete(ctx->reader); return -1; } // Get the native window to pass to camera or decoder ANativeWindow *window; status = AImageReader_getWindow(ctx->reader, &window); if (status != AMEDIA_OK) { printf("Failed to get window: %d\n", status); AImageReader_delete(ctx->reader); return -1; } printf("ImageReader created: %dx%d, format=%d\n", width, height, format); printf(" Window: %p\n", window); return 0; } ``` -------------------------------- ### Push 64-bit NDK Binaries Source: https://github.com/platform/frameworks/av/blob/main/media/tests/benchmark/README.md Push the compiled 64-bit NDK test binaries from the build output directory to the device's /data/local/tmp/ directory. This example pushes the extractorTest binary. ```bash adb push $OUT/data/nativetest64/extractorTest/extractorTest /data/local/tmp/ ``` -------------------------------- ### Push 32-bit NDK Binaries Source: https://github.com/platform/frameworks/av/blob/main/media/tests/benchmark/README.md Push the compiled 32-bit NDK test binaries from the build output directory to the device's /data/local/tmp/ directory. This example pushes the extractorTest binary. ```bash adb push $OUT/data/nativetest/extractorTest/extractorTest /data/local/tmp/ ``` -------------------------------- ### Run All Benchmark Tests with atest Source: https://github.com/platform/frameworks/av/blob/main/media/tests/benchmark/README.md Use the atest command to run all benchmark tests for the SDK and NDK APIs. This command also installs the Benchmark application and pushes necessary test files to the device. ```bash atest com.android.media.benchmark.tests -- --enable-module-dynamic-download=true ``` -------------------------------- ### Create Stereo Resampler Source: https://github.com/platform/frameworks/av/blob/main/media/libaaudio/src/flowgraph/resampler/README.md Example of creating a stereo resampler to convert between sample rates. This should be done once per stream. Higher quality settings consume more CPU. ```cpp MultiChannelResampler *resampler = MultiChannelResampler::make( 2, // channel count 44100, // input sampleRate 48000, // output sampleRate MultiChannelResampler::Quality::Medium); // conversion quality ``` -------------------------------- ### Extract Audio Sample Rate and Channel Count Source: https://context7.com/platform/frameworks/llms.txt Use AMediaFormat_getInt32 to get audio sample rate and channel count. This is applicable when the MIME type starts with "audio/". ```c int32_t sampleRate, channelCount; AMediaFormat_getInt32(format, AMEDIAFORMAT_KEY_SAMPLE_RATE, &sampleRate); AMediaFormat_getInt32(format, AMEDIAFORMAT_KEY_CHANNEL_COUNT, &channelCount); printf(" Sample rate: %d Hz\n", sampleRate); printf(" Channels: %d\n", channelCount); ``` -------------------------------- ### Unzip and Push Benchmark Resources Source: https://github.com/platform/frameworks/av/blob/main/media/tests/benchmark/README.md Download and unzip the benchmark resource file, then push it to the device's /data/local/tmp/ directory. This prepares the necessary input files for the tests. ```bash unzip MediaBenchmark-1.1.zip adb push MediaBenchmark-1.1 /data/local/tmp/MediaBenchmark/res/ ``` -------------------------------- ### Deploy Test Binaries to Device Source: https://github.com/platform/frameworks/av/blob/main/media/module/codecs/amrnb/enc/test/README.md Push the 32-bit or 64-bit test binaries to the device's temporary directory. ```bash adb push ${OUT}/data/nativetest64/AmrnbEncoderTest/AmrnbEncoderTest /data/local/tmp/ ``` ```bash adb push ${OUT}/data/nativetest/AmrnbEncoderTest/AmrnbEncoderTest /data/local/tmp/ ``` -------------------------------- ### Build with Soong Source: https://github.com/platform/frameworks/av/blob/main/media/tests/SampleVideoEncoder/README.md Build the project using the Soong build system. ```bash mmm frameworks/av/media/tests/SampleVideoEncoder/ ``` -------------------------------- ### Push 64-bit Binaries Source: https://github.com/platform/frameworks/av/blob/main/media/module/metadatautils/test/README.md Deploy the 64-bit test binary to the device. ```bash adb push ${OUT}/data/nativetest64/MetaDataUtilsTest/MetaDataUtilsTest /data/local/tmp/ ``` -------------------------------- ### Capture Session API Source: https://github.com/platform/frameworks/av/blob/main/camera/ndk/libcamera2ndk.map.txt Functions for managing capture sessions, including starting, stopping, and configuring capture requests. ```APIDOC ## Capture Session Functions ### Description Functions to control the capture session, including submitting capture requests, setting repeating requests, and managing output targets. ### Functions - **ACameraCaptureSession_capture** - Submit a request for image capture. - **ACameraCaptureSession_setRepeatingRequest** - Set a repeating request for continuous capture. - **ACameraCaptureSession_stopRepeating** - Stop the current repeating request. - **ACameraCaptureSession_close** - Close the capture session. - **ACameraDevice_createCaptureSession** - Create a new capture session for a device. ``` -------------------------------- ### Video Profiles API Source: https://github.com/platform/frameworks/av/blob/main/media/libmedia/xsd/api/current.txt Provides methods to get and set video codec, frame rate, resolution, and bit rate. ```APIDOC ## Video Class ### Description Represents video encoding or decoding profiles with properties like codec, frame rate, resolution, and bit rate. ### Methods - `getBitRate()`: Returns the video bit rate. - `getCodec()`: Returns the video codec name. - `getFrameRate()`: Returns the video frame rate. - `getHeight()`: Returns the video height. - `getWidth()`: Returns the video width. - `setBitRate(int bitRate)`: Sets the video bit rate. - `setCodec(String codec)`: Sets the video codec name. - `setFrameRate(int frameRate)`: Sets the video frame rate. - `setHeight(int height)`: Sets the video height. - `setWidth(int width)`: Sets the video width. ``` -------------------------------- ### Push 64-bit Binary to Device Source: https://github.com/platform/frameworks/av/blob/main/media/module/foundation/tests/AVCUtils/README.md Push the 64-bit test binary from the build output to the device's local temporary directory. ```bash adb push ${OUT}/data/nativetest64/AVCUtilsUnitTest/AVCUtilsUnitTest /data/local/tmp/ ``` -------------------------------- ### Push Binaries to Device Source: https://github.com/platform/frameworks/av/blob/main/media/libstagefright/tests/writer/README.md Commands to deploy 64-bit and 32-bit test binaries to the device's temporary storage. ```bash adb push ${OUT}/data/nativetest64/writerTest/writerTest /data/local/tmp/ ``` ```bash adb push ${OUT}/data/nativetest/writerTest/writerTest /data/local/tmp/ ``` -------------------------------- ### Audio Profiles API Source: https://github.com/platform/frameworks/av/blob/main/media/libmedia/xsd/api/current.txt Provides methods to get and set audio codec, sample rate, channels, and bit rate. ```APIDOC ## Audio Class ### Description Represents audio encoding or decoding profiles with properties like codec, sample rate, channels, and bit rate. ### Methods - `getBitRate()`: Returns the audio bit rate. - `getChannels()`: Returns the number of audio channels. - `getCodec()`: Returns the audio codec name. - `getSampleRate()`: Returns the audio sample rate. - `setBitRate(int bitrate)`: Sets the audio bit rate. - `setChannels(int channels)`: Sets the number of audio channels. - `setCodec(String codec)`: Sets the audio codec name. - `setSampleRate(int sampleRate)`: Sets the audio sample rate. ``` -------------------------------- ### Deploy Test Resource Files Source: https://github.com/platform/frameworks/av/blob/main/media/module/codecs/amrwb/dec/test/README.md Push the required test resource files to the device after downloading and unzipping. ```bash adb push AmrwbDecoderTest-2.0 /data/local/tmp/ ``` -------------------------------- ### Build libaaudio_fuzzer on Android Source: https://github.com/platform/frameworks/av/blob/main/media/libaaudio/fuzzer/README.md Use this command to build the libaaudio_fuzzer binary on an Android system. Ensure you have the necessary build tools installed. ```bash mm -j$(nproc) libaaudio_fuzzer ``` -------------------------------- ### Camcorder Profiles API Source: https://github.com/platform/frameworks/av/blob/main/media/libmedia/xsd/api/current.txt Provides access to camcorder profiles, including camera ID, encoder profiles, image decoding/encoding options, and start offset. ```APIDOC ## CamcorderProfiles Class ### Description Represents profiles for camcorders, including associated encoder profiles and image handling options. ### Methods - `getCameraId()`: Returns the camera ID associated with these profiles. - `getEncoderProfile_optional()`: Returns an optional list of `EncoderProfile` objects. - `getImageDecoding_optional()`: Returns an optional list of `ImageDecodingOptional` objects. - `getImageEncoding_optional()`: Returns an optional list of `ImageEncodingOptional` objects. - `getStartOffsetMs()`: Returns the start offset in milliseconds. - `setCameraId(int cameraId)`: Sets the camera ID. - `setStartOffsetMs(int startOffsetMs)`: Sets the start offset in milliseconds. ``` -------------------------------- ### Run Individual Benchmark Test with atest Source: https://github.com/platform/frameworks/av/blob/main/media/tests/benchmark/README.md Run a specific benchmark test class using the atest command. This example shows how to run the ExtractorTest. ```bash atest com.android.media.benchmark.tests.ExtractorTest -- --enable-module-dynamic-download=true ``` -------------------------------- ### Build Mpeg4H263DecoderTest Source: https://github.com/platform/frameworks/av/blob/main/media/module/codecs/m4v_h263/dec/test/README.md Build the test suite using the m command. ```bash m Mpeg4H263DecoderTest ``` -------------------------------- ### Deploy and Run WebmFrameThread Unit Tests Source: https://github.com/platform/frameworks/av/blob/main/media/libstagefright/webm/tests/README.md Commands to push the unit test binaries to the device and execute them via adb shell. ```bash adb push ${OUT}/data/nativetest64/WebmFrameThreadUnitTest/WebmFrameThreadUnitTest /data/local/tmp/ ``` ```bash adb push ${OUT}/data/nativetest/WebmFrameThreadUnitTest/WebmFrameThreadUnitTest /data/local/tmp/ ``` ```bash adb shell /data/local/tmp/WebmFrameThreadUnitTest ``` -------------------------------- ### Get Cached Duration for Network Sources Source: https://context7.com/platform/frameworks/llms.txt Check the cached duration of a network media source using AMediaExtractor_getCachedDuration. Returns -1 if caching is not supported or the duration is unavailable. ```c int64_t cachedDuration = AMediaExtractor_getCachedDuration(extractor); if (cachedDuration >= 0) { printf("\nCached duration: %.2f seconds\n", cachedDuration / 1000000.0); } ``` -------------------------------- ### Run Specific Benchmark Test via Instrumentation Source: https://github.com/platform/frameworks/av/blob/main/media/tests/benchmark/README.md Execute a specific benchmark test class using the 'am instrument' command. This example targets the ExtractorTest class. ```bash adb shell am instrument -w -r -e class 'com.android.media.benchmark.tests.ExtractorTest' com.android.media.benchmark/androidx.test.runner.AndroidJUnitRunner ``` -------------------------------- ### Build and Run cameraservice_test Source: https://github.com/platform/frameworks/av/blob/main/services/camera/libcameraservice/tests/how_to_run.txt Execute these commands in your Android build environment to build, push, and run the cameraservice_test. Ensure the ANDROID_PRODUCT_OUT environment variable is set correctly. ```bash adb root && m cameraservice_test && adb push $ANDROID_PRODUCT_OUT/data/nativetest/cameraservice_test/cameraservice_test \ /data/nativetest/cameraservice_test/arm64/cameraservice_test && adb shell /data/nativetest/cameraservice_test/arm64/cameraservice_test ``` -------------------------------- ### Run the color_conversion_fuzzer on device Source: https://github.com/platform/frameworks/av/blob/main/media/libstagefright/colorconversion/fuzzer/README.md Sync the data to the device and execute the fuzzer binary. ```bash $ adb sync data $ adb shell /data/fuzz/arm64/color_conversion_fuzzer/color_conversion_fuzzer ``` -------------------------------- ### Build libstagefright_renderfright Fuzzer Source: https://github.com/platform/frameworks/av/blob/main/media/libstagefright/renderfright/fuzzer/README.md Use this command to build the libstagefright_renderfright fuzzer. Ensure you have the necessary build environment set up. ```bash mm -j$(nproc) libstagefright_renderfright_fuzzer ``` -------------------------------- ### Push 32-bit Binaries Source: https://github.com/platform/frameworks/av/blob/main/media/module/metadatautils/test/README.md Deploy the 32-bit test binary to the device. ```bash adb push ${OUT}/data/nativetest/MetaDataUtilsTest/MetaDataUtilsTest /data/local/tmp/ ``` -------------------------------- ### Push Resource Files Source: https://github.com/platform/frameworks/av/blob/main/media/module/metadatautils/test/README.md Deploy the required test resource files to the device. ```bash adb push MetaDataUtilsTestRes-1.1 /data/local/tmp/ ``` -------------------------------- ### Setup USB Audio Stream Source: https://context7.com/platform/frameworks/llms.txt Configures and opens an exclusive AAudio output stream for a specific USB audio device, setting high-resolution audio parameters. Verifies the opened device ID and reports stream properties. Ensure the device ID is valid. ```c // USB Audio device attributes typedef struct { int32_t deviceId; int32_t sampleRates[8]; int32_t numSampleRates; int32_t channelMasks[4]; int32_t numChannelMasks; int32_t formats[4]; int32_t numFormats; } AudioDeviceInfo; // Example usage pattern for setting up USB audio int setupUsbAudioStream(int32_t deviceId) { AAudioStreamBuilder *builder = NULL; AAudioStream *stream = NULL; aaudio_result_t result; result = AAudio_createStreamBuilder(&builder); if (result != AAUDIO_OK) return -1; // Configure for specific USB device AAudioStreamBuilder_setDeviceId(builder, deviceId); AAudioStreamBuilder_setDirection(builder, AAUDIO_DIRECTION_OUTPUT); AAudioStreamBuilder_setFormat(builder, AAUDIO_FORMAT_PCM_FLOAT); AAudioStreamBuilder_setSampleRate(builder, 96000); // High-res audio AAudioStreamBuilder_setChannelCount(builder, 2); AAudioStreamBuilder_setPerformanceMode(builder, AAUDIO_PERFORMANCE_MODE_NONE); AAudioStreamBuilder_setSharingMode(builder, AAUDIO_SHARING_MODE_EXCLUSIVE); // Set content type for audio routing decisions AAudioStreamBuilder_setContentType(builder, AAUDIO_CONTENT_TYPE_MUSIC); AAudioStreamBuilder_setUsage(builder, AAUDIO_USAGE_MEDIA); result = AAudioStreamBuilder_openStream(builder, &stream); AAudioStreamBuilder_delete(builder); if (result != AAUDIO_OK) { printf("Failed to open USB audio stream: %s\n", AAudio_convertResultToText(result)); return -1; } // Verify we got the device we requested int32_t actualDeviceId = AAudioStream_getDeviceId(stream); if (actualDeviceId != deviceId) { printf("Warning: Got device %d instead of requested %d\n", actualDeviceId, deviceId); } printf("USB Audio stream opened on device %d\n", actualDeviceId); printf(" Actual sample rate: %d\n", AAudioStream_getSampleRate(stream)); printf(" Actual channel count: %d\n", AAudioStream_getChannelCount(stream)); // ... use stream for playback ... AAudioStream_close(stream); return 0; } ``` -------------------------------- ### Push 64-bit Binary to Device Source: https://github.com/platform/frameworks/av/blob/main/media/libstagefright/timedtext/test/README.md Copies the compiled 64-bit test binary from the build output to the device's temporary directory for execution. ```bash adb push ${OUT}/data/nativetest64/TimedTextUnitTest/TimedTextUnitTest /data/local/tmp/ ``` -------------------------------- ### Configure ADPF uclamp_min.high_limit and run Synthmark Source: https://github.com/platform/frameworks/av/blob/main/media/libaaudio/scripts/synthmark_tests.txt Set the ADPF uclamp minimum high limit property before running synthmark. This example demonstrates setting the limit to 400, 500, and 600 respectively, then running synthmark with ADPF PID enabled (-z1). Requires root access. ```bash adb root adb shell setprop vendor.powerhal.adpf.uclamp_min.high_limit 400 adb shell synthmark -tj -n1 -N50 -B2 -z1 ``` ```bash adb shell synthmark -tj -n1 -N75 -B2 -z1 ``` ```bash adb shell synthmark -tj -n1 -N100 -B2 -z1 ``` ```bash adb root adb shell setprop vendor.powerhal.adpf.uclamp_min.high_limit 500 adb shell synthmark -tj -n1 -N50 -B2 -z1 ``` ```bash adb shell synthmark -tj -n1 -N75 -B2 -z1 ``` ```bash adb shell synthmark -tj -n1 -N100 -B2 -z1 ``` ```bash adb root adb shell setprop vendor.powerhal.adpf.uclamp_min.high_limit 600 adb shell synthmark -tj -n1 -N50 -B2 -z1 ``` ```bash adb shell synthmark -tj -n1 -N75 -B2 -z1 ``` ```bash adb shell synthmark -tj -n1 -N100 -B2 -z1 ``` -------------------------------- ### Build Benchmark Test Suite Source: https://github.com/platform/frameworks/av/blob/main/media/tests/benchmark/README.md Use this command to build the benchmark test suite for MediaCodec, MediaExtractor, and MediaMuxer. Ensure you are in the correct project directory. ```bash mmm frameworks/av/media/tests/benchmark/ ``` -------------------------------- ### Build mediarecorder_fuzzer Source: https://github.com/platform/frameworks/av/blob/main/media/libmediaplayerservice/fuzzer/README.md Build the mediarecorder fuzzer using the mm command. Ensure you have the necessary build environment set up. ```bash $ mm -j$(nproc) mediarecorder_fuzzer ``` -------------------------------- ### Build Bufferpool Test Suite Source: https://github.com/platform/frameworks/av/blob/main/media/module/bufferpool/2.0/tests/README.md Build the BufferpoolUnitTest binary using the `m` command. This command compiles the test suite for the bufferpool library. ```bash m BufferpoolUnitTest ``` -------------------------------- ### Push Test Binaries to Device Source: https://github.com/platform/frameworks/av/blob/main/media/module/extractors/tests/README.md Commands to push 64-bit and 32-bit test binaries to the device's local temporary directory. ```bash adb push ${OUT}/data/nativetest64/ExtractorUnitTest/ExtractorUnitTest /data/local/tmp/ ``` ```bash adb push ${OUT}/data/nativetest/ExtractorUnitTest/ExtractorUnitTest /data/local/tmp/ ``` -------------------------------- ### Push 64-bit Codec2 Binaries Source: https://github.com/platform/frameworks/av/blob/main/media/tests/benchmark/README.md Push 64-bit Codec2 test binaries from the build output directory to the device's temporary file system for execution. ```bash adb push $(OUT)/data/nativetest64/* /data/local/tmp/ ``` ```bash adb push $(OUT)/data/nativetest64/C2DecoderTest/C2DecoderTest /data/local/tmp/ ``` -------------------------------- ### Build and Run NdkSyncCodec Fuzzer Source: https://github.com/platform/frameworks/av/blob/main/media/ndk/fuzzer/README.md Build the ndk_sync_codec_fuzzer using `mm` and run it on a device. ```bash $ mm -j$(nproc) ndk_sync_codec_fuzzer ``` ```bash $ adb sync data $ adb shell /data/fuzz/arm64/ndk_sync_codec_fuzzer/ndk_sync_codec_fuzzer ``` -------------------------------- ### Build HEVCUtilsUnitTest Source: https://github.com/platform/frameworks/av/blob/main/media/libstagefright/tests/HEVC/README.md Build the HEVC utility unit test suite using the m command. ```bash m HEVCUtilsUnitTest ``` -------------------------------- ### Push Test Binaries to Device Source: https://github.com/platform/frameworks/av/blob/main/media/module/codecs/amrnb/dec/test/README.md Deploy 64-bit or 32-bit test binaries to the device using adb. ```bash adb push ${OUT}/data/nativetest64/AmrnbDecoderTest/AmrnbDecoderTest /data/local/tmp/ ``` ```bash adb push ${OUT}/data/nativetest/AmrnbDecoderTest/AmrnbDecoderTest /data/local/tmp/ ``` -------------------------------- ### Build Mp3DecoderTest Source: https://github.com/platform/frameworks/av/blob/main/media/module/codecs/mp3dec/test/README.md Build the Mp3Decoder test suite using the `m` command. The binaries are generated in the OUT directory. ```bash m Mp3DecoderTest ``` -------------------------------- ### Execute media_metrics benchmark via ADB Source: https://github.com/platform/frameworks/av/blob/main/services/mediametrics/benchmarks/README.md Run the native test binary directly from the device shell. Re-run if the process fails due to binder queue limitations. ```shell adb shell /data/nativetest64/media_metrics/media_metrics ``` -------------------------------- ### Push 32-bit Binary to Device Source: https://github.com/platform/frameworks/av/blob/main/media/libstagefright/timedtext/test/README.md Copies the compiled 32-bit test binary from the build output to the device's temporary directory for execution. ```bash adb push ${OUT}/data/nativetest/TimedTextUnitTest/TimedTextUnitTest /data/local/tmp/ ``` -------------------------------- ### Manage Camera Capture Sessions with NDK Source: https://context7.com/platform/frameworks/llms.txt This snippet demonstrates the full workflow for initializing an image reader, configuring session outputs, and executing a still image capture request. ```c #include #include #include #include #include #include typedef struct { ACameraDevice *device; ACameraCaptureSession *session; AImageReader *imageReader; ACaptureRequest *captureRequest; ACameraOutputTarget *outputTarget; ACaptureSessionOutput *sessionOutput; ACaptureSessionOutputContainer *outputContainer; bool captureComplete; } CameraContext; void onImageAvailable(void *context, AImageReader *reader) { CameraContext *ctx = (CameraContext *)context; AImage *image = NULL; media_status_t status = AImageReader_acquireLatestImage(reader, &image); if (status == AMEDIA_OK && image) { int32_t width, height, format; AImage_getWidth(image, &width); AImage_getHeight(image, &height); AImage_getFormat(image, &format); printf("Captured image: %dx%d, format: %d\n", width, height, format); // For JPEG format, get the data if (format == AIMAGE_FORMAT_JPEG) { uint8_t *data = NULL; int dataLength = 0; AImage_getPlaneData(image, 0, &data, &dataLength); printf("JPEG data size: %d bytes\n", dataLength); // Save to file FILE *file = fopen("/data/local/tmp/capture.jpg", "wb"); if (file) { fwrite(data, 1, dataLength, file); fclose(file); printf("Saved to /data/local/tmp/capture.jpg\n"); } } AImage_delete(image); ctx->captureComplete = true; } } void onCaptureSessionClosed(void *context, ACameraCaptureSession *session) { printf("Session closed\n"); } void onCaptureSessionReady(void *context, ACameraCaptureSession *session) { printf("Session ready\n"); } void onCaptureSessionActive(void *context, ACameraCaptureSession *session) { printf("Session active\n"); } camera_status_t createCaptureSession(CameraContext *ctx, const char *cameraId, ACameraManager *manager) { camera_status_t status; // Create image reader for JPEG capture (1920x1080) media_status_t mediaStatus = AImageReader_new( 1920, 1080, AIMAGE_FORMAT_JPEG, 2, &ctx->imageReader); if (mediaStatus != AMEDIA_OK) { printf("Failed to create image reader\n"); return ACAMERA_ERROR_UNKNOWN; } // Set image available callback AImageReader_ImageListener listener = { .context = ctx, .onImageAvailable = onImageAvailable }; AImageReader_setImageListener(ctx->imageReader, &listener); // Get native window from image reader ANativeWindow *window = NULL; AImageReader_getWindow(ctx->imageReader, &window); // Create output target status = ACameraOutputTarget_create(window, &ctx->outputTarget); if (status != ACAMERA_OK) return status; // Create session output status = ACaptureSessionOutput_create(window, &ctx->sessionOutput); if (status != ACAMERA_OK) return status; // Create output container status = ACaptureSessionOutputContainer_create(&ctx->outputContainer); if (status != ACAMERA_OK) return status; ACaptureSessionOutputContainer_add(ctx->outputContainer, ctx->sessionOutput); // Create capture session ACameraCaptureSession_stateCallbacks sessionCallbacks = { .context = ctx, .onClosed = onCaptureSessionClosed, .onReady = onCaptureSessionReady, .onActive = onCaptureSessionActive }; status = ACameraDevice_createCaptureSession( ctx->device, ctx->outputContainer, &sessionCallbacks, &ctx->session); if (status != ACAMERA_OK) return status; // Create capture request status = ACameraDevice_createCaptureRequest( ctx->device, TEMPLATE_STILL_CAPTURE, &ctx->captureRequest); if (status != ACAMERA_OK) return status; // Add target to request ACaptureRequest_addTarget(ctx->captureRequest, ctx->outputTarget); return ACAMERA_OK; } camera_status_t captureImage(CameraContext *ctx) { ACameraCaptureSession_captureCallbacks captureCallbacks = { .context = ctx, .onCaptureStarted = NULL, .onCaptureProgressed = NULL, .onCaptureCompleted = NULL, .onCaptureFailed = NULL, .onCaptureSequenceCompleted = NULL, .onCaptureSequenceAborted = NULL, .onCaptureBufferLost = NULL }; int sequenceId = 0; return ACameraCaptureSession_capture( ctx->session, &captureCallbacks, 1, &ctx->captureRequest, &sequenceId); } void cleanupCamera(CameraContext *ctx) { if (ctx->session) { ``` -------------------------------- ### Build MetaDataUtilsTest Source: https://github.com/platform/frameworks/av/blob/main/media/module/metadatautils/test/README.md Build the test suite using the m command. ```bash m MetaDataUtilsTest ``` -------------------------------- ### Build AVCUtils Unit Test Suite Source: https://github.com/platform/frameworks/av/blob/main/media/module/foundation/tests/AVCUtils/README.md Build the AVCUtils Unit Test Suite using the `m` command. The binaries will be generated in the specified output paths. ```bash m AVCUtilsUnitTest ``` -------------------------------- ### Push Test Resources Source: https://github.com/platform/frameworks/av/blob/main/media/libstagefright/tests/HEVC/README.md Push the required resource files to the device for testing. ```bash adb push HEVCUtilsUnitTest-1.0 /data/local/tmp/ ``` -------------------------------- ### Run Mp3DecoderTest Source: https://github.com/platform/frameworks/av/blob/main/media/module/codecs/mp3dec/test/README.md Execute the Mp3DecoderTest binary on the device, specifying the path to the resource folder using the -P flag. ```bash adb shell /data/local/tmp/Mp3DecoderTest -P /data/local/tmp/Mp3DecoderTest-1.3/ ``` -------------------------------- ### Push Resource Files to Device Source: https://github.com/platform/frameworks/av/blob/main/media/module/foundation/tests/AVCUtils/README.md Download, unzip, and push the resource files required for the AVCUtils tests to the device's local temporary directory. ```bash adb push AVCUtilsUnitTest-1.0 /data/local/tmp/ ``` -------------------------------- ### Build the fuzzer binary Source: https://github.com/platform/frameworks/av/blob/main/services/mediaresourcemanager/fuzzer/README.md Use the mm command to compile the mediaresourcemanager_fuzzer binary. ```bash $ mm -j$(nproc) mediaresourcemanager_fuzzer ``` -------------------------------- ### Build and Run NdkAsyncCodec Fuzzer Source: https://github.com/platform/frameworks/av/blob/main/media/ndk/fuzzer/README.md Build the ndk_async_codec_fuzzer using `mm` and run it on a device. ```bash $ mm -j$(nproc) ndk_async_codec_fuzzer ``` ```bash $ adb sync data $ adb shell /data/fuzz/arm64/ndk_async_codec_fuzzer/ndk_sync_codec_fuzzer ``` -------------------------------- ### Execute HEVCUtilsUnitTest Source: https://github.com/platform/frameworks/av/blob/main/media/libstagefright/tests/HEVC/README.md Run the test suite using the binary or the atest command. ```bash adb shell /data/local/tmp/HEVCUtilsUnitTest -P /data/local/tmp/HEVCUtilsUnitTest-1.0/ ``` ```bash atest HEVCUtilsUnitTest -- --enable-module-dynamic-download=true ``` -------------------------------- ### Build Mpeg4H263Encoder Test Suite Source: https://github.com/platform/frameworks/av/blob/main/media/module/codecs/m4v_h263/enc/test/README.md Build the Mpeg4H263Encoder test suite using the 'm' command. This generates 32-bit and 64-bit binaries. ```bash m Mpeg4H263EncoderTest ``` -------------------------------- ### Run Synthmark with default settings Source: https://github.com/platform/frameworks/av/blob/main/media/libaaudio/scripts/synthmark_tests.txt Execute synthmark with default parameters to measure energy consumption. The -tj flags enable JSON output and trace capture, -n1 specifies one iteration, -N values control the workload, and -B2 sets the buffer size. -z0 indicates no ADPF PID. ```bash adb shell synthmark -tj -n1 -N50 -B2 -z0 ``` ```bash adb shell synthmark -tj -n1 -N75 -B2 -z0 ``` ```bash adb shell synthmark -tj -n1 -N100 -B2 -z0 ``` -------------------------------- ### Deploy AMR-WB Decoder Test Binaries Source: https://github.com/platform/frameworks/av/blob/main/media/module/codecs/amrwb/dec/test/README.md Push the 32-bit or 64-bit test binaries to the device's temporary directory. ```bash adb push ${OUT}/data/nativetest64/AmrwbDecoderTest/AmrwbDecoderTest /data/local/tmp/ ``` ```bash adb push ${OUT}/data/nativetest/AmrwbDecoderTest/AmrwbDecoderTest /data/local/tmp/ ``` -------------------------------- ### Push 32-bit Codec2 Binaries Source: https://github.com/platform/frameworks/av/blob/main/media/tests/benchmark/README.md Push 32-bit Codec2 test binaries from the build output directory to the device's temporary file system for execution. ```bash adb push $(OUT)/data/nativetest/* /data/local/tmp/ ``` ```bash adb push $(OUT)/data/nativetest/C2DecoderTest/C2DecoderTest /data/local/tmp/ ``` -------------------------------- ### Push Test Binaries Source: https://github.com/platform/frameworks/av/blob/main/media/libstagefright/tests/extractorFactory/README.md Deploy 64-bit and 32-bit binaries to the device using adb. ```shell adb push ${OUT}/data/nativetest64/ExtractorFactoryTest/ExtractorFactoryTest /data/local/tmp/ ``` ```shell adb push ${OUT}/data/nativetest/ExtractorFactoryTest/ExtractorFactoryTest /data/local/tmp/ ``` -------------------------------- ### Build ID3 Test Suite Source: https://github.com/platform/frameworks/av/blob/main/media/module/id3/test/README.md Build the ID3 test suite binaries using the m command. ```shell m ID3Test ``` -------------------------------- ### Execute OpusHeaderTest Source: https://github.com/platform/frameworks/av/blob/main/media/module/foundation/tests/OpusHeader/README.md Command to run the test binary on the device using the specified path. ```bash adb shell /data/local/tmp/OpusHeaderTest -P /data/local/tmp/OpusHeader-1.0/ ``` -------------------------------- ### Build metadataretriever_fuzzer Source: https://github.com/platform/frameworks/av/blob/main/media/libmediaplayerservice/fuzzer/README.md Build the metadataretriever fuzzer using the mm command. This is a prerequisite for running the fuzzer on a device. ```bash $ mm -j$(nproc) metadataretriever_fuzzer ``` -------------------------------- ### Build the color_conversion_fuzzer Source: https://github.com/platform/frameworks/av/blob/main/media/libstagefright/colorconversion/fuzzer/README.md Use the mm command to compile the fuzzer binary. ```bash $ mm -j$(nproc) color_conversion_fuzzer ``` -------------------------------- ### Build the fuzzer binary Source: https://github.com/platform/frameworks/av/blob/main/media/module/codecserviceregistrant/fuzzer/README.md Use the mm command to compile the codecServiceRegistrant_fuzzer binary. ```bash $ mm -j$(nproc) codecServiceRegistrant_fuzzer ``` -------------------------------- ### Execute Mpeg2TS Unit Test Source: https://github.com/platform/frameworks/av/blob/main/media/module/mpeg2ts/test/README.md Run the test binary with the path to the resource folder. ```shell adb shell /data/local/tmp/Mpeg2tsUnitTest -P /data/local/tmp/Mpeg2tsUnitTest-1.0/ ``` -------------------------------- ### Run AVCUtils Unit Test Source: https://github.com/platform/frameworks/av/blob/main/media/module/foundation/tests/AVCUtils/README.md Execute the AVCUtils Unit Test binary on the device, specifying the path to the resource folder using the `-P` flag. ```bash adb shell /data/local/tmp/AVCUtilsUnitTest -P /data/local/tmp/AVCUtilsUnitTest-1.0/ ``` -------------------------------- ### Push 64-bit Bufferpool Test Binary to Device Source: https://github.com/platform/frameworks/av/blob/main/media/module/bufferpool/2.0/tests/README.md Push the compiled 64-bit BufferpoolUnitTest binary to the device's `/data/local/tmp/` directory using `adb push`. Ensure the path `${OUT}/data/nativetest64/` is correct for your build environment. ```bash adb push ${OUT}/data/nativetest64/BufferpoolUnitTest/BufferpoolUnitTest /data/local/tmp/ ``` -------------------------------- ### Build XMLParserTest Source: https://github.com/platform/frameworks/av/blob/main/media/libstagefright/xmlparser/test/README.md Build the XMLParser test suite using the m command. ```shell m XMLParserTest ``` -------------------------------- ### Run Synthmark with uclamp enabled Source: https://github.com/platform/frameworks/av/blob/main/media/libaaudio/scripts/synthmark_tests.txt Execute synthmark with uclamp enabled (-u1). This command tests energy consumption under specific uclamp settings. Requires root access. ```bash adb root adb shell synthmark -tj -n1 -N75 -B2 -u1 ``` -------------------------------- ### Push Test Resources Source: https://github.com/platform/frameworks/av/blob/main/media/module/foundation/tests/OpusHeader/README.md Command to push the unzipped resource files to the device. ```bash adb push OpusHeader-1.0 /data/local/tmp/ ``` -------------------------------- ### Create and Configure AAudio Input Stream Source: https://context7.com/platform/frameworks/llms.txt Initializes an AAudio stream builder, sets parameters for input recording (format, channel count, sample rate, performance mode, sharing mode, input preset), and opens the stream. Ensure AAudio library is included and initialized. ```c #include #include #include #define SAMPLE_RATE 44100 #define NUM_SECONDS 5 #define BUFFER_SIZE (SAMPLE_RATE * NUM_SECONDS) int main() { AAudioStreamBuilder *builder = NULL; AAudioStream *stream = NULL; aaudio_result_t result; int16_t *recordBuffer = NULL; int32_t totalFramesRead = 0; // Allocate recording buffer recordBuffer = (int16_t *)malloc(BUFFER_SIZE * sizeof(int16_t)); if (!recordBuffer) { printf("Failed to allocate buffer\n"); return 1; } // Create and configure input stream builder result = AAudio_createStreamBuilder(&builder); if (result != AAUDIO_OK) { printf("Error creating builder: %s\n", AAudio_convertResultToText(result)); free(recordBuffer); return 1; } AAudioStreamBuilder_setDirection(builder, AAUDIO_DIRECTION_INPUT); AAudioStreamBuilder_setFormat(builder, AAUDIO_FORMAT_PCM_I16); AAudioStreamBuilder_setChannelCount(builder, 1); // Mono recording AAudioStreamBuilder_setSampleRate(builder, SAMPLE_RATE); AAudioStreamBuilder_setPerformanceMode(builder, AAUDIO_PERFORMANCE_MODE_NONE); AAudioStreamBuilder_setSharingMode(builder, AAUDIO_SHARING_MODE_SHARED); AAudioStreamBuilder_setInputPreset(builder, AAUDIO_INPUT_PRESET_VOICE_RECOGNITION); // Open stream result = AAudioStreamBuilder_openStream(builder, &stream); AAudioStreamBuilder_delete(builder); if (result != AAUDIO_OK) { printf("Error opening stream: %s\n", AAudio_convertResultToText(result)); free(recordBuffer); return 1; } // Start recording result = AAudioStream_requestStart(stream); if (result != AAUDIO_OK) { printf("Error starting stream: %s\n", AAudio_convertResultToText(result)); AAudioStream_close(stream); free(recordBuffer); return 1; } printf("Recording %d seconds of audio...\n", NUM_SECONDS); // Read audio data in a loop while (totalFramesRead < BUFFER_SIZE) { int32_t framesToRead = BUFFER_SIZE - totalFramesRead; if (framesToRead > 1024) framesToRead = 1024; // Read in chunks int32_t framesRead = AAudioStream_read( stream, &recordBuffer[totalFramesRead], framesToRead, 100000000LL // 100ms timeout in nanoseconds ); if (framesRead < 0) { printf("Read error: %s\n", AAudio_convertResultToText(framesRead)); break; } totalFramesRead += framesRead; // Check stream state aaudio_stream_state_t state = AAudioStream_getState(stream); if (state == AAUDIO_STREAM_STATE_DISCONNECTED) { printf("Stream disconnected\n"); break; } } printf("Recorded %d frames, XRuns: %d\n", totalFramesRead, AAudioStream_getXRunCount(stream)); // Save to file (raw PCM) FILE *file = fopen("/data/local/tmp/recording.pcm", "wb"); if (file) { fwrite(recordBuffer, sizeof(int16_t), totalFramesRead, file); fclose(file); printf("Saved recording to /data/local/tmp/recording.pcm\n"); } // Cleanup AAudioStream_requestStop(stream); AAudioStream_close(stream); free(recordBuffer); return 0; } ``` -------------------------------- ### Initialize MediaDRM and Open Session Source: https://context7.com/platform/frameworks/llms.txt Initializes MediaDRM for a given UUID and MIME type, checks for support, and opens a session. Handles provisioning if the device is not provisioned. Requires including media/NdkMediaDrm.h. ```c #include #include #include #include // Widevine UUID static const uint8_t WIDEVINE_UUID[16] = { 0xED, 0xEF, 0x8B, 0xA9, 0x79, 0xD6, 0x4A, 0xCE, 0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED }; // ClearKey UUID (for testing) static const uint8_t CLEARKEY_UUID[16] = { 0xE2, 0x71, 0x9D, 0x58, 0xA9, 0x85, 0xB3, 0xC9, 0x78, 0x1A, 0xB0, 0x30, 0xAF, 0x78, 0xD3, 0x0E }; // DRM event callback void onDrmEvent(AMediaDrm *drm, const AMediaDrmSessionId *sessionId, AMediaDrmEventType eventType, int extra, const uint8_t *data, size_t dataSize) { printf("DRM Event: type=%d, extra=%d, dataSize=%zu\n", eventType, extra, dataSize); switch (eventType) { case EVENT_PROVISION_REQUIRED: printf(" Provisioning required\n"); break; case EVENT_KEY_REQUIRED: printf(" Key request required\n"); break; case EVENT_KEY_EXPIRED: printf(" Keys expired\n"); break; case EVENT_VENDOR_DEFINED: printf(" Vendor-defined event\n"); break; case EVENT_SESSION_RECLAIMED: printf(" Session reclaimed by resource manager\n"); break; } } void onExpirationUpdate(AMediaDrm *drm, const AMediaDrmSessionId *sessionId, int64_t expiryTimeMs) { printf("Key expiration update: expires in %lld ms\n", (long long)expiryTimeMs); } void onKeysChange(AMediaDrm *drm, const AMediaDrmSessionId *sessionId, const AMediaDrmKeyStatus *keyStatus, size_t numKeys, bool hasNewUsableKey) { printf("Keys changed: %zu keys, hasNewUsableKey=%d\n", numKeys, hasNewUsableKey); for (size_t i = 0; i < numKeys; i++) { const char *statusStr = "unknown"; switch (keyStatus[i].keyType) { case KEY_STATUS_TYPE_USABLE: statusStr = "usable"; break; case KEY_STATUS_TYPE_EXPIRED: statusStr = "expired"; break; case KEY_STATUS_TYPE_OUTPUTNOTALLOWED: statusStr = "output not allowed"; break; case KEY_STATUS_TYPE_STATUSPENDING: statusStr = "pending"; break; case KEY_STATUS_TYPE_INTERNALERROR: statusStr = "internal error"; break; } printf(" Key %zu: status=%s\n", i, statusStr); } } int initDrm(const uint8_t *uuid, const char *mimeType) { // Check if DRM scheme is supported bool supported = AMediaDrm_isCryptoSchemeSupported(uuid, mimeType); printf("DRM scheme supported for %s: %s\n", mimeType, supported ? "yes" : "no"); if (!supported) { return -1; } // Create DRM instance AMediaDrm *drm = AMediaDrm_createByUUID(uuid); if (!drm) { printf("Failed to create DRM instance\n"); return -1; } // Set event listeners AMediaDrm_setOnEventListener(drm, onDrmEvent); AMediaDrm_setOnExpirationUpdateListener(drm, onExpirationUpdate); AMediaDrm_setOnKeysChangeListener(drm, onKeysChange); // Open session AMediaDrmSessionId sessionId; media_status_t status = AMediaDrm_openSession(drm, &sessionId); if (status == AMEDIA_DRM_NOT_PROVISIONED) { printf("Device not provisioned, requesting provisioning...\n"); // Get provision request const uint8_t *provisionRequest; size_t provisionRequestSize; const char *serverUrl; status = AMediaDrm_getProvisionRequest(drm, &provisionRequest, &provisionRequestSize, &serverUrl); if (status == AMEDIA_OK) { printf("Provision request size: %zu, URL: %s\n", provisionRequestSize, serverUrl); // In real app: send provisionRequest to serverUrl, get response // Then call AMediaDrm_provideProvisionResponse() } AMediaDrm_release(drm); return -1; } if (status != AMEDIA_OK) { printf("Failed to open session: %d\n", status); AMediaDrm_release(drm); return -1; } printf("DRM session opened, ID length: %zu\n", sessionId.length); // Example: Get key request for streaming content const uint8_t initData[] = {0x00, 0x00, 0x00, 0x00}; // Placeholder PSSH data const uint8_t *keyRequest; size_t keyRequestSize; const char *keyServerUrl; // Key-value pairs for optional parameters AMediaDrmKeyValue optionalParams[] = { {"contentType", "video/mp4"}, {NULL, NULL} }; status = AMediaDrm_getKeyRequest( drm, &sessionId, initData, sizeof(initData), "video/mp4", KEY_TYPE_STREAMING, optionalParams, 1, ``` -------------------------------- ### Build and Run NdkCrypto Fuzzer Source: https://github.com/platform/frameworks/av/blob/main/media/ndk/fuzzer/README.md Commands to build the NdkCrypto fuzzer and execute it on a connected device. ```bash $ mm -j$(nproc) ndk_crypto_fuzzer ``` ```bash $ adb sync data $ adb shell /data/fuzz/arm64/ndk_crypto_fuzzer/ndk_crypto_fuzzer ``` -------------------------------- ### Build FlacDecoder Test Suite Source: https://github.com/platform/frameworks/av/blob/main/media/module/codecs/flac/dec/test/README.md Build the FlacDecoder test suite using the make command. This generates 32-bit and 64-bit binaries. ```bash m FlacDecoderTest ``` -------------------------------- ### Build and Run NdkMediaFormat Fuzzer Source: https://github.com/platform/frameworks/av/blob/main/media/ndk/fuzzer/README.md Build the ndk_mediaformat_fuzzer using `mm` and run it on a device with the specified corpus. ```bash $ mm -j$(nproc) ndk_mediaformat_fuzzer ``` ```bash $ adb sync data $ adb shell /data/fuzz/${TARGET_ARCH}/ndk_mediaformat_fuzzer/ndk_mediaformat_fuzzer /data/fuzz/${TARGET_ARCH}/ndk_mediaformat_fuzzer/corpus ``` -------------------------------- ### Create fuzzer corpus directory Source: https://github.com/platform/frameworks/av/blob/main/drm/libmediadrm/fuzzer/README.md Prepare a directory on the device to store the fuzzer corpus. ```bash $ adb shell mkdir CORPUS_DIR ``` -------------------------------- ### Build MtpServer Fuzzer Source: https://github.com/platform/frameworks/av/blob/main/media/mtp/tests/MtpFuzzer/README.md Builds the mtp_fuzzer using the `mm` command. Ensure you have the necessary build environment set up. ```bash $ mm -j$(nproc) mtp_fuzzer ``` -------------------------------- ### Build SDPLoader Fuzzer Source: https://github.com/platform/frameworks/av/blob/main/media/libstagefright/rtsp/fuzzer/README.md Builds the sdploader_fuzzer using the mm command. Ensure you have the necessary build environment set up. ```bash $ mm -j$(nproc) sdploader_fuzzer ``` -------------------------------- ### Run MtpHostProperty Fuzzer on Device Source: https://github.com/platform/frameworks/av/blob/main/media/mtp/tests/MtpFuzzer/README.md Launches the mtp_host_property_fuzzer on the device. Ensure 'data' is synced and the fuzzer executable is in the correct path. ```bash $ adb sync data $ adb shell /data/fuzz/arm64/mtp_host_property_fuzzer/mtp_host_property_fuzzer ``` -------------------------------- ### Build Mpeg2TS Unit Test Suite Source: https://github.com/platform/frameworks/av/blob/main/media/module/mpeg2ts/test/README.md Build the test suite using the mmm command. ```shell mmm frameworks/av/media/libstagefright/mpeg2ts/test/ ``` -------------------------------- ### Push 64-bit Binary Source: https://github.com/platform/frameworks/av/blob/main/media/libstagefright/xmlparser/test/README.md Deploy the 64-bit XMLParserTest binary to the device. ```shell adb push ${OUT}/data/nativetest64/XMLParserTest/XMLParserTest /data/local/tmp/ ``` -------------------------------- ### Run libstagefright_renderfright Fuzzer on Device Source: https://github.com/platform/frameworks/av/blob/main/media/libstagefright/renderfright/fuzzer/README.md These commands are used to transfer the fuzzer to the device and then execute it. This allows for fuzz testing on the target hardware. ```bash adb sync data ``` ```bash adb shell /data/fuzz/arm64/libstagefright_renderfright_fuzzer/libstagefright_renderfright_fuzzer ``` -------------------------------- ### XmlParser.read Source: https://github.com/platform/frameworks/av/blob/main/media/libmedia/xsd/api/current.txt Parses a media settings configuration from an input stream. ```APIDOC ## STATIC METHOD read ### Description Parses media settings from an InputStream into a MediaSettings object. ### Method static ### Parameters #### Request Body - **inputStream** (java.io.InputStream) - Required - The input stream containing the XML configuration. ### Response #### Success Response - **MediaSettings** (media.profiles.MediaSettings) - The parsed media settings object. ### Throws - javax.xml.datatype.DatatypeConfigurationException - java.io.IOException - org.xmlpull.v1.XmlPullParserException ``` -------------------------------- ### Run NDK Decoder Test Source: https://github.com/platform/frameworks/av/blob/main/media/tests/benchmark/README.md Execute the NDK decoder test binary on the device. The -P flag specifies the path to the resource files. ```bash adb shell /data/local/tmp/decoderTest -P /data/local/tmp/MediaBenchmark/res/ ```