FlutterRgbaRendererPluginOnRgba runs on the caller's thread, a Kitedesk
video thread, which has no autorelease pool and lives as long as the
session: an object autoreleased there would stay until the session ends
(pointed out in upstream PR #2). Each frame now runs in an @autoreleasepool.
On macOS 26.5.2 the frame path autoreleases nothing on that thread, before
and after this series (frames_leave_no_autoreleased_objects passes on
50efc18e too), so this is a guard: a probe saw CoreVideo autorelease objects
when a process first made an IOSurface on such a thread, and the engine's
registrar logs with NSLog for a frame announced to it after its engine is
gone, which the old code did on the video thread.
Tests: 13 of 13 pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
887 B
Objective-C
30 lines
887 B
Objective-C
//
|
|
// TextureRgbaApi.m
|
|
// texture_rgba_renderer
|
|
//
|
|
// Created by kingtous on 2023/2/19.
|
|
//
|
|
// Modified by the Kitedesk fork (2026, T-4204): an autorelease pool around
|
|
// each frame.
|
|
//
|
|
|
|
#import <Foundation/Foundation.h>
|
|
#import "texture_rgba_renderer/texture_rgba_renderer-Swift.h"
|
|
|
|
#if __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/// Keep the same name with Windows.
|
|
void FlutterRgbaRendererPluginOnRgba(void* texture_rgba_ptr, const uint8_t* buffer, int len, int width, int height, int stride_align) {
|
|
// The caller's thread, a session's video thread, has no autorelease pool and
|
|
// lives as long as the session.
|
|
@autoreleasepool {
|
|
TextRgba* texture_rgba = (__bridge TextRgba *)(texture_rgba_ptr);
|
|
[texture_rgba markFrameAvaliableRawWithBuffer:buffer len:len width:width height:height stride_align: stride_align];
|
|
}
|
|
}
|
|
|
|
#if __cplusplus
|
|
} //Extern C
|
|
#endif
|