Fix abnormal seek issue after suspend/resume video
authorJihye Kang <jye.kang@samsung.com>
Wed, 17 Apr 2013 05:24:16 +0000 (14:24 +0900)
committerJihye Kang <jye.kang@samsung.com>
Wed, 17 Apr 2013 10:43:25 +0000 (19:43 +0900)
[Title] Fix abnormal seek issue after suspend/resume video
[Issue#] N/A
[Problem] Seek to 0 after suspend/resume while playing video
[Cause] Wrong duration is updated to control after resume
[Solution] Keep current duration When fails to query duration

Change-Id: Ib6dd3f32091ba2b88f4e272a465f9cb577bab517

Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp

index f273155..fee5f97 100755 (executable)
@@ -1739,6 +1739,9 @@ void MediaPlayerPrivateGStreamer::didEnd()
 
 void MediaPlayerPrivateGStreamer::cacheDuration()
 {
+#if ENABLE(TIZEN_GSTREAMER_VIDEO)
+    float previousDuration = m_mediaDuration;
+#endif
     // Reset cached media duration
     m_mediaDuration = 0;
 
@@ -1747,6 +1750,19 @@ void MediaPlayerPrivateGStreamer::cacheDuration()
     gst_element_get_state(m_playBin.get(), &state, 0, 0);
     float newDuration = duration();
 
+#if ENABLE(TIZEN_GSTREAMER_VIDEO)
+    if (state > GST_STATE_READY) {
+        // Don't set m_mediaDurationKnown yet if the pipeline is not
+        // paused. This allows duration() query to fail at least once
+        // before playback starts and duration becomes known.
+        m_mediaDurationKnown = !isinf(newDuration);
+    }
+
+    if (!isinf(newDuration))
+        m_mediaDuration = newDuration;
+    else
+        m_mediaDuration = previousDuration;
+#else
     if (state <= GST_STATE_READY) {
         // Don't set m_mediaDurationKnown yet if the pipeline is not
         // paused. This allows duration() query to fail at least once
@@ -1761,6 +1777,7 @@ void MediaPlayerPrivateGStreamer::cacheDuration()
 
     if (!isinf(newDuration))
         m_mediaDuration = newDuration;
+#endif
 }
 
 void MediaPlayerPrivateGStreamer::durationChanged()