[M130 Migration][HBBTV] Start playback from the uri anchor. 73/325073/2
authorKajetan Brzuszczak <k.brzuszczak@partner.samsung.com>
Wed, 13 Nov 2024 13:17:11 +0000 (14:17 +0100)
committerBot Blink <blinkbot@samsung.com>
Mon, 2 Jun 2025 14:23:13 +0000 (14:23 +0000)
[Problem]
After using `t=X` anchor, playback starts from 0 when
 it should start from pts:X

[Cause]
Loading media element triggers default seek to pts:0,
  which overrides an already prepared content by mmplayer
  with a valid timestamp.

[Solution]
Skip the initial seek.

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

tizen_src/chromium_impl/media/filters/media_player_bridge_capi_tv.cc

index d4ee8945062f2275dddde0356d790d4174a6864b..e87170ad995c5084cd35aa93b2a2690ac29de859 100644 (file)
@@ -820,20 +820,24 @@ void MediaPlayerBridgeCapiTV::Seek(base::TimeDelta time,
     return;
   }
 
-  // If seek_cb isn't set, then this call is due to the StartPlayingFrom() call
-  // in the renderer.  In which case, ignore a seek to 0.0.
-  if (!seek_cb) {
-    // Ignore seek to 0 during initialization.
-    if (GetPlayerState() < PLAYER_STATE_READY && time.InSecondsF() == 00) {
-      LOG_ID(INFO, player_id_)
-          << __func__ << " Ignore seek to invalid time during initialization.";
-      return;
-    }
+  const bool is_initializing = GetPlayerState() < PLAYER_STATE_READY;
+  const bool is_suspend_seek = IsPlayerSuspended() && playback_time_ != time;
+  const bool is_start_playing_from_zero = !seek_cb && time.is_zero();
+
+  if (is_initializing && is_start_playing_from_zero) {
+    LOG_ID(INFO, player_id_) << "Ignore initial seek";
+    return;
   }
+
   seek_cb_ = std::move(seek_cb);
-  bool is_suspend_seek = IsPlayerSuspended() && playback_time_ != time;
-  if (is_seeking_ || is_suspend_seek || waiting_for_drm_init_complete_ ||
-      is_preparing_ || is_preloading_) {
+
+  // in the case when the player is currently unable to seek, stash the seek
+  // it will be executed in |MediaPlayerBridgeCapi::ExecuteDelayedPlayerState|
+  const bool should_stash_seek =
+      is_seeking_ || is_suspend_seek || waiting_for_drm_init_complete_ ||
+      is_preparing_ || is_preloading_ || is_initializing;
+
+  if (should_stash_seek) {
     LOG_ID(INFO, player_id_)
         << "(" << static_cast<void*>(this) << ") "
         << " stashing pending seek - " << time.InSecondsF() << "s";