Skip to content

Loading…

paplayer handle prepare stream failure. #2129

Merged
merged 1 commit into from

2 participants

@ulion

I've encountered a crash in gdb after log message:

PAPlayer::PrepareStream - Failed to get IAEStream 

what cause crash is at line in PAPlayer::ProcessStream with si->m_stream == NULL:

    si->m_stream->RegisterAudioCallback(m_audioCallback);

I checked only place called PrepareStream is in PAPlayer::QueueNextFileEx where did not check failure, so here is the fix for it, please check whether it is correct..

@Memphiz
Team Kodi member

Any idea why preparestream fails? Though this looks good to me.

@jmarshallnz or whoever has a second opinion?

@ulion

this stream hit NULL normally not happens, but when the auido engine is suspended.
when I testing my ios code, my code sometimes didn't resume audio engine before play an item, which will wake up this crash, fix it is harmless and prevent unhappy crash anyway.
the log message updated.

@Memphiz Memphiz merged commit 1b3e098 into xbmc:master
@Memphiz
Team Kodi member

thx

@ulion ulion deleted the ulion:paplayer_prepare_stream_failure branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 28, 2013
  1. @ulion
Showing with 9 additions and 1 deletion.
  1. +9 −1 xbmc/cores/paplayer/PAPlayer.cpp
View
10 xbmc/cores/paplayer/PAPlayer.cpp
@@ -354,7 +354,15 @@ bool PAPlayer::QueueNextFileEx(const CFileItem &file, bool fadeIn/* = true */)
si->m_playNextAtFrame = 0;
si->m_playNextTriggered = false;
- PrepareStream(si);
+ if (!PrepareStream(si))
+ {
+ CLog::Log(LOGINFO, "PAPlayer::QueueNextFileEx - Error preparing stream");
+
+ si->m_decoder.Destroy();
+ delete si;
+ m_callback.OnQueueNextItem();
+ return false;
+ }
/* add the stream to the list */
CExclusiveLock lock(m_streamsLock);
Something went wrong with that request. Please try again.