RESOLVED FIXED 42178
Update media element's seeking logic
https://bugs.webkit.org/show_bug.cgi?id=42178
Summary Update media element's seeking logic
Eric Carlson
Reported 2010-07-13 10:58:23 PDT
The logic in HTMLMediaElement::seek is out of sync with the current spec.
Attachments
WIP patch (6.61 KB, patch)
2010-07-13 14:02 PDT, Eric Carlson
no flags
proposed patch. (7.08 KB, patch)
2010-07-13 14:29 PDT, Eric Carlson
darin: review+
Eric Carlson
Comment 1 2010-07-13 11:09:39 PDT
Eric Carlson
Comment 2 2010-07-13 14:02:57 PDT
Created attachment 61413 [details] WIP patch
Eric Carlson
Comment 3 2010-07-13 14:29:04 PDT
Created attachment 61416 [details] proposed patch.
Darin Adler
Comment 4 2010-07-13 15:20:44 PDT
Comment on attachment 61416 [details] proposed patch. > + if (abs(startTime - time) < closest) > + closest = abs(startTime - time); > + else if (abs(endTime - time) < closest) > + closest = abs(endTime - time); The function used here should be fabsf, not abs. Calling abs converts the number to an int! Also, I am concerned about the ignored ExceptionCode. Why is it OK to ignore it? Can there be an exception. r=me but please fix that fabsf thing
Eric Carlson
Comment 5 2010-07-14 07:41:51 PDT
(In reply to comment #4) > (From update of attachment 61416 [details]) > > + if (abs(startTime - time) < closest) > > + closest = abs(startTime - time); > > + else if (abs(endTime - time) < closest) > > + closest = abs(endTime - time); > > The function used here should be fabsf, not abs. Calling abs converts the number to an int! > Ack, I assume it would use the "inline float" version in cmath. Thanks! > Also, I am concerned about the ignored ExceptionCode. Why is it OK to ignore it? Can there be an exception. > An exception is returned by start() and end() if the index is out of bounds, which can't happen here. > r=me but please fix that fabsf thing Thanks!
Eric Carlson
Comment 6 2010-07-14 07:42:17 PDT
WebKit Review Bot
Comment 7 2010-07-14 07:42:38 PDT
http://trac.webkit.org/changeset/63319 might have broken Qt Linux Release minimal
Jakub Wieczorek
Comment 8 2010-07-24 14:43:26 PDT
(In reply to comment #6) > http://trac.webkit.org/changeset/63319 Are you sure this is correct? Aren't you returning the distance between time and the nearest position rather than the nearest position? And this: + else if (fabs(endTime - time) < closest) looks wrong. This shouldn't be an else if, endTime might be closer than startTime. You could save some function calls and unnecessary input checks by operating on the private vector instead of calling the public functions.
Note You need to log in before you can comment on or make changes to this bug.