Skip to content

Commit

Permalink
Merge pull request #4232 from Montellese/upnp_player_stop_on_start_fix
Browse files Browse the repository at this point in the history
upnp: executing AVTransport's Stop action in state NO_MEDIA_PRESENT is not allowed
  • Loading branch information
t-nelson committed Feb 20, 2014
2 parents b4f1ac4 + 4bed85e commit 3427167
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions xbmc/network/upnp/UPnPPlayer.cpp
Expand Up @@ -250,15 +250,24 @@ 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());
/* dlna specifies that a return code of 705 should be returned
* if TRANSPORT_STATE is not STOPPED or NO_MEDIA_PRESENT */
NPT_CHECK_LABEL_SEVERE(m_control->Stop(m_delegate->m_device
, m_delegate->m_instance
, m_delegate), failed);
NPT_CHECK_LABEL_SEVERE(WaitOnEvent(m_delegate->m_resevent, timeout, dialog), failed);
NPT_CHECK_LABEL_SEVERE(m_delegate->m_resstatus, failed);
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());
NPT_CHECK_LABEL_SEVERE(m_control->Stop(m_delegate->m_device
, m_delegate->m_instance
, 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());
Expand Down

0 comments on commit 3427167

Please sign in to comment.