hrydgard/native — pull request #79 by unknownbrackets (2013-05-25 21:37:07+00:00)
Title: Play only the rendered/valid samples in SLES

Before:

0. init -> render to buffer 0
0. init -> enqueue empty buffer 0
1. callback -> enqueue empty buffer 1
1. callback -> render to buffer 0
2. callback -> enqueue buffer 0
2. callback -> render to buffer 1

This swaps the order (render to buffer and enqueue it within the callback.) According to the documentation I found, the callback is triggered whenever a buffer has finished - meaning, it still has the other buffer to play. So it synchronously renders before enqueuing.

Also sleeps since you can't send 0 to the API, and the callback chain can't be broken so it MUST enqueue.

Lastly, it plays only the valid part of the buffer, instead of the full thing.

This improves delays a bit for me, but I've been wrong before (today even.)

-[Unknown]