Firefly Open Source Community
Title:
How to add RK Kodi 16 Support to Firefly RK3288
[Print This Page]
Author:
dewet
Time:
3/5/2016 11:33
Title:
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.");
Copy the code
Now you can build normal RK Kodi apk from this source
https://github.com/zidootech/zid ... 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.
Author:
mac_l1
Time:
3/5/2016 23:59
TNX for the post!
Welcome Firefly Open Source Community (https://bbs.t-firefly.com/)
Powered by Discuz! X3.1