summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2022-08-10 03:08:32 -0700
committerLinux Build Service Account <lnxbuild@localhost>2022-08-10 03:08:32 -0700
commitbed993f6e65f32fe5c6c0dcd7f407f80c175f6f0 (patch)
tree505fdad19e8775d5e95b055aa4e6737c03c77738
parentfa709aea81e37ec29db54f343b37e3a2f549cbb4 (diff)
parentd23bf389c25131a324ee30c6a18918d266ae905e (diff)
Merge d23bf389c25131a324ee30c6a18918d266ae905e on remote branch
Change-Id: I2aabf6f331fd482099fb578a68e2ac065ed7fc86
-rw-r--r--hal/AudioDevice.cpp6
-rw-r--r--hal/AudioStream.cpp13
-rw-r--r--hal/audio_extn/FM.cpp1
3 files changed, 17 insertions, 3 deletions
diff --git a/hal/AudioDevice.cpp b/hal/AudioDevice.cpp
index fa6b63fc..9abb9926 100644
--- a/hal/AudioDevice.cpp
+++ b/hal/AudioDevice.cpp
@@ -1300,7 +1300,7 @@ int AudioDevice::add_input_headset_if_usb_out_headset(int *device_count,
int AudioDevice::SetParameters(const char *kvpairs) {
int ret = 0, val = 0;
- struct str_parms *parms;
+ struct str_parms *parms = NULL;
char value[256];
int pal_device_count = 0;
pal_device_id_t* pal_device_ids = NULL;
@@ -1321,7 +1321,7 @@ int AudioDevice::SetParameters(const char *kvpairs) {
if (!parms) {
AHAL_ERR("Error in str_parms_create_str");
ret = 0;
- goto exit;
+ return ret;
}
AudioExtn::audio_extn_set_parameters(adev_, parms);
@@ -1633,6 +1633,8 @@ int AudioDevice::SetParameters(const char *kvpairs) {
}
AHAL_INFO("pal set param sucess for device disconnect");
}
+ usb_input_dev_enabled = false;
+ AHAL_DBG("usb_input_dev_enabled flag is cleared.");
}
}
diff --git a/hal/AudioStream.cpp b/hal/AudioStream.cpp
index bcfb3a78..d320f155 100644
--- a/hal/AudioStream.cpp
+++ b/hal/AudioStream.cpp
@@ -2806,6 +2806,19 @@ int StreamOutPrimary::GetFrames(uint64_t *frames)
*frames = 0;
return 0;
}
+ /*
+ * when ssr happens, dsp position for pcm offload could be 0,
+ * so return written frames instead
+ */
+ if ((PAL_STREAM_PCM_OFFLOAD == streamAttributes_.type) &&
+ (CARD_STATUS_OFFLINE == AudioDevice::sndCardState)) {
+ struct timespec ts;
+ *frames = GetFramesWritten(&ts);
+ mCachedPosition = *frames;
+ AHAL_DBG("card is offline, return written frames %lld", (long long) *frames);
+ goto exit;
+ }
+
ret = pal_get_timestamp(pal_stream_handle_, &tstamp);
if (ret != 0) {
AHAL_ERR("pal_get_timestamp failed %d", ret);
diff --git a/hal/audio_extn/FM.cpp b/hal/audio_extn/FM.cpp
index aa71726f..8c70b778 100644
--- a/hal/audio_extn/FM.cpp
+++ b/hal/audio_extn/FM.cpp
@@ -258,7 +258,6 @@ void fm_set_parameters(std::shared_ptr<AudioDevice> adev, struct str_parms *parm
pal_device_id_t *pal_devs;
char value[32] = {0};
float vol = 0.0;
- const char* p = str_parms_to_str(parms);
AHAL_DBG("Enter");