WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
190893
[MSE][WTF][Media] Invalid MediaTime should be falsy
https://bugs.webkit.org/show_bug.cgi?id=190893
Summary
[MSE][WTF][Media] Invalid MediaTime should be falsy
Alicia Boya García
Reported
2018-10-24 17:04:25 PDT
Currently MediaTime::invalidTime() is evaluated as true in the context of a boolean evaluation. This behavior is surprising and I've already seen some code fall on it. In particular, in SourceBuffer: } else if (trackBuffer.roundedTimestampOffset) { // Reflect the timestamp offset into the sample. sample.offsetTimestampsBy(trackBuffer.roundedTimestampOffset); } There, the intention would be to offset the timestamps of the sample if and only if a valid non-zero timestamp offset exists. But with the current definition of MediaTime::operator bool, an invalid time is true. I definitively did not expect that, did you? This patch includes: 1. A mock MSE test case replicating a bug caused by that assumption. 2. A change in the definition of MediaTime::operator bool() and MediaTime::operator!() so that invalid times are falsy. 3. Additional API tests for conversions of MediaTime to bool.
Attachments
Patch
(12.62 KB, patch)
2018-10-24 17:12 PDT
,
Alicia Boya García
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Alicia Boya García
Comment 1
2018-10-24 17:12:42 PDT
Created
attachment 353066
[details]
Patch
Jer Noble
Comment 2
2018-10-26 05:31:58 PDT
Comment on
attachment 353066
[details]
Patch Originally, I decided not to make isInvalid() false because I thought it would be weird to have !isInvalid() == !zero. But I see that floating point NaN is also falsy, so this LGTM.
WebKit Commit Bot
Comment 3
2018-10-26 07:05:32 PDT
Comment on
attachment 353066
[details]
Patch Clearing flags on attachment: 353066 Committed
r237450
: <
https://trac.webkit.org/changeset/237450
>
WebKit Commit Bot
Comment 4
2018-10-26 07:05:33 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug