[Libreoffice-commits] core.git: 3 commits - avmedia/source slideshow/source

Jan Holesovsky kendy at collabora.com
Thu May 29 04:17:06 PDT 2014


 avmedia/source/opengl/oglplayer.cxx               |    7 +++++--
 avmedia/source/opengl/oglplayer.hxx               |    2 +-
 slideshow/source/engine/shapes/viewmediashape.cxx |    6 +++---
 3 files changed, 9 insertions(+), 6 deletions(-)

New commits:
commit 3453273086ef4c546c2a7dca41654627fd720cfa
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed May 28 16:43:08 2014 +0200

    First stop the timer, then the animation.
    
    Change-Id: Icd5f9f4b8e1c48176fdb73c954e1c4b7d0811516

diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index fefbb31..88c93a6 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -145,8 +145,8 @@ void SAL_CALL OGLPlayer::start() throw ( uno::RuntimeException, std::exception )
 void SAL_CALL OGLPlayer::stop() throw ( uno::RuntimeException, std::exception )
 {
     osl::MutexGuard aGuard(m_aMutex);
-    gltf_animation_stop(m_pHandle);
     m_aTimer.Stop();
+    gltf_animation_stop(m_pHandle);
 }
 
 sal_Bool SAL_CALL OGLPlayer::isPlaying() throw ( uno::RuntimeException, std::exception )
commit 8d40fd2e0d7c264ce38c361fe7c9a20de9a81f0a
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed May 28 16:40:12 2014 +0200

    slideshow: Don't assume anything about the duration.
    
    Let the player decide what to do when the duration is zero, and start()/stop() was called.
    
    Change-Id: I17027349e8d61f7b114e193a769402c04a64f3f3

diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx
index d598237..ce50717 100644
--- a/slideshow/source/engine/shapes/viewmediashape.cxx
+++ b/slideshow/source/engine/shapes/viewmediashape.cxx
@@ -128,7 +128,7 @@ namespace slideshow
             if( !mxPlayer.is() )
                 implInitialize( maBounds );
 
-            if( mxPlayer.is() && ( mxPlayer->getDuration() > 0.0 ) )
+            if (mxPlayer.is())
                 mxPlayer->start();
 
             return true;
@@ -170,7 +170,7 @@ namespace slideshow
 
         void ViewMediaShape::pauseMedia()
         {
-            if( mxPlayer.is() && ( mxPlayer->getDuration() > 0.0 ) )
+            if (mxPlayer.is())
                 mxPlayer->stop();
         }
 
@@ -178,7 +178,7 @@ namespace slideshow
 
         void ViewMediaShape::setMediaTime(double fTime)
         {
-            if( mxPlayer.is() && ( mxPlayer->getDuration() > 0.0 ) )
+            if (mxPlayer.is())
                 mxPlayer->setMediaTime(fTime);
         }
 
commit 91fb0866cad2518e5f2cbc48af0e952282fee19d
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed May 28 15:38:22 2014 +0200

    Use AutoTimer instead of Timer, and add some more locking.
    
    Change-Id: I83a99e333a6c62bf7779e3fbbcc3e5af38bb2ca5

diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index 22ff457..fefbb31 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -31,6 +31,7 @@ OGLPlayer::OGLPlayer()
 
 OGLPlayer::~OGLPlayer()
 {
+    osl::MutexGuard aGuard(m_aMutex);
     if( m_pHandle )
     {
         for (size_t i = 0; i < m_pHandle->size; ++i)
@@ -63,6 +64,8 @@ static bool lcl_LoadFile( glTFFile* io_pFile, const OUString& rURL)
 
 bool OGLPlayer::create( const OUString& rURL )
 {
+    osl::MutexGuard aGuard(m_aMutex);
+
     m_sURL = rURL;
 
     // Load *.json file and init renderer
@@ -297,8 +300,8 @@ IMPL_LINK(OGLPlayer,TimerHandler,Timer*,pTimer)
 {
     if (pTimer == &m_aTimer)
     {
+        osl::MutexGuard aGuard(m_aMutex);
         m_pOGLWindow->update();
-        m_aTimer.Start();
     }
 
     return 0;
diff --git a/avmedia/source/opengl/oglplayer.hxx b/avmedia/source/opengl/oglplayer.hxx
index b41df21..42476fc 100644
--- a/avmedia/source/opengl/oglplayer.hxx
+++ b/avmedia/source/opengl/oglplayer.hxx
@@ -62,7 +62,7 @@ private:
     OUString m_sURL;
     glTFHandle* m_pHandle;
     OpenGLContext m_aContext;
-    Timer m_aTimer;
+    AutoTimer m_aTimer;
     OGLWindow* m_pOGLWindow;
 };
 


More information about the Libreoffice-commits mailing list