Skip to content

Commit

Permalink
[omx/image] fixed move global lock to the function begin and protect …
Browse files Browse the repository at this point in the history
…close
  • Loading branch information
huceke committed Oct 21, 2012
1 parent ff1b212 commit fc7b054
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions xbmc/cores/omxplayer/OMXImage.cpp
Expand Up @@ -79,6 +79,8 @@ COMXImage::~COMXImage()

void COMXImage::Close()
{
CSingleLock lock(g_OMXSection);

OMX_INIT_STRUCTURE(m_decoded_format);
OMX_INIT_STRUCTURE(m_encoded_format);
memset(&m_omx_image, 0x0, sizeof(OMX_IMAGE_PORTDEFINITIONTYPE));
Expand Down Expand Up @@ -502,6 +504,8 @@ bool COMXImage::ReadFile(const CStdString& inputFile)

bool COMXImage::Decode(unsigned width, unsigned height)
{
CSingleLock lock(g_OMXSection);

std::string componentName = "";
bool m_firstFrame = true;
unsigned int demuxer_bytes = 0;
Expand All @@ -511,8 +515,6 @@ bool COMXImage::Decode(unsigned width, unsigned height)

OMX_INIT_STRUCTURE(m_decoded_format);

CSingleLock lock(g_OMXSection);

if(!m_image_buffer)
{
CLog::Log(LOGERROR, "%s::%s no input buffer\n", CLASSNAME, __func__);
Expand Down Expand Up @@ -772,6 +774,8 @@ bool COMXImage::Decode(unsigned width, unsigned height)

bool COMXImage::Encode(unsigned char *buffer, int size, unsigned width, unsigned height)
{
CSingleLock lock(g_OMXSection);

std::string componentName = "";
unsigned int demuxer_bytes = 0;
const uint8_t *demuxer_content = NULL;
Expand All @@ -780,8 +784,6 @@ bool COMXImage::Encode(unsigned char *buffer, int size, unsigned width, unsigned
OMX_BUFFERHEADERTYPE *omx_buffer = NULL;
OMX_INIT_STRUCTURE(m_encoded_format);

CSingleLock lock(g_OMXSection);

if (!buffer || !size)
{
CLog::Log(LOGERROR, "%s::%s error no buffer\n", CLASSNAME, __func__);
Expand Down

0 comments on commit fc7b054

Please sign in to comment.