summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Reufer <thomas@reufer.ch>2015-03-23 20:00:00 +0100
committerThomas Reufer <thomas@reufer.ch>2015-03-23 20:00:00 +0100
commit1cb004cce6cd8f808d8793d9a8f3eca28971bdb0 (patch)
tree9d3da53d97eacdcdc5d4ec27cbfb7bae16438ebc
parentf489637bfa7fdf9fc32c8b4a793b2866533f5b77 (diff)
downloadvdr-plugin-rpihddevice-1cb004cce6cd8f808d8793d9a8f3eca28971bdb0.tar.gz
vdr-plugin-rpihddevice-1cb004cce6cd8f808d8793d9a8f3eca28971bdb0.tar.bz2
lock OMX mutex during port event handling, flushing and codec change
-rw-r--r--omx.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/omx.c b/omx.c
index 2e21e2f..03478ac 100644
--- a/omx.c
+++ b/omx.c
@@ -210,6 +210,7 @@ void cOmx::Action(void)
void cOmx::HandlePortSettingsChanged(unsigned int portId)
{
+ Lock();
DBG("HandlePortSettingsChanged(%d)", portId);
switch (portId)
@@ -313,6 +314,8 @@ void cOmx::HandlePortSettingsChanged(unsigned int portId)
ELOG("failed to enable video render!");
break;
}
+
+ Unlock();
}
void cOmx::OnBufferEmpty(void *instance, COMPONENT_T *comp)
@@ -804,6 +807,8 @@ void cOmx::SetMute(bool mute)
void cOmx::StopVideo(void)
{
+ Lock();
+
// put video decoder into idle
ilclient_change_component_state(m_comp[eVideoDecoder], OMX_StateIdle);
@@ -836,6 +841,7 @@ void cOmx::StopVideo(void)
m_videoFormat.interlaced = false;
m_handlePortEvents = false;
+ Unlock();
}
void cOmx::StopAudio(void)
@@ -874,6 +880,8 @@ void cOmx::FlushAudio(void)
void cOmx::FlushVideo(bool flushRender)
{
+ Lock();
+
if (OMX_SendCommand(ILC_GET_HANDLE(m_comp[eVideoDecoder]), OMX_CommandFlush, 130, NULL) != OMX_ErrorNone)
ELOG("failed to flush video decoder!");
@@ -890,10 +898,13 @@ void cOmx::FlushVideo(bool flushRender)
ilclient_flush_tunnels(&m_tun[eClockToVideoScheduler], 1);
m_setVideoDiscontinuity = true;
+ Unlock();
}
int cOmx::SetVideoCodec(cVideoCodec::eCodec codec)
{
+ Lock();
+
if (ilclient_change_component_state(m_comp[eVideoDecoder], OMX_StateIdle) != 0)
ELOG("failed to set video decoder to idle state!");
@@ -945,6 +956,7 @@ int cOmx::SetVideoCodec(cVideoCodec::eCodec codec)
m_handlePortEvents = true;
+ Unlock();
return 0;
}
@@ -962,6 +974,8 @@ void cOmx::SetVideoDecoderExtraBuffers(int extraBuffers)
int cOmx::SetupAudioRender(cAudioCodec::eCodec outputFormat, int channels,
cRpiAudioPort::ePort audioPort, int samplingRate, int frameSize)
{
+ Lock();
+
OMX_AUDIO_PARAM_PORTFORMATTYPE format;
OMX_INIT_STRUCT(format);
format.nPortIndex = 100;
@@ -1099,6 +1113,7 @@ int cOmx::SetupAudioRender(cAudioCodec::eCodec outputFormat, int channels,
if (ilclient_setup_tunnel(&m_tun[eClockToAudioRender], 0, 0) != 0)
ELOG("failed to setup up tunnel from clock to audio render!");
+ Unlock();
return 0;
}