diff options
author | gimli <ebsi4711@gmail.com> | 2012-12-05 22:20:18 +0100 |
---|---|---|
committer | gimli <ebsi4711@gmail.com> | 2012-12-05 22:20:18 +0100 |
commit | 905d24866f85b2650b6a90af5659010132dc055d (patch) | |
tree | da40d4021e15c2eab408e41abba157bb3cac0e8e | |
parent | 066df752bf448982f083e303d65a9cf3cc86aa23 (diff) |
[rbp] fixed added a workaround for audio stream change hangs and moved omx clock execute out of the decoder
-rw-r--r-- | xbmc/cores/omxplayer/OMXAudio.cpp | 20 | ||||
-rw-r--r-- | xbmc/cores/omxplayer/OMXPlayerAudio.cpp | 29 | ||||
-rw-r--r-- | xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 5 | ||||
-rw-r--r-- | xbmc/cores/omxplayer/OMXVideo.cpp | 8 |
4 files changed, 45 insertions, 17 deletions
diff --git a/xbmc/cores/omxplayer/OMXAudio.cpp b/xbmc/cores/omxplayer/OMXAudio.cpp index 8d277fee02..5e6c0dfef5 100644 --- a/xbmc/cores/omxplayer/OMXAudio.cpp +++ b/xbmc/cores/omxplayer/OMXAudio.cpp @@ -312,7 +312,9 @@ bool COMXAudio::Initialize(AEAudioFormat format, std::string& device, OMXClock * std::string componentName = ""; componentName = "OMX.broadcom.audio_render"; - m_omx_render = new COMXCoreComponent(); + + if(!m_omx_render) + m_omx_render = new COMXCoreComponent(); if(!m_omx_render) { CLog::Log(LOGERROR, "COMXAudio::Initialize error allocate OMX.broadcom.audio_render\n"); @@ -552,8 +554,6 @@ bool COMXAudio::Initialize(AEAudioFormat format, std::string& device, OMXClock * CLog::Log(LOGDEBUG, "COMXAudio::Initialize device %s passthrough %d hwdecode %d", device.c_str(), m_Passthrough, m_HWDecode); - m_av_clock->OMXStateExecute(false); - return true; } @@ -569,7 +569,15 @@ bool COMXAudio::Deinitialize() m_omx_tunnel_clock.Deestablish(); if(!m_Passthrough) - m_omx_tunnel_mixer.Deestablish(); + { + // workaround for the strange BCM mixer component + if(m_omx_mixer.GetState() == OMX_StateExecuting) + m_omx_mixer.SetStateForComponent(OMX_StatePause); + if(m_omx_mixer.GetState() != OMX_StateIdle) + m_omx_mixer.SetStateForComponent(OMX_StateIdle); + m_omx_mixer.DisableAllPorts(); + m_omx_tunnel_mixer.Deestablish(true); + } m_omx_tunnel_decoder.Deestablish(); m_omx_decoder.FlushInput(); @@ -800,7 +808,7 @@ unsigned int COMXAudio::AddPackets(const void* data, unsigned int len, double dt m_last_pts = pts; - CLog::Log(LOGDEBUG, "ADec : setStartTime %f\n", (float)val / DVD_TIME_BASE); + CLog::Log(LOGDEBUG, "COMXAudio::Decode ADec : setStartTime %f\n", (float)val / DVD_TIME_BASE); m_av_clock->AudioStart(false); } else @@ -1157,6 +1165,8 @@ void COMXAudio::WaitCompletion() nTimeOut -= 50; } + m_omx_render->ResetEos(); + return; } diff --git a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp index 7991eabc16..afc2c9e533 100644 --- a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp +++ b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp @@ -386,8 +386,6 @@ bool OMXPlayerAudio::Decode(DemuxPacket *pkt, bool bDropPacket) if(CodecChange()) { - CloseDecoder(); - m_DecoderOpen = OpenDecoder(); if(!m_DecoderOpen) return false; @@ -437,8 +435,6 @@ bool OMXPlayerAudio::Decode(DemuxPacket *pkt, bool bDropPacket) { if(CodecChange()) { - CloseDecoder(); - m_DecoderOpen = OpenDecoder(); if(!m_DecoderOpen) return false; @@ -722,8 +718,15 @@ bool OMXPlayerAudio::OpenDecoder() m_passthrough = false; m_hw_decode = false; - m_av_clock->Lock(); - m_av_clock->OMXStop(false); + bool bSendParent = true; + + if(m_DecoderOpen) + { + WaitCompletion(); + m_omxAudio.Deinitialize(); + m_DecoderOpen = false; + bSendParent = true; + } /* setup audi format for audio render */ m_format.m_sampleRate = m_hints.samplerate; @@ -738,6 +741,9 @@ bool OMXPlayerAudio::OpenDecoder() else device = "local"; + m_av_clock->Lock(); + m_av_clock->OMXStop(false); + bool bAudioRenderOpen = m_omxAudio.Initialize(m_format, device, m_av_clock, m_hints, m_passthrough, m_hw_decode); m_codec_name = ""; @@ -754,10 +760,19 @@ bool OMXPlayerAudio::OpenDecoder() m_codec_name.c_str(), m_nChannels, m_hints.samplerate, m_hints.bitspersample); } + m_av_clock->OMXStateExecute(false); m_av_clock->HasAudio(bAudioRenderOpen); m_av_clock->OMXReset(false); m_av_clock->UnLock(); + m_started = false; + + // TODO : Send FLUSH to parent, only if we had a valid open codec. + // this is just a workaround to get the omx video decoder happy again + // This situation happens, for example where we have in the stream an audio codec change + if(bSendParent) + m_messageParent.Put(new CDVDMsg(CDVDMsg::GENERAL_FLUSH)); + return bAudioRenderOpen; } @@ -765,8 +780,8 @@ void OMXPlayerAudio::CloseDecoder() { m_av_clock->Lock(); m_av_clock->OMXStop(false); - m_av_clock->HasAudio(false); m_omxAudio.Deinitialize(); + m_av_clock->HasAudio(false); m_av_clock->OMXReset(false); m_av_clock->UnLock(); diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp index e427c33d40..318e133ac9 100644 --- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp @@ -195,8 +195,8 @@ bool OMXPlayerVideo::CloseStream(bool bWaitForBuffers) m_av_clock->Lock(); m_av_clock->OMXStop(false); - m_av_clock->HasVideo(false); m_omxVideo.Close(); + m_av_clock->HasVideo(false); m_av_clock->OMXReset(false); m_av_clock->UnLock(); @@ -714,6 +714,7 @@ bool OMXPlayerVideo::OpenDecoder() // use aspect in stream always m_fForcedAspectRatio = m_hints.aspect; + m_av_clock->Lock(); m_av_clock->OMXStop(false); @@ -743,9 +744,11 @@ bool OMXPlayerVideo::OpenDecoder() m_av_clock->SetRefreshRate(m_fFrameRate); } + m_av_clock->OMXStateExecute(false); m_av_clock->HasVideo(bVideoDecoderOpen); m_av_clock->OMXReset(false); m_av_clock->UnLock(); + return bVideoDecoderOpen; } diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp index 5cf93e031c..6de0ee9ba9 100644 --- a/xbmc/cores/omxplayer/OMXVideo.cpp +++ b/xbmc/cores/omxplayer/OMXVideo.cpp @@ -644,8 +644,6 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, bool deinterlace, b CLASSNAME, __func__, m_omx_decoder.GetComponent(), m_omx_decoder.GetInputPort(), m_omx_decoder.GetOutputPort(), m_deinterlace, m_hdmi_clock_sync); - m_av_clock->OMXStateExecute(false); - m_first_frame = true; return true; } @@ -689,6 +687,7 @@ void COMXVideo::Close() m_video_codec_name = ""; m_deinterlace = false; m_first_frame = true; + m_av_clock = NULL; } void COMXVideo::SetDropState(bool bDrop) @@ -718,7 +717,6 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double dts, double pts) if (demuxer_content && demuxer_bytes > 0) { - while(demuxer_bytes) { // 500ms timeout @@ -747,7 +745,7 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double dts, double pts) if(m_av_clock->VideoStart()) { omx_buffer->nFlags = OMX_BUFFERFLAG_STARTTIME; - CLog::Log(LOGDEBUG, "VDec : setStartTime %f\n", (float)val / DVD_TIME_BASE); + CLog::Log(LOGDEBUG, "OMXVideo::Decode VDec : setStartTime %f\n", (float)val / DVD_TIME_BASE); m_av_clock->VideoStart(false); } else @@ -1002,5 +1000,7 @@ void COMXVideo::WaitCompletion() nTimeOut -= 50; } + m_omx_render.ResetEos(); + return; } |