Merge "support changing audio-hw-sync-id during playback." am: 507764f6a8 am: 2dd3576872 am: 0abd962e42
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1648069 Change-Id: Ic60a0a502de6297278e253547321d782026564c5
This commit is contained in:
@@ -4499,14 +4499,25 @@ final public class MediaCodec {
|
||||
|
||||
int i = 0;
|
||||
for (final String key: params.keySet()) {
|
||||
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);
|
||||
if (key.equals(MediaFormat.KEY_AUDIO_SESSION_ID)) {
|
||||
int sessionId = 0;
|
||||
try {
|
||||
sessionId = (Integer)params.get(key);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("Wrong Session ID Parameter!");
|
||||
}
|
||||
keys[i] = "audio-hw-sync";
|
||||
values[i] = AudioSystem.getAudioHwSyncForSession(sessionId);
|
||||
} 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user