Closed Bug 588312 Opened 14 years ago Closed 14 years ago

When set, video.currentTime returns old value until seek completes

Categories

(Core :: Audio/Video, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- final+

People

(Reporter: kinetik, Assigned: cajbir)

References

()

Details

Attachments

(2 files, 3 obsolete files)

When video.currentTime is set to a new position, video.seeking becomes true immediately but video.currentTime returns the old value until the seeked event fires. The spec (step 8) says that currentTime should reflect the new position before seeking is fired. Testcase attached.
Attached file testcase (obsolete) —
Attach testcase, like, for real.
Attached file testcase
Better testcase. This also shows that we fire timeupdate just before seeked, rather than just after seeking as the spec requires.
Attachment #466934 - Attachment is obsolete: true
Blocks: 584615
When this is fixed, please also revert the workaround made in videocontrols.xml: case "seeked": + // XXX: This call to showBuffered() can be removed + // when bug 588312 is fixed. + this.showBuffered(); + this.setupStatusFader(); + break; case "playing":
Requesting blocking as it blocks blocking bug 584615.
Assignee: nobody → chris.double
blocking2.0: --- → ?
Attached patch Fix (obsolete) — Splinter Review
Attachment #472531 - Flags: review?(kinetik)
Status: NEW → ASSIGNED
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ Did you mean to remove this? mElement->SeekStarted(); + mElement->DispatchSimpleEvent(NS_LITERAL_STRING("timeupdate")); Can we move the timeupdate into SeekStarted()? That way other (non-nsBuiltin) backends will have the correct behaviour. The Wave backend needs a similar fix to what you've done in nsBuiltinDecoderStateMachine::Run(). And I'm not sure if the Wave backend is tested--test_timeupdate3 is Ogg specific. We should convert it to a backend independent test.
Comment on attachment 472531 [details] [diff] [review] Fix Drive by review... >diff --git a/content/media/nsBuiltinDecoder.cpp b/content/media/nsBuiltinDecoder.cpp >index 2baa287..76b2b0a 100644 >--- a/content/media/nsBuiltinDecoder.cpp >+++ b/content/media/nsBuiltinDecoder.cpp >@@ -703,6 +703,7 @@ void nsBuiltinDecoder::SeekingStarted() > if (mElement) { > UpdateReadyStateForData(); > mElement->SeekStarted(); >+ mElement->DispatchSimpleEvent(NS_LITERAL_STRING("timeupdate")); > } > } Does the UpdatePlaybackPosition(seekTime) call you added already cause a timeupdate to be dispatched if the playback position changes? >diff --git a/content/media/nsBuiltinDecoderStateMachine.cpp b/content/media/nsBuiltinDecoderStateMachine.cpp >index 4ba3523..a22df31 100644 >--- a/content/media/nsBuiltinDecoderStateMachine.cpp >+++ b/content/media/nsBuiltinDecoderStateMachine.cpp >@@ -980,6 +979,16 @@ nsresult nsBuiltinDecoderStateMachine::Run() > PRInt64 seekTime = mSeekTime; > mDecoder->StopProgressUpdates(); > >+ PRBool currentTimeChanged = false; >+ PRInt64 currentTime = mStartTime + mCurrentFrameTime; Variable currentTime is unused? >diff --git a/content/media/test/test_timeupdate3.html b/content/media/test/test_timeupdate3.html >index 0fb1a3a..b6e7c85 100644 >--- a/content/media/test/test_timeupdate3.html >+++ b/content/media/test/test_timeupdate3.html >@@ -27,16 +28,19 @@ function startSeek() { > return false; > > seeking = true; >+ var v = document.getElementById('v'); >+ ok(v.currentTime == 2.0, >+ "Check currentTime of " + v.currentTime + " is requested seek time"); s/2.0/seekTime/ ?
(In reply to comment #7) > Does the UpdatePlaybackPosition(seekTime) call you added already cause a > timeupdate to be dispatched if the playback position changes? Not necessarily, because mPositionChangeQueued might be true which would suppress sending the timeupdate caused by seeking.
Attached patch Fix (obsolete) — Splinter Review
Addresses review comments. I've made test_timeupdate3 a backend independent test and renamed it to test_timeupdate_seek. > Does the UpdatePlaybackPosition(seekTime) call you added already cause a > timeupdate to be dispatched if the playback position changes? I've not changed this since allowing for it complicates the code quite a bit and the gain of not having one additional timeupdate on a seek start didn't seem worth it. If it's still an issue can we create a bug specific for it to address the refactoring that would be needed to do it?
Attachment #472531 - Attachment is obsolete: true
Attachment #473874 - Flags: review?(kinetik)
Attachment #472531 - Flags: review?(kinetik)
Comment on attachment 473874 [details] [diff] [review] Fix if (NS_FAILED(rv)) { NS_WARNING("Seek failed"); - } - monitor.Enter(); - if (NS_SUCCEEDED(rv)) { - mPlaybackPosition = position; + mPlaybackPosition = oldPosition; } We need to fire a timeupdate for this. It turns out we do because we call FirePositionChanged(PR_TRUE) further down in the SEEKING state. I think it'd be better to move that call inside the if here, since we've already fired back a timeupdate at the start of the sek in the success case. r+ with that.
Attachment #473874 - Flags: review?(kinetik) → review+
Attached patch FixSplinter Review
Address final review comment and add commit message to patch. carried r=kinetik forward.
Attachment #473874 - Attachment is obsolete: true
Attachment #473902 - Flags: review+
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: