PAL: Handle deferred switch on every start
Consider SVA without lab case, if LPI<->NLPI switch is deferred when
second stage is getting processed, as stream will be in buffering state,
but after second stage detection, deferred switch is not getting handled.
Now, while doing every start, it will check if switch was deferred or not,
and handle it accordingly, as after every detection/rejection/lab data, stream
will get either unload or start event, and in case of unload we don't need to
do anything, for start we will handle it.
Change-Id: Ie7091c485ea6d4c6bdb83f6a535d027e4b934380
diff --git a/Pal.cpp b/Pal.cpp
index c18f4dd..46b3b86 100644
--- a/Pal.cpp
+++ b/Pal.cpp
@@ -290,6 +290,7 @@
int32_t pal_stream_start(pal_stream_handle_t *stream_handle)
{
Stream *s = NULL;
+ struct pal_stream_attributes sAttr;
std::shared_ptr<ResourceManager> rm = NULL;
int status;
if (!stream_handle) {
@@ -313,6 +314,11 @@
goto exit;
}
+ s = reinterpret_cast<Stream *>(stream_handle);
+ s->getStreamAttributes(&sAttr);
+ if (sAttr.type == PAL_STREAM_VOICE_UI)
+ rm->handleDeferredSwitch();
+
rm->lockActiveStream();
if (!rm->isActiveStream(stream_handle)) {
rm->unlockActiveStream();
@@ -320,7 +326,6 @@
goto exit;
}
- s = reinterpret_cast<Stream *>(stream_handle);
status = rm->increaseStreamUserCounter(s);
if (0 != status) {
rm->unlockActiveStream();