diff options
author | Paul McLean <pmclean@google.com> | 2016-05-25 13:30:54 -0600 |
---|---|---|
committer | Paul McLean <pmclean@google.com> | 2016-05-25 14:45:47 -0600 |
commit | 9a1c30572b3b27e66cb7d50fd89ae52e22d8718c (patch) | |
tree | cd6e1ea5ec8287b9e06e9930790016c1dc4dea1e | |
parent | 1d585cc7ab82ae96b95fcc85457e1834b08eabcf (diff) | |
download | libhardware-9a1c30572b3b27e66cb7d50fd89ae52e22d8718c.tar.gz |
Ensure we get a default sample rate for "query" cases in open_input_device().
Bug: 28474561
Change-Id: I2946dda95ab47bd38a582f49e566541bc4e20bbf
-rw-r--r-- | modules/usbaudio/audio_hal.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/usbaudio/audio_hal.c b/modules/usbaudio/audio_hal.c index 4b3305c7..fe4a88e8 100644 --- a/modules/usbaudio/audio_hal.c +++ b/modules/usbaudio/audio_hal.c @@ -912,11 +912,11 @@ static int adev_open_input_stream(struct audio_hw_device *dev, /* Rate */ if (config->sample_rate == 0) { - proxy_config.rate = config->sample_rate = profile_get_default_sample_rate(in->profile); - } else if (in->dev->device_sample_rate != 0 && /* we are playing, so lock the rate */ - in->dev->device_sample_rate >= RATELOCK_THRESHOLD) { /* but only for high - sample rates */ - // Lock the rate to the output rate + config->sample_rate = profile_get_default_sample_rate(in->profile); + } + + if (in->dev->device_sample_rate != 0 && /* we are playing, so lock the rate */ + in->dev->device_sample_rate >= RATELOCK_THRESHOLD) {/* but only for high sample rates */ ret = config->sample_rate != in->dev->device_sample_rate ? -EINVAL : 0; proxy_config.rate = config->sample_rate = in->dev->device_sample_rate; } else if (profile_is_sample_rate_valid(in->profile, config->sample_rate)) { |