Skip to content

Commit

Permalink
VideoPlayer: finish old a/v stream before opening a new stream
Browse files Browse the repository at this point in the history
  • Loading branch information
FernetMenta committed Dec 11, 2015
1 parent ea5356c commit b14a05a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions xbmc/cores/VideoPlayer/VideoPlayer.cpp
Expand Up @@ -1398,6 +1398,12 @@ void CVideoPlayer::Process()
if(next == CDVDInputStream::NEXTSTREAM_OPEN)
{
SAFE_DELETE(m_pDemuxer);

SetCaching(CACHESTATE_DONE);
CLog::Log(LOGNOTICE, "VideoPlayer: next stream, wait for old streams to be finished");
CloseStream(m_CurrentAudio, true);
CloseStream(m_CurrentVideo, true);

m_CurrentAudio.stream = NULL;
m_CurrentVideo.stream = NULL;
m_CurrentSubtitle.stream = NULL;
Expand Down
3 changes: 2 additions & 1 deletion xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp
Expand Up @@ -194,7 +194,8 @@ void CVideoPlayerAudio::CloseStream(bool bWaitForBuffers)
bool bWait = bWaitForBuffers && m_speed > 0 && !CAEFactory::IsSuspended();

// wait until buffers are empty
if (bWait) m_messageQueue.WaitUntilEmpty();
if (bWait)
m_messageQueue.WaitUntilEmpty();

// send abort message to the audio queue
m_messageQueue.Abort();
Expand Down
3 changes: 2 additions & 1 deletion xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp
Expand Up @@ -249,7 +249,8 @@ void CVideoPlayerVideo::OpenStream(CDVDStreamInfo &hint, CDVDVideoCodec* codec)
void CVideoPlayerVideo::CloseStream(bool bWaitForBuffers)
{
// wait until buffers are empty
if (bWaitForBuffers && m_speed > 0) m_messageQueue.WaitUntilEmpty();
if (bWaitForBuffers && m_speed > 0)
m_messageQueue.WaitUntilEmpty();

m_messageQueue.Abort();

Expand Down

0 comments on commit b14a05a

Please sign in to comment.