hal: Offload bugfixes
* Always reset the bit width and sample rate if any active offload
stream is different. Failure to do this can crash the DSP, and
certain limitations come into play when a high samplerate is used
such as effects being unavailable.
* Don't send errors to the framework when the timestamp query fails
before the stream is up and running.
Change-Id: Ieeaafe8965e3cdc69b8dd64be85fbb3bf48c020b
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 51e8188..a4138f1 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -1958,7 +1958,10 @@
set_snd_card_state(adev,SND_CARD_STATE_OFFLINE);
return -EINVAL;
} else if(ret < 0) {
- ALOGE(" ERROR: Unable to get time stamp from compress driver");
+ if (out->compr == NULL) {
+ return 0;
+ }
+ ALOGE(" ERROR: Unable to get time stamp from compress driver ret=%d", ret);
return -EINVAL;
} else {
return 0;
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index fba4047..09c57dc 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -2244,7 +2244,7 @@
if ((adev->cur_codec_backend_bit_width == CODEC_BACKEND_DEFAULT_BIT_WIDTH &&
adev->cur_codec_backend_samplerate != CODEC_BACKEND_DEFAULT_SAMPLE_RATE) ||
- (adev->cur_codec_backend_samplerate < sample_rate)) {
+ (adev->cur_codec_backend_samplerate != sample_rate)) {
char *rate_str = NULL;
const char * mixer_ctl_name = "SLIM_0_RX SampleRate";
@@ -2339,10 +2339,10 @@
if (out != NULL ) {
ALOGV("Offload playback running bw %d sr %d",
out->bit_width, out->sample_rate);
- if (*new_bit_width < out->bit_width) {
+ if (*new_bit_width != out->bit_width) {
*new_bit_width = out->bit_width;
}
- if (*new_sample_rate < out->sample_rate) {
+ if (*new_sample_rate != out->sample_rate) {
*new_sample_rate = out->sample_rate;
}
}