[M108 Migration][MM] Check preparing status before calling media control functions. 00/289100/5
authorKoyyani Maheswari <m.koyyani@samsung.com>
Wed, 1 Mar 2023 09:36:34 +0000 (15:06 +0530)
committerBot Blink <blinkbot@samsung.com>
Tue, 7 Mar 2023 03:49:27 +0000 (03:49 +0000)
1. Change to initialize sequence fit to |EsppRendererImpl|.
2. Check preparing status to call media control functions in proper status.

Reference: https://review.tizen.org/gerrit/278807/

Change-Id: I2722203895b34a023a0ab1c8e2fb622357c95aae
Signed-off-by: Koyyani Maheswari <m.koyyani@samsung.com>
tizen_src/chromium_impl/media/filters/media_player_bridge_capi_adapter.cc

index 196a797..905dc12 100644 (file)
@@ -39,7 +39,7 @@ bool MediaPlayerBridgeCapiAdapter::CreatePlayer() {
 }
 
 void MediaPlayerBridgeCapiAdapter::Initialize(VideoRendererSink* /*sink*/) {
-  media_player_->Initialize();
+  is_initialized_ = true;
 }
 
 bool MediaPlayerBridgeCapiAdapter::IsInitialized() {
@@ -48,7 +48,7 @@ bool MediaPlayerBridgeCapiAdapter::IsInitialized() {
 
 void MediaPlayerBridgeCapiAdapter::Prepare() {
   // Prepare function is called internally.
-  is_prepared_ = true;
+  media_player_->Initialize();
 }
 
 bool MediaPlayerBridgeCapiAdapter::IsPrepared() {
@@ -80,19 +80,23 @@ void MediaPlayerBridgeCapiAdapter::SetRendererClientExtension(
 }
 
 void MediaPlayerBridgeCapiAdapter::Play() {
-  media_player_->Play();
+  if (IsPrepared())
+    media_player_->Play();
 }
 
 void MediaPlayerBridgeCapiAdapter::Pause(bool is_media_related_action) {
-  media_player_->Pause(is_media_related_action);
+  if (IsPrepared())
+    media_player_->Pause(is_media_related_action);
 }
 
 void MediaPlayerBridgeCapiAdapter::SetRate(double rate) {
-  media_player_->SetRate(rate);
+  if (IsPrepared())
+    media_player_->SetRate(rate);
 }
 
 void MediaPlayerBridgeCapiAdapter::Seek(base::TimeDelta time) {
-  media_player_->Seek(time.InSecondsF());
+  if (IsPrepared())
+    media_player_->Seek(time.InSecondsF());
 }
 
 void MediaPlayerBridgeCapiAdapter::Flush(base::OnceClosure flush_cb) {
@@ -100,7 +104,8 @@ void MediaPlayerBridgeCapiAdapter::Flush(base::OnceClosure flush_cb) {
 }
 
 void MediaPlayerBridgeCapiAdapter::SetVolume(double volume) {
-  media_player_->SetVolume(volume);
+  if (IsPrepared())
+    media_player_->SetVolume(volume);
 }
 
 base::TimeDelta MediaPlayerBridgeCapiAdapter::GetCurrentTime() {
@@ -243,7 +248,7 @@ void MediaPlayerBridgeCapiAdapter::SetMediaGeometry(
 #endif
 
 void MediaPlayerBridgeCapiAdapter::OnInitComplete(int player_id, bool success) {
-  is_initialized_ = success;
+  is_prepared_ = success;
 }
 
 void MediaPlayerBridgeCapiAdapter::OnResumeComplete(int player_id) {