Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #3316 from FernetMenta/paplayer

Paplayer fixes (hail to the king baby)
  • Loading branch information...
commit c23ec5920877b716277b366b16020fd80dfaee08 2 parents e858506 + 51a1224
Peter Frühberger fritsch authored
16 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
View
@@ -1041,10 +1041,20 @@ void CActiveAE::Configure(AEAudioFormat *desiredFmt)
CActiveAEStream* CActiveAE::CreateStream(MsgStreamNew *streamMsg)
{
// we only can handle a single pass through stream
- if (!m_streams.empty())
+ bool hasRawStream = false;
+ bool hasStream = false;
+ std::list<CActiveAEStream*>::iterator it;
+ for(it = m_streams.begin(); it != m_streams.end(); ++it)
{
- if (AE_IS_RAW(m_streams.front()->m_format.m_dataFormat) || AE_IS_RAW(streamMsg->format.m_dataFormat))
- return NULL;
+ if((*it)->IsDrained())
+ continue;
+ if(AE_IS_RAW((*it)->m_format.m_dataFormat))
+ hasRawStream = true;
+ hasStream = true;
+ }
+ if (hasRawStream || (hasStream && AE_IS_RAW(streamMsg->format.m_dataFormat)))
+ {
+ return NULL;
}
// create the stream
30 xbmc/cores/paplayer/PAPlayer.cpp
View
@@ -317,7 +317,9 @@ bool PAPlayer::QueueNextFileEx(const CFileItem &file, bool fadeIn/* = true */, b
// check if we advance a track of a CUE sheet
// if this is the case we don't need to open a new stream
- if (file.GetMusicInfoTag()->GetURL().Equals(m_FileItem->GetMusicInfoTag()->GetURL()) &&
+ std::string newURL = file.GetMusicInfoTag() ? file.GetMusicInfoTag()->GetURL() : file.GetPath();
+ std::string oldURL = m_FileItem->GetMusicInfoTag() ? m_FileItem->GetMusicInfoTag()->GetURL() : m_FileItem->GetPath();
+ if (newURL.compare(oldURL) == 0 &&
file.m_lStartOffset &&
file.m_lStartOffset == m_FileItem->m_lEndOffset &&
m_currentStream && m_currentStream->m_prepareTriggered)
@@ -368,8 +370,6 @@ bool PAPlayer::QueueNextFileEx(const CFileItem &file, bool fadeIn/* = true */, b
CThread::Sleep(1);
}
- UpdateCrossfadeTime(file);
-
/* init the streaminfo struct */
si->m_decoder.GetDataFormat(&si->m_channelInfo, &si->m_sampleRate, &si->m_encodedSampleRate, &si->m_dataFormat);
si->m_startOffset = file.m_lStartOffset * 1000 / 75;
@@ -398,10 +398,22 @@ bool PAPlayer::QueueNextFileEx(const CFileItem &file, bool fadeIn/* = true */, b
si->m_prepareNextAtFrame = (int)((streamTotalTime - TIME_TO_CACHE_NEXT_FILE - m_defaultCrossfadeMS) * si->m_sampleRate / 1000.0f);
}
- si->m_prepareTriggered = false;
+ if (m_currentStream && (AE_IS_RAW(m_currentStream->m_dataFormat) || AE_IS_RAW(si->m_dataFormat)))
+ {
+ m_currentStream->m_prepareTriggered = false;
+ m_currentStream->m_waitOnDrain = true;
+ m_currentStream->m_prepareNextAtFrame = 0;
+ si->m_decoder.Destroy();
+ delete si;
+ return false;
+ }
+
+ UpdateCrossfadeTime(file);
+ si->m_prepareTriggered = false;
si->m_playNextAtFrame = 0;
si->m_playNextTriggered = false;
+ si->m_waitOnDrain = false;
if (!PrepareStream(si))
{
@@ -606,6 +618,11 @@ inline void PAPlayer::ProcessStreams(double &delay, double &buffer)
{
if (!si->m_prepareTriggered)
{
+ if (si->m_waitOnDrain)
+ {
+ si->m_stream->Drain(true);
+ si->m_waitOnDrain = false;
+ }
si->m_prepareTriggered = true;
m_callback.OnQueueNextItem();
}
@@ -621,6 +638,11 @@ inline void PAPlayer::ProcessStreams(double &delay, double &buffer)
/* if it didnt trigger the next queue item */
if (!si->m_prepareTriggered)
{
+ if (si->m_waitOnDrain)
+ {
+ si->m_stream->Drain(true);
+ si->m_waitOnDrain = false;
+ }
m_callback.OnQueueNextItem();
si->m_prepareTriggered = true;
}
1  xbmc/cores/paplayer/PAPlayer.h
View
@@ -120,6 +120,7 @@ friend class CQueueNextFileJob;
float m_volume; /* the initial volume level to set the stream to on creation */
bool m_isSlaved; /* true if the stream has been slaved to another */
+ bool m_waitOnDrain; /* wait for stream being drained in AE */
} StreamInfo;
typedef std::list<StreamInfo*> StreamList;
Please sign in to comment.
Something went wrong with that request. Please try again.