[Libreoffice-commits] core.git: 2 commits - avmedia/source
Zolnai Tamás
tamas.zolnai at collabora.com
Wed May 28 21:05:49 PDT 2014
avmedia/source/opengl/oglplayer.cxx | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)
New commits:
commit 0e54f1266db4722428ed8fc9d9f3cb7e3cd34fed
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Thu May 29 05:48:54 2014 +0200
OGLPlayer: handle json parsing error
Change-Id: I86aea12318d4e21ccadd97ad2820e31bd4580c99
diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index fb94c5a..22ff457 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -234,7 +234,15 @@ uno::Reference< media::XPlayerWindow > SAL_CALL OGLPlayer::createPlayerWindow( c
m_pHandle->viewport.y = 0;
m_pHandle->viewport.width = aSize.Width();
m_pHandle->viewport.height = aSize.Height();
- gltf_renderer_set_content(m_pHandle);
+
+ // TODO: In libgltf different return values are defined (for different errors)
+ // but these error codes are not part of the library interface
+ int nRet = gltf_renderer_set_content(m_pHandle);
+ if( nRet != 0 )
+ {
+ SAL_WARN("avmedia.opengl", "Error occured while parsing *.json file! Error code: " << nRet);
+ return uno::Reference< media::XPlayerWindow >();
+ }
m_pOGLWindow = new OGLWindow(m_pHandle, &m_aContext, pChildWindow);
return uno::Reference< media::XPlayerWindow >( m_pOGLWindow );
}
@@ -254,7 +262,13 @@ uno::Reference< media::XFrameGrabber > SAL_CALL OGLPlayer::createFrameGrabber()
m_pHandle->viewport.y = 0;
m_pHandle->viewport.width = getPreferredPlayerWindowSize().Width;
m_pHandle->viewport.height = getPreferredPlayerWindowSize().Height;
- gltf_renderer_set_content(m_pHandle);
+
+ int nRet = gltf_renderer_set_content(m_pHandle);
+ if( nRet != 0 )
+ {
+ SAL_WARN("avmedia.opengl", "Error occured while parsing *.json file! Error code: " << nRet);
+ return uno::Reference< media::XFrameGrabber >();
+ }
OGLFrameGrabber *pFrameGrabber = new OGLFrameGrabber( m_pHandle );
return uno::Reference< media::XFrameGrabber >( pFrameGrabber );
}
commit 228c5099962b7b7574326e3c328db4165796e8a8
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Thu May 29 05:27:46 2014 +0200
OGLPlayer: check before dereference
Change-Id: I4bbaf97fe8c5def441ca106c26ad312281ed352f
diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index 4f17356..fb94c5a 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -31,14 +31,17 @@ OGLPlayer::OGLPlayer()
OGLPlayer::~OGLPlayer()
{
- for (size_t i = 0; i < m_pHandle->size; ++i)
+ if( m_pHandle )
{
- if (m_pHandle->files[i].type != GLTF_JSON)
+ for (size_t i = 0; i < m_pHandle->size; ++i)
{
- delete [] m_pHandle->files[i].buffer;
+ if (m_pHandle->files[i].type != GLTF_JSON)
+ {
+ delete [] m_pHandle->files[i].buffer;
+ }
}
+ gltf_renderer_release(m_pHandle);
}
- gltf_renderer_release(m_pHandle);
}
static bool lcl_LoadFile( glTFFile* io_pFile, const OUString& rURL)
More information about the Libreoffice-commits
mailing list