diff options
author | Paul ADENOT <[email protected]> | 2013-10-17 17:07:31 +0200 |
---|---|---|
committer | Paul ADENOT <[email protected]> | 2013-10-17 17:07:31 +0200 |
commit | 1b8702d0003f93b24974432ab667bee2ed4b041f (patch) | |
tree | 980f07b940479d53f59a29d8817363e95c1ff4bf /src/cubeb_audiotrack.c | |
parent | 3706c48b82a6df6e120fe853f568a55f86ed1abc (diff) | |
download | cubeb-1b8702d0003f93b24974432ab667bee2ed4b041f.tar.gz cubeb-1b8702d0003f93b24974432ab667bee2ed4b041f.zip |
Mozilla Bug 907817
Add a cubeb API to get a valid audio latency range per platform.
Diffstat (limited to 'src/cubeb_audiotrack.c')
-rw-r--r-- | src/cubeb_audiotrack.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/cubeb_audiotrack.c b/src/cubeb_audiotrack.c index 0df7b03..2ace7d6 100644 --- a/src/cubeb_audiotrack.c +++ b/src/cubeb_audiotrack.c @@ -290,6 +290,24 @@ audiotrack_get_max_channel_count(cubeb * ctx, uint32_t * max_channels) return CUBEB_OK; } +static int +audiotrack_get_min_latency(cubeb * ctx, cubeb_stream_params params, uint32_t * latency_ms) +{ + /* We always use the lowest latency possible when using this backend (see + * audiotrack_stream_init), so this value is not going to be used. */ + int rv; + + rv = audiotrack_get_min_frame_count(ctx, ¶ms, latency_ms); + if (rv != CUBEB_OK) { + return CUBEB_ERROR; + } + + /* Convert to milliseconds. */ + *latency_ms = *latency_ms * 1000 / params.rate; + + return CUBEB_OK; +} + void audiotrack_destroy(cubeb * context) { @@ -443,6 +461,7 @@ static struct cubeb_ops const audiotrack_ops = { .init = audiotrack_init, .get_backend_id = audiotrack_get_backend_id, .get_max_channel_count = audiotrack_get_max_channel_count, + .get_min_latency = audiotrack_get_min_latency, .destroy = audiotrack_destroy, .stream_init = audiotrack_stream_init, .stream_destroy = audiotrack_stream_destroy, |