Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GStreamer] Make GstMappedFrame assert when it is not initialized #25007

Merged
merged 1 commit into from
Feb 26, 2024

Conversation

calvaris
Copy link
Contributor

@calvaris calvaris commented Feb 23, 2024

8ce9ffa

[GStreamer] Make GstMappedFrame assert when it is not initialized
https://bugs.webkit.org/show_bug.cgi?id=269980

Reviewed by Carlos Garcia Campos.

This way we can align the implementation of GstMappedFrame with GstMappedBuffer and assert when its data is accessed but
it was not properly mapped at initialization.

Even when now it is properly protected at members access, additional checks were added in some places where its
instantiation was not being checked.

A fly-by improvement is making the constructor taking GRefPtr<GstSample> to take const & to avoid unnecessary ref/unref.

* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h:
(WebCore::GstMappedFrame::GstMappedFrame):
(WebCore::GstMappedFrame::get):
(WebCore::GstMappedFrame::ComponentData const):
(WebCore::GstMappedFrame::ComponentStride const):
(WebCore::GstMappedFrame::info):
(WebCore::GstMappedFrame::width const):
(WebCore::GstMappedFrame::height const):
(WebCore::GstMappedFrame::format const):
(WebCore::GstMappedFrame::planeData const):
(WebCore::GstMappedFrame::planeStride const):
(WebCore::GstMappedFrame::isValid const):
(WebCore::GstMappedFrame::operator! const):
* Source/WebCore/platform/graphics/gstreamer/VideoFrameGStreamer.cpp:
(WebCore::VideoFrame::copyTo):
* Source/WebCore/platform/mediastream/libwebrtc/gstreamer/GStreamerVideoFrameLibWebRTC.cpp:
(WebCore::GStreamerVideoFrameLibWebRTC::ToI420):

Canonical link: https://commits.webkit.org/275320@main

2cdc7c7

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug   πŸ§ͺ wpe-wk2
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac   πŸ§ͺ api-wpe
loading πŸ§ͺ webkitpy βœ… πŸ§ͺ ios-wk2-wpt βœ… πŸ§ͺ mac-wk1 βœ… πŸ›  gtk
  πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk2   πŸ§ͺ gtk-wk2
βœ… πŸ›  tv   πŸ§ͺ mac-AS-debug-wk2 βœ… πŸ§ͺ api-gtk
βœ… πŸ›  tv-sim
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch
βœ… πŸ›  watch-sim

@calvaris calvaris requested a review from philn as a code owner February 23, 2024 10:11
@calvaris calvaris self-assigned this Feb 23, 2024
@calvaris calvaris added the Media Bugs related to the HTML 5 Media elements. label Feb 23, 2024
@calvaris calvaris marked this pull request as draft February 23, 2024 11:52
@calvaris calvaris changed the title [Skia][GStreamer] Small conceptual improvement on ImageGStreamer [GStreamer] Move GstMappedFrame to heap to increase coding safety when instantiation is invalid Feb 23, 2024
@calvaris calvaris marked this pull request as ready for review February 23, 2024 12:44
@calvaris calvaris marked this pull request as draft February 23, 2024 13:07
@calvaris calvaris changed the title [GStreamer] Move GstMappedFrame to heap to increase coding safety when instantiation is invalid [GStreamer] Make GstMappedFrame assert when it is not initialized Feb 23, 2024
@calvaris calvaris marked this pull request as ready for review February 23, 2024 17:14
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Feb 23, 2024
@calvaris calvaris removed the merging-blocked Applied to prevent a change from being merged label Feb 26, 2024
@calvaris calvaris changed the title [GStreamer] Make GstMappedFrame assert when it is not initialized fixup! [GStreamer] Make GstMappedFrame assert when it is not initialized https://bugs.webkit.org/show_bug.cgi?id=269980 Feb 26, 2024
@calvaris calvaris changed the title fixup! [GStreamer] Make GstMappedFrame assert when it is not initialized https://bugs.webkit.org/show_bug.cgi?id=269980 [GStreamer] Make GstMappedFrame assert when it is not initialized Feb 26, 2024
@calvaris calvaris added the merge-queue Applied to send a pull request to merge-queue label Feb 26, 2024
https://bugs.webkit.org/show_bug.cgi?id=269980

Reviewed by Carlos Garcia Campos.

This way we can align the implementation of GstMappedFrame with GstMappedBuffer and assert when its data is accessed but
it was not properly mapped at initialization.

Even when now it is properly protected at members access, additional checks were added in some places where its
instantiation was not being checked.

A fly-by improvement is making the constructor taking GRefPtr<GstSample> to take const & to avoid unnecessary ref/unref.

* Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h:
(WebCore::GstMappedFrame::GstMappedFrame):
(WebCore::GstMappedFrame::get):
(WebCore::GstMappedFrame::ComponentData const):
(WebCore::GstMappedFrame::ComponentStride const):
(WebCore::GstMappedFrame::info):
(WebCore::GstMappedFrame::width const):
(WebCore::GstMappedFrame::height const):
(WebCore::GstMappedFrame::format const):
(WebCore::GstMappedFrame::planeData const):
(WebCore::GstMappedFrame::planeStride const):
(WebCore::GstMappedFrame::isValid const):
(WebCore::GstMappedFrame::operator! const):
* Source/WebCore/platform/graphics/gstreamer/VideoFrameGStreamer.cpp:
(WebCore::VideoFrame::copyTo):
* Source/WebCore/platform/mediastream/libwebrtc/gstreamer/GStreamerVideoFrameLibWebRTC.cpp:
(WebCore::GStreamerVideoFrameLibWebRTC::ToI420):

Canonical link: https://commits.webkit.org/275320@main
@webkit-commit-queue
Copy link
Collaborator

Committed 275320@main (8ce9ffa): https://commits.webkit.org/275320@main

Reviewed commits have been landed. Closing PR #25007 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 8ce9ffa into WebKit:main Feb 26, 2024
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Feb 26, 2024
@calvaris calvaris deleted the eng/269980 branch February 26, 2024 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Media Bugs related to the HTML 5 Media elements.
Projects
None yet
6 participants