How to add RK Kodi 16 Support to Firefly RK3288

Add this to Firefly SDK for Audio Pass-Through

diff --git a/core/jni/android_media_AudioTrack.cpp b/core/jni/android_media_AudioTrack.cpp
index ab38864..c387858 100644
--- a/core/jni/android_media_AudioTrack.cpp
+++ b/core/jni/android_media_AudioTrack.cpp
@@ -68,6 +68,7 @@ struct audiotrack_callback_cookie {
 // keep these values in sync with AudioTrack.java
 #define MODE_STATIC 0
 #define MODE_STREAM 1
+#define MODE_STREAM_DIRECT 2

 // ----------------------------------------------------------------------------
 class AudioTrackJniStorage {
@@ -333,6 +334,26 @@ android_media_AudioTrack_setup(JNIEnv *env, jobject thiz, jobject weak_this,
                 -1, -1,                       // default uid, pid values
                 paa);
         break;
+
+    case MODE_STREAM_DIRECT:
+
+        status = lpTrack->set(
+                AUDIO_STREAM_DEFAULT,// stream type, but more info conveyed in paa (last argument)
+                sampleRateInHertz,
+                format,// word length, PCM
+                nativeChannelMask,
+                frameCount,
+                AUDIO_OUTPUT_FLAG_DIRECT,
+                audioCallback, &(lpJniStorage->mCallbackData),//callback, callback data (user)
+                0,// notificationFrames == 0 since not using EVENT_MORE_DATA to feed the AudioTrack
+                0,// shared mem
+                true,// thread can call Java
+                sessionId,// audio session ID
+                AudioTrack::TRANSFER_SYNC,
+                NULL,                         // default offloadInfo
+                -1, -1,                       // default uid, pid values
+                paa);
+        break;

     default:
         ALOGE("Unknown mode %d", memoryMode);
diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java
index 547d87e..ea56cc9 100644
--- a/media/java/android/media/AudioTrack.java
+++ b/media/java/android/media/AudioTrack.java
@@ -92,7 +92,7 @@ public class AudioTrack
     /** Minimum value for sample rate */
     private static final int SAMPLE_RATE_HZ_MIN = 4000;
     /** Maximum value for sample rate */
-    private static final int SAMPLE_RATE_HZ_MAX = 96000;
+    private static final int SAMPLE_RATE_HZ_MAX = 192000;

     /** Maximum value for AudioTrack channel count */
     private static final int CHANNEL_COUNT_MAX = 8;
@@ -116,6 +116,7 @@ public class AudioTrack
      */
     public static final int MODE_STREAM = 1;

+    public static final int MODE_STREAM_DIRECT = 2;
     /**
      * State of an AudioTrack that was not successfully initialized upon creation.
      */
@@ -528,7 +529,7 @@ public class AudioTrack

         //--------------
         // audio load mode
-        if (((mode != MODE_STREAM) && (mode != MODE_STATIC)) ||
+        if (((mode != MODE_STREAM) && (mode != MODE_STATIC) && (mode != MODE_STREAM_DIRECT)) ||
                 ((mode != MODE_STREAM) && !AudioFormat.isEncodingLinearPcm(mAudioFormat))) {
             throw new IllegalArgumentException("Invalid mode.");

Now you can build normal RK Kodi apk from this source
https://github.com/zidootech/zidoo-kodi-15.1/tree/zidoo-rk3368-16.0b4

It is also possible to rebase RK changes in above code to official Kodi Jarvis 16 Final branch and build it.

TNX for the post!

This article was truly outstanding; thank you for sharing! The CIPM new test bootcamp exam questions are crucial for promotion and salary growth—get them for free!

Such great content, no hesitation at all in liking it. Ready to take on the CIS-CSM valid test questions vce exam! Fingers crossed!

The content of the article is detailed, and I’ve learned many useful things. The C-BCSCX-2502 valid test camp pdf questions were key to my promotion and salary increase, and today I’m sharing them for free!

I gained a ton of value from the article. The Valid 350-401 test prep content is great, and you can enjoy it at no expense.