[M108 Aura Migration] Merge duration related patch 95/285295/6
authorlokeshmeena <lokesh.meena@samsung.com>
Thu, 8 Dec 2022 18:22:54 +0000 (23:52 +0530)
committerDae-Hyun Ko <dhyuna.ko@samsung.com>
Tue, 13 Dec 2022 07:48:13 +0000 (07:48 +0000)
Issue: mmplayer return duration = 0 for some normal
       stream. Media will set duration = max and
       now = max for this case. And media element
       will keep playing status and cannot start
       to load next source.

Fixed: Playback complete for this special case

Migrate from:
https://review.tizen.org/gerrit/280132

Change-Id: I5fcbc1e536a56c647508adfbb9cf938ef0375076
Signed-off-by: lokeshmeena <lokesh.meena@samsung.com>
third_party/blink/renderer/core/html/media/html_media_element.cc
third_party/blink/renderer/core/html/media/html_media_element.h

index 87f4fa2..7ea367c 100644 (file)
@@ -3640,7 +3640,21 @@ void HTMLMediaElement::TimeChanged() {
   // When the current playback position reaches the end of the media resource
   // when the direction of playback is forwards, then the user agent must follow
   // these steps:
+#if defined(TIZEN_MULTIMEDIA)
+  // mmplayer return duration = 0 for some normal stream. Media will set
+  // duration = max for this case. And now = max also, this case is also
+  // regarded as playback complete.
+  const double now = CurrentPlaybackPosition();
+  const double dur = duration();
+  bool is_duration_exception_case =
+      (now == std::numeric_limits<double>::infinity()) &&
+      (dur == std::numeric_limits<double>::infinity());
+
+  if (live_playback_complete_ || is_duration_exception_case ||
+      (EndedPlayback(LoopCondition::kIgnored))) {
+#else
   if (EndedPlayback(LoopCondition::kIgnored)) {
+#endif
     // If the media element has a loop attribute specified
     if (Loop() && EarliestPossiblePosition() != CurrentPlaybackPosition()) {
       //  then seek to the earliest possible position of the media resource and
@@ -3817,7 +3831,7 @@ bool HTMLMediaElement::EndedPlayback(LoopCondition loop_condition) const {
 
   DCHECK_EQ(GetDirectionOfPlayback(), kForward);
   if (web_media_player_) {
-    return web_media_player_->IsEnded() &&
+    return web_media_player_->IsEnded() && dur > 0 &&
            (loop_condition == LoopCondition::kIgnored || !Loop() ||
             dur <= std::numeric_limits<double>::epsilon());
   }
index 2121470..308510c 100644 (file)
@@ -843,6 +843,10 @@ class CORE_EXPORT HTMLMediaElement
 
   bool was_always_muted_ : 1;
 
+#if defined(TIZEN_MULTIMEDIA)
+  bool live_playback_complete_ : 1;
+#endif
+
   // Set if the user has used the context menu to set the visibility of the
   // controls.
   absl::optional<bool> user_wants_controls_visible_;