From: Joogab Yun Date: Mon, 20 Jan 2020 08:04:51 +0000 (+0900) Subject: SetSource() is called multiple times at the same time when playing multiple Videos. X-Git-Tag: dali_1.4.55~7^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F11%2F222811%2F9;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git SetSource() is called multiple times at the same time when playing multiple Videos. At the same time, mTbmSurface may not sync when PrepareTexture() is executed. So I add a mutex lock, and valid check Change-Id: I807a9bee58fa920879bbdfa1867325c43e9f7730 --- diff --git a/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp b/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp old mode 100644 new mode 100755 index 57c2f60..987a357 --- a/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp +++ b/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp @@ -89,7 +89,8 @@ NativeImageSourceTizen::NativeImageSourceTizen( uint32_t width, uint32_t height, mEglImageKHR( NULL ), mEglGraphics( NULL ), mEglImageExtensions( NULL ), - mSetSource( false ) + mSetSource( false ), + mMutex() { DALI_ASSERT_ALWAYS( Adaptor::IsAvailable() ); @@ -209,6 +210,7 @@ Any NativeImageSourceTizen::GetNativeImageSource() const bool NativeImageSourceTizen::GetPixels(std::vector& pixbuf, unsigned& width, unsigned& height, Pixel::Format& pixelFormat) const { + Dali::Mutex::ScopedLock lock( mMutex ); if( mTbmSurface != NULL ) { tbm_surface_info_s surface_info; @@ -315,6 +317,7 @@ bool NativeImageSourceTizen::EncodeToFile(const std::string& filename) const void NativeImageSourceTizen::SetSource( Any source ) { + Dali::Mutex::ScopedLock lock( mMutex ); if( mOwnTbmSurface ) { if( mTbmSurface != NULL && tbm_surface_destroy( mTbmSurface ) != TBM_SURFACE_ERROR_NONE ) @@ -402,7 +405,7 @@ bool NativeImageSourceTizen::GlExtensionCreate() // casting from an unsigned int to a void *, which should then be cast back // to an unsigned int in the driver. EGLClientBuffer eglBuffer = reinterpret_cast< EGLClientBuffer >(mTbmSurface); - if( !eglBuffer ) + if( !eglBuffer || !tbm_surface_internal_is_valid( mTbmSurface ) ) { return false; } @@ -417,6 +420,7 @@ bool NativeImageSourceTizen::GlExtensionCreate() void NativeImageSourceTizen::GlExtensionDestroy() { + Dali::Mutex::ScopedLock lock( mMutex ); if( mEglImageKHR ) { mEglImageExtensions->DestroyImageKHR(mEglImageKHR); @@ -434,6 +438,7 @@ uint32_t NativeImageSourceTizen::TargetTexture() void NativeImageSourceTizen::PrepareTexture() { + Dali::Mutex::ScopedLock lock( mMutex ); if( mSetSource ) { void* eglImage = mEglImageKHR; diff --git a/dali/internal/imaging/tizen/native-image-source-impl-tizen.h b/dali/internal/imaging/tizen/native-image-source-impl-tizen.h index 7a746e8..fdeca56 100755 --- a/dali/internal/imaging/tizen/native-image-source-impl-tizen.h +++ b/dali/internal/imaging/tizen/native-image-source-impl-tizen.h @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include #include // INTERNAL INCLUDES @@ -190,6 +191,7 @@ private: EglGraphics* mEglGraphics; ///< EGL Graphics EglImageExtensions* mEglImageExtensions; ///< The EGL Image Extensions bool mSetSource; + mutable Dali::Mutex mMutex; }; } // namespace Adaptor