Changed to WeakHandle mSyncActor 26/307926/3
authorjoogab.yun <joogab.yun@samsung.com>
Thu, 14 Mar 2024 08:44:06 +0000 (17:44 +0900)
committerjoogab.yun <joogab.yun@samsung.com>
Fri, 15 Mar 2024 01:54:29 +0000 (10:54 +0900)
Because the player holds a reference to mSyncActor, the Player is not destroyed when the VideoView is destroyed.

Change-Id: I5df689a537ad96699dd0aabefa7edc0eaa2ff672

dali-extension/video-player/ecore-wl2/tizen-video-player-ecore-wl2.cpp
dali-extension/video-player/ecore-wl2/tizen-video-player.h

index 2345d3e..1a249b9 100755 (executable)
@@ -1364,21 +1364,25 @@ void TizenVideoPlayer::CreateConstraint()
       mVideoSizePropertyConstraint.Remove();
     }
 
-    mVideoSizePropertyIndex = mSyncActor.RegisterProperty(VIDEO_PLAYER_SIZE_NAME, Vector3::ZERO);
+    Actor syncActor = mSyncActor.GetHandle();
+    if(syncActor)
+    {
+      mVideoSizePropertyIndex = syncActor.RegisterProperty(VIDEO_PLAYER_SIZE_NAME, Vector3::ZERO);
 
-    int                width, height;
-    Ecore_Wl2_Display* wl2_display = ecore_wl2_connected_display_get(NULL);
-    ecore_wl2_display_screen_size_get(wl2_display, &width, &height);
+      int                width, height;
+      Ecore_Wl2_Display* wl2_display = ecore_wl2_connected_display_get(NULL);
+      ecore_wl2_display_screen_size_get(wl2_display, &width, &height);
 
-    mVideoSizePropertyConstraint = Constraint::New<Vector3>(mSyncActor,
-                                                            mVideoSizePropertyIndex,
-                                                            VideoPlayerSyncConstraint(mEcoreSubVideoWindow, width, height));
+      mVideoSizePropertyConstraint = Constraint::New<Vector3>(syncActor,
+                                                              mVideoSizePropertyIndex,
+                                                              VideoPlayerSyncConstraint(mEcoreSubVideoWindow, width, height));
 
-    mVideoSizePropertyConstraint.AddSource(LocalSource(Actor::Property::SIZE));
-    mVideoSizePropertyConstraint.AddSource(LocalSource(Actor::Property::WORLD_SCALE));
-    mVideoSizePropertyConstraint.AddSource(LocalSource(Actor::Property::WORLD_POSITION));
+      mVideoSizePropertyConstraint.AddSource(LocalSource(Actor::Property::SIZE));
+      mVideoSizePropertyConstraint.AddSource(LocalSource(Actor::Property::WORLD_SCALE));
+      mVideoSizePropertyConstraint.AddSource(LocalSource(Actor::Property::WORLD_POSITION));
 
-    mVideoSizePropertyConstraint.Apply();
+      mVideoSizePropertyConstraint.Apply();
+    }
   }
 }
 
index 3c74721..ea25d94 100755 (executable)
@@ -25,6 +25,7 @@
 #include <dali/public-api/adaptor-framework/native-image-source.h>
 #include <dali/public-api/adaptor-framework/timer.h>
 #include <dali/public-api/animation/constraints.h>
+#include <dali/public-api/object/weak-handle.h>
 #include <player.h>
 #include <string>
 #include <list>
@@ -304,12 +305,12 @@ private:
 
   player_video_codec_type_ex_e mCodecType;
 
-  Ecore_Wl2_Window*     mEcoreWlWindow;       ///< ecore native window handle
-  Ecore_Wl2_Subsurface* mEcoreSubVideoWindow; ///< ecore native subsurface for synchronization with video player
-  Actor                 mSyncActor;
-  Constraint            mVideoSizePropertyConstraint;
-  Property::Index       mVideoSizePropertyIndex;
-  Dali::VideoSyncMode   mSyncMode;
+  Ecore_Wl2_Window*             mEcoreWlWindow;       ///< ecore native window handle
+  Ecore_Wl2_Subsurface*         mEcoreSubVideoWindow; ///< ecore native subsurface for synchronization with video player
+  Dali::WeakHandle<Dali::Actor> mSyncActor;
+  Constraint                    mVideoSizePropertyConstraint;
+  Property::Index               mVideoSizePropertyIndex;
+  Dali::VideoSyncMode           mSyncMode;
 
   bool mIsInitForSyncMode; ///< the flag for synchronization with video player