audio: Remove unneeded padding

This commit is contained in:
Hajime Hoshi 2016-05-31 22:32:10 +09:00
parent 3ce8122557
commit a95edaceba

View File

@ -102,20 +102,6 @@ static char* initAudioTrack(uintptr_t java_vm, uintptr_t jni_env,
// Note that *audioTrack will never be released. // Note that *audioTrack will never be released.
*audioTrack = (*env)->NewGlobalRef(env, tmpAudioTrack); *audioTrack = (*env)->NewGlobalRef(env, tmpAudioTrack);
// Enqueue empty bytes before playing to avoid underrunning.
// TODO: Is this really needed? At least, SDL doesn't do the same thing.
jint writtenBytes = 0;
do {
const int length = 1024;
jbyteArray arr = (*env)->NewByteArray(env, length);
writtenBytes =
(*env)->CallIntMethod(
env, *audioTrack,
(*env)->GetMethodID(env, android_media_AudioTrack, "write", "([BII)I"),
arr, 0, length);
} while (writtenBytes != 0);
// TODO: Check if writtenBytes < 0
(*env)->CallVoidMethod( (*env)->CallVoidMethod(
env, *audioTrack, env, *audioTrack,
(*env)->GetMethodID(env, android_media_AudioTrack, "play", "()V")); (*env)->GetMethodID(env, android_media_AudioTrack, "play", "()V"));