--- a/src/ohproduct.cxx
+++ b/src/ohproduct.cxx
@@ -274,6 +274,7 @@
m_dev->m_ohif->setMetatext("");
+ bool ok = true;
string curtp = o_sources[m_sourceIndex].first;
string curnm = o_sources[m_sourceIndex].second;
if (m_dev->m_ohpl && !curtp.compare("Playlist") &&
@@ -290,17 +291,20 @@
!curtp.compare("Playlist") &&
!curnm.compare(SndRcvPLName)) {
m_dev->m_ohpl->setActive(false);
- m_dev->m_sndrcv->stop();
+ ok = m_dev->m_sndrcv->stop();
} else if (m_dev->m_sndrcv && m_dev->m_ohrd &&
!curtp.compare("Radio") &&
!curnm.compare(SndRcvRDName)) {
m_dev->setRadio(false);
m_dev->m_ohrd->setActive(false);
- m_dev->m_sndrcv->stop();
+ ok = m_dev->m_sndrcv->stop();
} else {
// External inputs managed by scripts Analog/Digital/Hdmi etc.
- m_dev->m_sndrcv->stop();
- }
+ ok = m_dev->m_sndrcv->stop();
+ }
+
+ if (!ok)
+ return UPNP_E_INTERNAL_ERROR;
string newtp = o_sources[sindex].first;
string newnm = o_sources[sindex].second;
@@ -313,22 +317,22 @@
m_dev->m_ohrd->setActive(true);
} else if (m_dev->m_ohpl && m_dev->m_sndrcv &&
!newnm.compare(SndRcvPLName)) {
- m_dev->m_sndrcv->start(string(), 0 /*savedms*/);
+ ok = m_dev->m_sndrcv->start(string(), 0 /*savedms*/);
m_dev->m_ohpl->setActive(true);
} else if (m_dev->m_ohrd && m_dev->m_sndrcv &&
!newnm.compare(SndRcvRDName)) {
- m_dev->m_sndrcv->start(string());
+ ok = m_dev->m_sndrcv->start(string());
m_dev->m_ohrd->setActive(true);
} else {
string sname = newtp + "-" + newnm;
string spath = path_cat(scripts_dir, sname);
- m_dev->m_sndrcv->start(spath);
+ ok = m_dev->m_sndrcv->start(spath);
}
m_sourceIndex = sindex;
m_dev->loopWakeup();
- return UPNP_E_SUCCESS;
+ return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
}
int OHProduct::setSourceIndex(const SoapIncoming& sc, SoapOutgoing&)