RESOLVED FIXED Bug 230841
Add an experimental VideoTrackConfiguration class and accessor on VideoTrack
https://bugs.webkit.org/show_bug.cgi?id=230841
Summary Add an experimental VideoTrackConfiguration class and accessor on VideoTrack
Jer Noble
Reported 2021-09-27 09:01:44 PDT
Add an experimental VideoTrackConfiguration class and accessor on VideoTrack
Attachments
Patch (157.57 KB, patch)
2021-09-27 09:33 PDT, Jer Noble
no flags
Patch (153.29 KB, patch)
2021-10-22 20:05 PDT, Jer Noble
no flags
Patch (153.72 KB, patch)
2021-10-22 21:39 PDT, Jer Noble
ews-feeder: commit-queue-
Patch (153.76 KB, patch)
2021-10-22 22:18 PDT, Jer Noble
no flags
Patch (154.02 KB, patch)
2021-10-23 09:13 PDT, Jer Noble
ews-feeder: commit-queue-
Patch (154.04 KB, patch)
2021-10-23 09:21 PDT, Jer Noble
no flags
Patch (154.14 KB, patch)
2021-10-23 17:25 PDT, Jer Noble
no flags
Patch (154.74 KB, patch)
2021-11-18 12:42 PST, Jer Noble
ews-feeder: commit-queue-
Patch (155.15 KB, patch)
2021-11-18 14:26 PST, Jer Noble
ews-feeder: commit-queue-
Patch (155.15 KB, patch)
2021-11-18 15:17 PST, Jer Noble
ews-feeder: commit-queue-
Patch (155.13 KB, patch)
2021-11-18 15:39 PST, Jer Noble
no flags
Patch (318.03 KB, patch)
2021-11-19 23:26 PST, Jer Noble
no flags
Patch (319.47 KB, patch)
2021-11-20 10:02 PST, Jer Noble
no flags
Patch (319.44 KB, patch)
2021-11-20 13:01 PST, Jer Noble
no flags
Patch for landing (319.14 KB, patch)
2021-11-20 15:50 PST, Jer Noble
ews-feeder: commit-queue-
Patch for landing (319.76 KB, patch)
2021-11-30 09:33 PST, Jer Noble
ews-feeder: commit-queue-
Patch for landing (319.93 KB, patch)
2021-11-30 11:52 PST, Jer Noble
ews-feeder: commit-queue-
Patch for landing (319.79 KB, patch)
2021-11-30 13:20 PST, Jer Noble
ews-feeder: commit-queue-
Patch for landing (319.90 KB, patch)
2021-12-02 14:04 PST, Jer Noble
ews-feeder: commit-queue-
Patch for landing (320.07 KB, patch)
2021-12-07 09:02 PST, Jer Noble
ews-feeder: commit-queue-
Patch for landing (320.13 KB, patch)
2021-12-07 21:36 PST, Jer Noble
ews-feeder: commit-queue-
Patch for landing (320.20 KB, patch)
2021-12-08 10:59 PST, Jer Noble
ews-feeder: commit-queue-
Patch for landing (320.16 KB, patch)
2021-12-10 15:22 PST, Jer Noble
no flags
[fast-cq] Follow up fix (4.86 KB, patch)
2021-12-13 09:51 PST, Jer Noble
no flags
Follow-up patch (4.98 KB, patch)
2021-12-15 08:29 PST, Jer Noble
no flags
Jer Noble
Comment 1 2021-09-27 09:33:34 PDT
Eric Carlson
Comment 2 2021-09-27 10:04:09 PDT
Comment on attachment 439362 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=439362&action=review > Source/WebCore/Modules/webcodecs/VideoColorSpace.h:46 > + void setPrimaries(std::optional<VideoColorPrimaries>&& primaries) { m_init.primaries = primaries; } = WTFMove(... > Source/WebCore/Modules/webcodecs/VideoColorSpace.h:49 > + void setTransfer(std::optional<VideoTransferCharacteristics>&& transfer) { m_init.transfer = transfer; } Ditto > Source/WebCore/Modules/webcodecs/VideoColorSpace.h:55 > + void setfFullRange(std::optional<bool>&& fullRange) { m_init.fullRange = fullRange; } Ditto > Source/WebCore/Modules/webcodecs/VideoColorSpace.h:60 > + : m_init(init) Ditto > Source/WebCore/platform/graphics/HEVCUtilities.cpp:81 > + StringBuilder builder; > + builder.append("codecs=\"avc1."); > + builder.append(hex(parameters.profileIDC, 2)); > + builder.append(hex(parameters.constraintsFlags, 2)); > + builder.append(hex(parameters.levelIDC, 2)); > + builder.append('"'); > + return builder.toString(); Would `makeString("codecs=\"avc1.", hex(parameters.profileIDC, 2), ...)` be more efficient (I can never remember when to use one vs the other)? > Source/WebCore/platform/graphics/HEVCUtilities.cpp:205 > + StringBuilder builder; > + builder.append("codecs=\"hvc1."); > + if (parameters.generalProfileSpace) > + builder.append('A' + parameters.generalProfileSpace - 1); > + builder.append(parameters.generalProfileIDC); > + builder.append('.'); > + builder.append(OSSwapInt32(parameters.generalProfileCompatibilityFlags)); > + builder.append('.'); > + builder.append(parameters.generalTierFlag ? 'H' : 'L'); > + builder.append(parameters.generalLevelIDC); > + builder.append('"'); Ditto > Source/WebCore/platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:245 > > + Nit: extra blank line
Radar WebKit Bug Importer
Comment 3 2021-10-04 09:02:34 PDT
Jer Noble
Comment 4 2021-10-22 20:05:44 PDT
Jer Noble
Comment 5 2021-10-22 21:39:22 PDT
Jer Noble
Comment 6 2021-10-22 22:18:33 PDT
Jean-Yves Avenard [:jya]
Comment 7 2021-10-22 22:22:45 PDT
Comment on attachment 442251 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=442251&action=review > Source/WebCore/platform/graphics/VideoTrackPrivate.h:66 > + virtual void setCodec(String codec) { m_codec = codec; } Should do WTFMove(codec) so that the compiler can optimise accordingly see https://clang.llvm.org/extra/clang-tidy/checks/modernize-pass-by-value.html > Source/WebCore/platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.h:57 > + AVAssetTrack *assetTrack() const; Seeing that the code declare it as AVAssetTrack* shouldn't this style be enforced everywhere?
Jer Noble
Comment 8 2021-10-23 09:13:29 PDT
Jer Noble
Comment 9 2021-10-23 09:19:18 PDT
(In reply to Jean-Yves Avenard [:jya] from comment #7) > Comment on attachment 442251 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=442251&action=review > > > Source/WebCore/platform/graphics/VideoTrackPrivate.h:66 > > + virtual void setCodec(String codec) { m_codec = codec; } > > Should do WTFMove(codec) so that the compiler can optimise accordingly see > https://clang.llvm.org/extra/clang-tidy/checks/modernize-pass-by-value.html Ok. > > Source/WebCore/platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.h:57 > > + AVAssetTrack *assetTrack() const; > > Seeing that the code declare it as AVAssetTrack* shouldn't this style be > enforced everywhere? `Type *name` _is_ the style for Objective-C objects: <https://webkit.org/code-style-guidelines/#pointers-non-cpp>. It's not perfectly enforced however.
Jer Noble
Comment 10 2021-10-23 09:21:20 PDT
Jer Noble
Comment 11 2021-10-23 17:25:09 PDT
Jer Noble
Comment 12 2021-11-18 12:42:59 PST
Jer Noble
Comment 13 2021-11-18 14:26:19 PST
Jer Noble
Comment 14 2021-11-18 15:17:58 PST
Jer Noble
Comment 15 2021-11-18 15:39:23 PST
Eric Carlson
Comment 16 2021-11-18 18:07:55 PST
Comment on attachment 444746 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=444746&action=review > Source/WebCore/Modules/webcodecs/VideoColorSpace.h:64 > + VideoColorSpaceInit m_init { }; Nit: 'm_init' is a strange name since it is mutated by the setters. Maybe 'm_state'? > Source/WebCore/html/track/AudioTrackConfiguration.h:66 > + AudioTrackConfigurationInit m_init; Ditto > Source/WebCore/platform/graphics/VideoTrackPrivate.h:75 > + virtual void setColorSpace(PlatformVideoColorSpace colorSpace) { m_colorSpace = colorSpace; } setColorSpace(PlatformVideoColorSpace&& colorSpace) { m_colorSpace = WTFMove(colorSpace); } > Source/WebCore/platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:260 > + if (!assetTrack || !assetTrack.formatDescriptions.count) > + return nullptr; Why not assert if there is no assetTrack like in the other methods? > Source/WebCore/platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:299 > + auto assetTrack = assetTrackFor(*this); > + if (!assetTrack) { > + ASSERT_NOT_REACHED(); > + return 0; > + } > + return assetTrack.nominalFrameRate; Nit: This style should match the other methods: if (auto assetTrack = assetTrackFor(*this)) return assetTrack.nominalFrameRate; ASSERT_NOT_REACHED(); return 0; > Source/WebKit/GPUProcess/media/RemoteVideoTrackProxy.cpp:70 > + .colorSpace = m_trackPrivate->colorSpace(), can you WTFMove() this? > Source/WebKit/GPUProcess/media/TrackPrivateRemoteConfiguration.h:178 > + *codec, WTFMove > Source/WebKit/GPUProcess/media/TrackPrivateRemoteConfiguration.h:181 > + *colorSpace, Ditto
Jer Noble
Comment 17 2021-11-19 23:26:26 PST
Jer Noble
Comment 18 2021-11-20 10:02:45 PST
Jer Noble
Comment 19 2021-11-20 13:01:42 PST
Jer Noble
Comment 20 2021-11-20 15:39:31 PST
(In reply to Eric Carlson from comment #16) > Comment on attachment 444746 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=444746&action=review > > > Source/WebCore/Modules/webcodecs/VideoColorSpace.h:64 > > + VideoColorSpaceInit m_init { }; > > Nit: 'm_init' is a strange name since it is mutated by the setters. Maybe > 'm_state'? Ok. > > Source/WebCore/html/track/AudioTrackConfiguration.h:66 > > + AudioTrackConfigurationInit m_init; > > Ditto Ok. > > Source/WebCore/platform/graphics/VideoTrackPrivate.h:75 > > + virtual void setColorSpace(PlatformVideoColorSpace colorSpace) { m_colorSpace = colorSpace; } > > setColorSpace(PlatformVideoColorSpace&& colorSpace) { m_colorSpace = > WTFMove(colorSpace); } Ok. > > Source/WebCore/platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:260 > > + if (!assetTrack || !assetTrack.formatDescriptions.count) > > + return nullptr; > > Why not assert if there is no assetTrack like in the other methods? Because this one commonly gets hit for HLS content. I've only seen this get hit for audio tracks, though. > > Source/WebCore/platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:299 > > + auto assetTrack = assetTrackFor(*this); > > + if (!assetTrack) { > > + ASSERT_NOT_REACHED(); > > + return 0; > > + } > > + return assetTrack.nominalFrameRate; > > Nit: This style should match the other methods: > > if (auto assetTrack = assetTrackFor(*this)) > return assetTrack.nominalFrameRate; > ASSERT_NOT_REACHED(); > return 0; Ok. > > Source/WebKit/GPUProcess/media/RemoteVideoTrackProxy.cpp:70 > > + .colorSpace = m_trackPrivate->colorSpace(), > > can you WTFMove() this? Don't need to. Return values are already r-value references. > > Source/WebKit/GPUProcess/media/TrackPrivateRemoteConfiguration.h:178 > > + *codec, > > WTFMove Ok. > > Source/WebKit/GPUProcess/media/TrackPrivateRemoteConfiguration.h:181 > > + *colorSpace, > > Ditto Ok.
Jer Noble
Comment 21 2021-11-20 15:50:24 PST
Created attachment 444908 [details] Patch for landing
Jer Noble
Comment 22 2021-11-30 09:33:47 PST
Created attachment 445428 [details] Patch for landing
Jer Noble
Comment 23 2021-11-30 11:52:36 PST
Created attachment 445450 [details] Patch for landing
Jer Noble
Comment 24 2021-11-30 13:20:07 PST
Created attachment 445463 [details] Patch for landing
Jer Noble
Comment 25 2021-12-02 14:04:43 PST
Created attachment 445771 [details] Patch for landing
Jer Noble
Comment 26 2021-12-07 09:02:10 PST
Created attachment 446182 [details] Patch for landing
Jer Noble
Comment 27 2021-12-07 21:36:27 PST
Created attachment 446288 [details] Patch for landing
Jer Noble
Comment 28 2021-12-08 10:59:29 PST
Created attachment 446386 [details] Patch for landing
EWS
Comment 29 2021-12-08 16:51:23 PST
Committed r286754 (244997@main): <https://commits.webkit.org/244997@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 446386 [details].
Robert Jenner
Comment 30 2021-12-09 15:56:51 PST
Reverted r286754 for reason: Broke 2 tests on all mac an iOS Committed r286813 (245049@trunk): <https://commits.webkit.org/245049@trunk>
Jer Noble
Comment 31 2021-12-10 15:22:38 PST
Created attachment 446827 [details] Patch for landing
EWS
Comment 32 2021-12-11 01:02:03 PST
Committed r286908 (245134@main): <https://commits.webkit.org/245134@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 446827 [details].
Jer Noble
Comment 33 2021-12-13 09:51:18 PST
Reopening to attach new patch.
Jer Noble
Comment 34 2021-12-13 09:51:21 PST
Created attachment 447019 [details] [fast-cq] Follow up fix
Jer Noble
Comment 35 2021-12-13 09:51:55 PST
Apologies, managed to re-land my patch without the test fix.
EWS
Comment 36 2021-12-13 09:55:37 PST
Committed r286953 (?): <https://commits.webkit.org/r286953> All reviewed patches have been landed. Closing bug and clearing flags on attachment 447019 [details].
Jer Noble
Comment 37 2021-12-15 08:29:44 PST
Reopening to attach new patch.
Jer Noble
Comment 38 2021-12-15 08:29:48 PST
Created attachment 447235 [details] Follow-up patch
EWS
Comment 39 2021-12-16 14:20:02 PST
Committed r287158 (245335@main): <https://commits.webkit.org/245335@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 447235 [details].
Yusuke Suzuki
Comment 40 2022-01-15 15:50:34 PST
Please do not use pas_utils.h. It is not utility header we can use (outside of bmalloc). libpas is self-contained, and it is used by the other projects. Unless it is marked as PAS_API, there is no guarantee that this function continues to exist. If we need some of these functions, define it in WTF and use it.
Yusuke Suzuki
Comment 41 2022-01-15 15:52:03 PST
(In reply to Yusuke Suzuki from comment #40) > Please do not use pas_utils.h. It is not utility header we can use (outside > of bmalloc). > libpas is self-contained, and it is used by the other projects. Unless it is > marked as PAS_API, there is no guarantee that this function continues to > exist. > If we need some of these functions, define it in WTF and use it. Tracked in https://bugs.webkit.org/show_bug.cgi?id=235275
Yusuke Suzuki
Comment 42 2022-01-19 13:32:19 PST
I wonder if this patch broke 32bit build in https://bugs.webkit.org/show_bug.cgi?id=235372
Yusuke Suzuki
Comment 43 2022-01-20 12:18:48 PST
(In reply to Yusuke Suzuki from comment #42) > I wonder if this patch broke 32bit build in > https://bugs.webkit.org/show_bug.cgi?id=235372 Yes, including pas_utils.h broke 32bit build.
Note You need to log in before you can comment on or make changes to this bug.