summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Ekström <jeebjp@gmail.com>2018-03-24 03:30:51 +0200
committerJan Ekström <jeebjp@gmail.com>2018-03-24 03:43:57 +0200
commit59a04562b1d72cb6aaddb88332e26b599f30c14c (patch)
tree3cca4693558e39fed7a30666bb7f61cb794d798a
parentaaa076b63185e3692a7d48f8d1272aa6bacf3f3f (diff)
downloadmpv-59a04562b1d72cb6aaddb88332e26b599f30c14c.tar.bz2
mpv-59a04562b1d72cb6aaddb88332e26b599f30c14c.tar.xz
ao_opensles: re-flow interface/configuration retrieval
This manages to make the code more readable. Thanks to MakeGho@IRCnet for the snippet on which this was based.
-rw-r--r--audio/out/ao_opensles.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/audio/out/ao_opensles.c b/audio/out/ao_opensles.c
index f54f4db035..b03aa8a555 100644
--- a/audio/out/ao_opensles.c
+++ b/audio/out/ao_opensles.c
@@ -205,16 +205,25 @@ static int init(struct ao *ao)
SLAndroidConfigurationItf android_config;
SLuint32 audio_latency = 0, value_size = sizeof(SLuint32);
- SLint32 result = (*p->player)->GetInterface(p->player,
- SL_IID_ANDROIDCONFIGURATION, &android_config);
- if (result == SL_RESULT_SUCCESS) {
- result = (*android_config)->GetConfiguration(android_config,
+
+ SLint32 get_interface_result = (*p->player)->GetInterface(
+ p->player,
+ SL_IID_ANDROIDCONFIGURATION,
+ &android_config
+ );
+
+ if (get_interface_result == SL_RESULT_SUCCESS) {
+ SLint32 get_configuration_result = (*android_config)->GetConfiguration(
+ android_config,
(const SLchar *)"androidGetAudioLatency",
- &value_size, &audio_latency);
- }
- if (result == SL_RESULT_SUCCESS) {
- p->audio_latency = (double)audio_latency / 1000.0;
- MP_INFO(ao, "Device latency is %f\n", p->audio_latency);
+ &value_size,
+ &audio_latency
+ );
+
+ if (get_configuration_result == SL_RESULT_SUCCESS) {
+ p->audio_latency = (double)audio_latency / 1000.0;
+ MP_INFO(ao, "Device latency is %f\n", p->audio_latency);
+ }
}
return 1;