Repository navigation
Compositor: add blur-glass effect - #89
Conversation
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Essentials Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
There was a problem hiding this comment.
🟡 Changes recommended
The blur-glass implementation has three unresolved moderate issues affecting correctness and documentation.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds a compositor blur-glass sink-pad effect alongside GStreamer RTMP cleanup and WebRTC logging patches.
Changes:
- Adds blur-glass properties and rendering logic.
- Fixes RTMP connection cleanup.
- Reduces WebRTC FEC logging verbosity.
- Applies patches during the GStreamer build.
File summaries
| File | Summary |
|---|---|
docker/build-gstreamer/patch/gstreamer/0003-compositor-add-blur-glass-effect-property-to-sinkpad.patch |
Adds blur-glass functionality; requires fixes for documentation wording, the first-pad fast path, and SOURCE blend handling. |
docker/build-gstreamer/patch/gstreamer/0004-Reduce-logs-verbosity-in-webrtcbin-when-a-FEC-decode.patch |
Reduces WebRTC FEC decoder log severity. |
docker/build-gstreamer/patch/gstreamer/0005-rtmp2-rtmpclient-Close-the-connection-when-the-conne.patch |
Cleans up failed RTMP client connections. |
docker/build-gstreamer/patch/gstreamer/0006-rtmp2src-Close-the-connection-when-starting-playback.patch |
Cleans up failed playback connections. |
docker/build-gstreamer/patch/gstreamer/0007-rtmp2sink-Close-the-connection-when-starting-publish.patch |
Cleans up failed publishing connections. |
docker/build-gstreamer/compile |
Applies the patches in sequence. |
Review details
Suppressed comments (5)
docker/build-gstreamer/patch/gstreamer/0003-compositor-add-blur-glass-effect-property-to-sinkpad.patch:226
- This loop only averages pixels from the current scanline, so the implementation is a horizontal 1-D filter rather than the documented 2-D box blur. Vertical edges and changes in the background across adjacent rows are left unblurred; use a vertical pass (or an equivalent 2-D/separable implementation) before writing the output.
+ for (gint i = start; i <= end; ++i) {
+ guint8 *pixel = (guint8 *) (row_copy + i);
+ sum[0] += pixel[0];
+ sum[1] += pixel[1];
+ sum[2] += pixel[2];
docker/build-gstreamer/patch/gstreamer/0003-compositor-add-blur-glass-effect-property-to-sinkpad.patch:226
- The per-pixel inner loop scans every column in the radius, making this O(width × height × radius) for each blurred pad and frame. With the default radius on 4K video, or a large user-supplied radius, this can dominate compositor CPU; a sliding-window or summed-area/separable blur keeps the work linear in the number of pixels.
+ for (gint i = start; i <= end; ++i) {
+ guint8 *pixel = (guint8 *) (row_copy + i);
+ sum[0] += pixel[0];
+ sum[1] += pixel[1];
+ sum[2] += pixel[2];
docker/build-gstreamer/patch/gstreamer/0003-compositor-add-blur-glass-effect-property-to-sinkpad.patch:219
- The property accepts values through G_MAXUINT, but this casts the radius to gint before doing the window arithmetic. Values above G_MAXINT therefore wrap (for example G_MAXUINT makes start > end and count underflow), producing incorrect pixels and potentially overflowing the additions; clamp the radius to the frame width before converting it.
+ gint start = MAX (0, (gint) x - (gint) radius);
+ gint end = MIN (frame_width - 1, (gint) x + (gint) radius);
+ guint count = end - start + 1;
docker/build-gstreamer/patch/gstreamer/0003-compositor-add-blur-glass-effect-property-to-sinkpad.patch:137
- The new
blur_glassflag is collected here, but the compositor's first-pad copy fast path (in the preceding box-shadow patch) does not exclude it. If this is the first full-frame pad, aggregation copiesprepared_framedirectly and never reachesblend_pads(), soblur_glass_background()is skipped entirely. The fast-path condition must also require!compo_info->blur_glass.
+ info->blur_glass = pad->blur_glass;
+ info->blur_glass_radius = pad->blur_glass_radius;
+ info->has_alpha = (pad->alpha != 1.0
+ || GST_VIDEO_INFO_HAS_ALPHA (&GST_VIDEO_AGGREGATOR_PAD (pad)->info));
docker/build-gstreamer/patch/gstreamer/0003-compositor-add-blur-glass-effect-property-to-sinkpad.patch:256
- The blur runs before the final
composite()call, but this code does not changeinfo->blend_modewhen it isCOMPOSITOR_BLEND_MODE_SOURCE. A source-operator pad replaces the destination region, so it overwrites the blurred background and makesblur-glassineffective for that valid operator combination. As with rounded corners in the preceding patch, force SOURCE to OVER when the effect is active, while doing so during pad-info extraction rather than in the parallel render loop.
+ // Blur the composited background behind this pad (frosted-glass effect)
+ if (info->blur_glass && info->blur_glass_radius > 0 && info->has_alpha) {
+ if (has_visible_src_rect (&visible_src_rect, &dest_rect, comp)) {
+ visible_src_rect.x += dest_rect.x;
+ visible_src_rect.y += dest_rect.y;
+ blur_glass_background (comp, &visible_src_rect, &dest_rect,
+ info->border_radius, info->blur_glass_radius);
+ }
+ }
- Files reviewed: 2/6 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
No description provided.