From 9c371ba0531ec6af3294bb830d7331daecf3500c Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Thu, 12 Dec 2013 18:35:39 +0100 Subject: [PATCH] Bug 947431 - Be more robust when getting the preferred sample rate when using the OpenSL backend. r=kinetik --HG-- extra : rebase_source : a55d98b9ce2cc6a9c2559d9589984faf8063c301 --- media/libcubeb/src/cubeb_opensl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/media/libcubeb/src/cubeb_opensl.c b/media/libcubeb/src/cubeb_opensl.c index e0fb6fc9b979..c2d5c8e86d16 100644 --- a/media/libcubeb/src/cubeb_opensl.c +++ b/media/libcubeb/src/cubeb_opensl.c @@ -275,6 +275,14 @@ opensl_get_preferred_sample_rate(cubeb * ctx, uint32_t * rate) dlclose(libmedia); + /* Depending on which method we called above, we can get a zero back, yet have + * a non-error return value, especially if the audio system is not + * ready/shutting down (i.e. when we can't get our hand on the AudioFlinger + * thread). */ + if (rate == 0) { + return CUBEB_ERROR; + } + return CUBEB_OK; }