Merge "support changing audio-hw-sync-id during playback." am: 507764f6a8
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1648069 Change-Id: Ib2e72344a56be5393527f882514468982273ad8d
This commit is contained in:
@@ -4412,14 +4412,25 @@ final public class MediaCodec {
|
|||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (final String key: params.keySet()) {
|
for (final String key: params.keySet()) {
|
||||||
keys[i] = key;
|
if (key.equals(MediaFormat.KEY_AUDIO_SESSION_ID)) {
|
||||||
Object value = params.get(key);
|
int sessionId = 0;
|
||||||
|
try {
|
||||||
// Bundle's byte array is a byte[], JNI layer only takes ByteBuffer
|
sessionId = (Integer)params.get(key);
|
||||||
if (value instanceof byte[]) {
|
} catch (Exception e) {
|
||||||
values[i] = ByteBuffer.wrap((byte[])value);
|
throw new IllegalArgumentException("Wrong Session ID Parameter!");
|
||||||
|
}
|
||||||
|
keys[i] = "audio-hw-sync";
|
||||||
|
values[i] = AudioSystem.getAudioHwSyncForSession(sessionId);
|
||||||
} else {
|
} else {
|
||||||
values[i] = value;
|
keys[i] = key;
|
||||||
|
Object value = params.get(key);
|
||||||
|
|
||||||
|
// Bundle's byte array is a byte[], JNI layer only takes ByteBuffer
|
||||||
|
if (value instanceof byte[]) {
|
||||||
|
values[i] = ByteBuffer.wrap((byte[])value);
|
||||||
|
} else {
|
||||||
|
values[i] = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user