shutdown channel if tune fails
authorFelix Domke <tmbinc@elitedvb.net>
Tue, 15 Nov 2005 23:06:24 +0000 (23:06 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Tue, 15 Nov 2005 23:06:24 +0000 (23:06 +0000)
lib/dvb/dvb.cpp

index 0201b33..32c7ea3 100644 (file)
@@ -491,7 +491,18 @@ RESULT eDVBChannel::setChannel(const eDVBChannelID &channelid)
        m_channel_id = channelid;
        m_mgr->addChannel(channelid, this);
        m_state = state_tuning;
        m_channel_id = channelid;
        m_mgr->addChannel(channelid, this);
        m_state = state_tuning;
-       return m_frontend->get().tune(*feparm);
+                       /* if tuning fails, shutdown the channel immediately. */
+       int res;
+       res = m_frontend->get().tune(*feparm);
+       
+       if (res)
+       {
+               m_state = state_release;
+               m_stateChanged(this);
+               return res;
+       }
+       
+       return 0;
 }
 
 RESULT eDVBChannel::connectStateChange(const Slot1<void,iDVBChannel*> &stateChange, ePtr<eConnection> &connection)
 }
 
 RESULT eDVBChannel::connectStateChange(const Slot1<void,iDVBChannel*> &stateChange, ePtr<eConnection> &connection)