RESOLVED FIXED 237473
MediaTime::invalidTime() isn't convertible without loss into CMTime
https://bugs.webkit.org/show_bug.cgi?id=237473
Summary MediaTime::invalidTime() isn't convertible without loss into CMTime
Jean-Yves Avenard [:jya]
Reported 2022-03-04 07:49:17 PST
Consider the following code: ``` auto invalid = MediaTime::invalidTime(); auto cminvalid = PAL::toCMTime(invalid); auto invalid2 = PAL::toMediaTime(cminvalid); ASSERT(invalid == invalid2); ``` the assertion will fail. The reason is that PAL::toCMTime(MediaTime::invalidTime()) will generate a CMTime that has the flag kCMTimeFlags_HasBeenRounded set. This causes failure here https://webkit-search.igalia.com/webkit/rev/ceb5e25a803df6cd6ea1c45859e4e03bbf659f75/Source/WebKit/Shared/mac/MediaFormatReader/MediaSampleByteRange.cpp#49
Attachments
Patch (3.00 KB, patch)
2022-03-04 08:37 PST, Jean-Yves Avenard [:jya]
no flags
Patch (11.32 KB, patch)
2022-03-04 19:31 PST, Jean-Yves Avenard [:jya]
no flags
Patch (11.36 KB, patch)
2022-03-04 19:33 PST, Jean-Yves Avenard [:jya]
ews-feeder: commit-queue-
Patch (18.08 KB, patch)
2022-03-04 19:47 PST, Jean-Yves Avenard [:jya]
no flags
Patch (17.61 KB, patch)
2022-03-07 13:58 PST, Jean-Yves Avenard [:jya]
no flags
Patch (17.60 KB, patch)
2022-03-07 14:00 PST, Jean-Yves Avenard [:jya]
no flags
Jean-Yves Avenard [:jya]
Comment 1 2022-03-04 07:56:59 PST
Actually, earlier description is incorrect: the code of toCMTime is as follow: ``` CMTime time; if (mediaTime.hasDoubleValue()) time = CMTimeMakeWithSeconds(mediaTime.toDouble(), mediaTime.timeScale()); else time = CMTimeMake(mediaTime.timeValue(), mediaTime.timeScale()); if (mediaTime.isValid()) time.flags |= kCMTimeFlags_Valid; if (mediaTime.hasBeenRounded()) time.flags |= kCMTimeFlags_HasBeenRounded; if (mediaTime.isPositiveInfinite()) time.flags |= kCMTimeFlags_PositiveInfinity; if (mediaTime.isNegativeInfinite()) time.flags |= kCMTimeFlags_NegativeInfinity; return time; ``` what converting MediaTime::invalidTime() : `CMTimeMake(mediaTime.timeValue(), mediaTime.timeScale());` will return a valid time and that flag isn't reset.
Radar WebKit Bug Importer
Comment 2 2022-03-04 08:23:52 PST
Jean-Yves Avenard [:jya]
Comment 3 2022-03-04 08:37:13 PST
Jean-Yves Avenard [:jya]
Comment 4 2022-03-04 19:31:35 PST
Jean-Yves Avenard [:jya]
Comment 5 2022-03-04 19:33:03 PST
Jean-Yves Avenard [:jya]
Comment 6 2022-03-04 19:47:20 PST
Created attachment 453888 [details] Patch Fix iOS compilation
Jer Noble
Comment 7 2022-03-07 13:53:18 PST
Comment on attachment 453888 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=453888&action=review > Source/WebCore/PAL/ChangeLog:15 > +2022-03-04 Jean-Yves Avenard <jya@apple.com> Nit: This ChangeLog entry should get merged with the one above it.
Jean-Yves Avenard [:jya]
Comment 8 2022-03-07 13:58:23 PST
Jean-Yves Avenard [:jya]
Comment 9 2022-03-07 14:00:27 PST
EWS
Comment 10 2022-03-07 16:01:42 PST
Committed r290964 (248144@main): <https://commits.webkit.org/248144@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 454031 [details].
Note You need to log in before you can comment on or make changes to this bug.