mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 06:39:01 +08:00
nuttx/audio: Direct return non-format configure operation
protect configure lower only once Signed-off-by: yangyalei <yangyalei@xiaomi.com>
This commit is contained in:
+10
-9
@@ -354,18 +354,19 @@ static int audio_configure(FAR struct audio_upperhalf_s *upper,
|
||||
#else
|
||||
ret = lower->ops->configure(lower, caps);
|
||||
#endif
|
||||
|
||||
if (ret == OK && (caps->ac_type == AUDIO_TYPE_INPUT ||
|
||||
caps->ac_type == AUDIO_TYPE_OUTPUT))
|
||||
if (ret < 0 || (caps->ac_type != AUDIO_TYPE_INPUT &&
|
||||
caps->ac_type != AUDIO_TYPE_OUTPUT))
|
||||
{
|
||||
audio_setstate(upper, AUDIO_STATE_PREPARED);
|
||||
upper->info.format = caps->ac_subtype;
|
||||
upper->info.channels = caps->ac_channels;
|
||||
upper->info.subformat = caps->ac_controls.b[2];
|
||||
upper->info.samplerate = caps->ac_controls.hw[0] |
|
||||
(caps->ac_controls.b[3] << 16);
|
||||
return ret;
|
||||
}
|
||||
|
||||
audio_setstate(upper, AUDIO_STATE_PREPARED);
|
||||
upper->info.format = caps->ac_subtype;
|
||||
upper->info.channels = caps->ac_channels;
|
||||
upper->info.subformat = caps->ac_controls.b[2];
|
||||
upper->info.samplerate =
|
||||
caps->ac_controls.hw[0] | (caps->ac_controls.b[3] << 16);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user