[M130 Migration][HBBTV] Delay seek execution for resume 75/325075/2
authorKajetan Brzuszczak <k.brzuszczak@partner.samsung.com>
Fri, 15 Nov 2024 16:03:47 +0000 (17:03 +0100)
committerBot Blink <blinkbot@samsung.com>
Mon, 2 Jun 2025 14:34:50 +0000 (14:34 +0000)
[Problem]
Mid-roll advertisment cause playback to start from pts:0
  instead of continuing it from last point

[Cause]
Pending seek was overwrite by a Play event during Resume.

[Solution]
Delay Play for Resume same as is for the rest Scenarios.

Bug: https://jira-eu.sec.samsung.net/browse/VDWASM-1931
Signed-off-by: Kajetan Brzuszczak <k.brzuszczak@partner.samsung.com>
Change-Id: I39bc07f655e54329ade2c3cc18b8ecbde5e14302

tizen_src/chromium_impl/media/filters/media_player_bridge_capi_tv.cc
tizen_src/chromium_impl/media/filters/media_player_bridge_capi_tv.h

index e87170ad995c5084cd35aa93b2a2690ac29de859..8d186bd0865272b627dd328deac4965343ad7e2d 100644 (file)
@@ -610,29 +610,36 @@ bool MediaPlayerBridgeCapiTV::Play() {
       << "(" << static_cast<void*>(this) << ") " << __func__
       << ",current_time:" << GetCurrentTime().InSecondsF();
 
+  if (IsPlayerSuspended()) {
+    is_play_pending_ = true;
+    LOG_ID(INFO, GetPlayerId()) << "Player is suspended";
+    delayed_player_state_ = PLAYER_STATE_DELAYED_PLAY;
+    if (playback_time_ != base::Milliseconds(0)) {
+      LOG_ID(INFO, GetPlayerId()) << "Player should seek to " << playback_time_;
+      delayed_player_state_ = PLAYER_STATE_DELAYED_SEEK;
+      pending_seek_duration_ = playback_time_;
+    }
+    Resume();
+    return false;
+  }
+  if (is_resuming_) {
+    LOG_ID(INFO, GetPlayerId()) << "Player is still resuming, delay play";
+    DelayPlayExecution();
+    return false;
+  }
+
   // HBBTV runs in preloading and preplay mode. If not prepread do prepare
   // in PlayerPrePlay(), otherwise do normal Play.
   if (blink::IsHbbTV()) {
     if (is_preloading_) {
       LOG_ID(INFO, GetPlayerId()) << "Player is still preloading, delay play";
-      if (delayed_player_state_ == PLAYER_STATE_DELAYED_SEEK ||
-          delayed_player_state_ == PLAYER_STATE_DELAYED_SEEK_THEN_PLAY) {
-        delayed_player_state_ = PLAYER_STATE_DELAYED_SEEK_THEN_PLAY;
-      } else {
-        delayed_player_state_ = PLAYER_STATE_DELAYED_PLAY;
-      }
-
+      DelayPlayExecution();
       return true;
     }
     if (is_preparing_) {
       LOG_ID(INFO, GetPlayerId())
           << "Player is still being prepared, delay play";
-      if (delayed_player_state_ == PLAYER_STATE_DELAYED_SEEK ||
-          delayed_player_state_ == PLAYER_STATE_DELAYED_SEEK_THEN_PLAY) {
-        delayed_player_state_ = PLAYER_STATE_DELAYED_SEEK_THEN_PLAY;
-      } else {
-        delayed_player_state_ = PLAYER_STATE_DELAYED_PLAY;
-      }
+      DelayPlayExecution();
       return true;
     }
     if (!player_prepared_) {
@@ -652,12 +659,7 @@ bool MediaPlayerBridgeCapiTV::Play() {
   if (blink::IsHbbTV() && !parental_rating_pass_) {
     LOG_ID(INFO, GetPlayerId())
         << "parental rating authenticatoin is not pass yet,waiting...";
-    if (delayed_player_state_ == PLAYER_STATE_DELAYED_SEEK ||
-        delayed_player_state_ == PLAYER_STATE_DELAYED_SEEK_THEN_PLAY) {
-      delayed_player_state_ = PLAYER_STATE_DELAYED_SEEK_THEN_PLAY;
-    } else {
-      delayed_player_state_ = PLAYER_STATE_DELAYED_PLAY;
-    }
+    DelayPlayExecution();
     MediaPlayerBridgeCapi::ExecuteDelayedPlayerState();
     return false;
   }
@@ -1997,7 +1999,6 @@ bool MediaPlayerBridgeCapiTV::HBBTVResourceAcquired() {
 void MediaPlayerBridgeCapiTV::PlayerPreloaded() {
   LOG_ID(INFO, GetPlayerId()) << "PlayerPreloaded,this: " << this
                               << ",player_prepared_:" << player_prepared_;
-
   // If the encrypted_listener_or_cdm_has_changed_ flag is true, then the
   // CDM has changed or been set since we started to preload, so we'll
   // restart the preload/prepare to use the new CDM.
@@ -4069,6 +4070,17 @@ void MediaPlayerBridgeCapiTV::NotifyDrmInitComplete(unsigned int length,
 }
 #endif  // TIZEN_MULTIMEDIA_DRMMANAGER_SUPPORT
 
+void MediaPlayerBridgeCapiTV::DelayPlayExecution() {
+  switch(delayed_player_state_) {
+    case PLAYER_STATE_DELAYED_SEEK:
+    case PLAYER_STATE_DELAYED_SEEK_THEN_PLAY:
+      delayed_player_state_ = PLAYER_STATE_DELAYED_SEEK_THEN_PLAY;
+      break;
+    default:
+      delayed_player_state_ = PLAYER_STATE_DELAYED_PLAY;
+  }
+}
+
 bool MediaPlayerBridgeCapiTV::CompleteDrmInit(int& drmhandle) {
   base::AutoLock auto_lock(drm_lock_);
 
index a42bc295531caf248b759f4919ef573d847b3f6c..e4eb2f929fbb90d6aaaafb3ab9e88b5cb595a095 100644 (file)
@@ -326,6 +326,7 @@ class MEDIA_EXPORT MediaPlayerBridgeCapiTV : public MediaPlayerBridgeCapi {
   void NotifyDrmInitComplete(unsigned int length, unsigned char* psshdata);
 #endif
   bool CompleteDrmInit(int& drmhandle);
+  void DelayPlayExecution();
 
   StreamType stream_type_{OTHER_STREAM};
   std::string hbbtv_url_{""};  // url_ + HIGHBITRATE(if mpd)