upnp: executing Stop() in state NO_MEDIA_PRESENT is not allowed
authormontellese <montellese@xbmc.org>
Mon, 17 Feb 2014 20:37:49 +0000 (21:37 +0100)
committermontellese <montellese@xbmc.org>
Mon, 17 Feb 2014 20:42:46 +0000 (21:42 +0100)
xbmc/network/upnp/UPnPPlayer.cpp

index 72c7e96..c9fa211 100644 (file)
@@ -250,7 +250,17 @@ int CUPnPPlayer::PlayFile(const CFileItem& file, const CPlayerOptions& options,
   NPT_Cardinal res_index;
   NPT_CHECK_LABEL_SEVERE(m_control->FindBestResource(m_delegate->m_device, *obj, res_index), failed);
 
+  // get the transport info to evaluate the TransportState to be able to
+  // determine whether we first need to call Stop()
+  timeout.Set(timeout.GetInitialTimeoutValue());
+  NPT_CHECK_LABEL_SEVERE(m_control->GetTransportInfo(m_delegate->m_device
+                                                     , m_delegate->m_instance
+                                                     , m_delegate), failed);
+  NPT_CHECK_LABEL_SEVERE(WaitOnEvent(m_delegate->m_traevnt, timeout, dialog), failed);
 
+  if (m_delegate->m_trainfo.cur_transport_state != "NO_MEDIA_PRESENT" &&
+      m_delegate->m_trainfo.cur_transport_state != "STOPPED")
+  {
   timeout.Set(timeout.GetInitialTimeoutValue());
   /* dlna specifies that a return code of 705 should be returned
    * if TRANSPORT_STATE is not STOPPED or NO_MEDIA_PRESENT */
@@ -259,6 +269,7 @@ int CUPnPPlayer::PlayFile(const CFileItem& file, const CPlayerOptions& options,
                                          , m_delegate), failed);
   NPT_CHECK_LABEL_SEVERE(WaitOnEvent(m_delegate->m_resevent, timeout, dialog), failed);
   NPT_CHECK_LABEL_SEVERE(m_delegate->m_resstatus, failed);
+  }
 
 
   timeout.Set(timeout.GetInitialTimeoutValue());