Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
webrtc-sys: patch
---

# Fix missing RTC_OBJC_TYPE macros in webrtc-sys .mm files

Wrap bare ObjC class references in `RTC_OBJC_TYPE()` in `objc_video_factory.mm` and `objc_video_frame_buffer.mm` to support builds with `rtc_objc_prefix` set.
8 changes: 4 additions & 4 deletions webrtc-sys/src/objc_video_factory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
namespace livekit_ffi {

std::unique_ptr<webrtc::VideoEncoderFactory> CreateObjCVideoEncoderFactory() {
RTCDefaultVideoEncoderFactory* encoderFactory = [[RTCDefaultVideoEncoderFactory alloc] init];
RTCVideoEncoderFactorySimulcast* simulcastFactory =
[[RTCVideoEncoderFactorySimulcast alloc] initWithPrimary:encoderFactory fallback:encoderFactory];
RTC_OBJC_TYPE(RTCDefaultVideoEncoderFactory)* encoderFactory = [[RTC_OBJC_TYPE(RTCDefaultVideoEncoderFactory) alloc] init];
RTC_OBJC_TYPE(RTCVideoEncoderFactorySimulcast)* simulcastFactory =
[[RTC_OBJC_TYPE(RTCVideoEncoderFactorySimulcast) alloc] initWithPrimary:encoderFactory fallback:encoderFactory];
return webrtc::ObjCToNativeVideoEncoderFactory(simulcastFactory);
}

std::unique_ptr<webrtc::VideoDecoderFactory> CreateObjCVideoDecoderFactory() {
return webrtc::ObjCToNativeVideoDecoderFactory([[RTCDefaultVideoDecoderFactory alloc] init]);
return webrtc::ObjCToNativeVideoDecoderFactory([[RTC_OBJC_TYPE(RTCDefaultVideoDecoderFactory) alloc] init]);
}

} // namespace livekit_ffi
6 changes: 3 additions & 3 deletions webrtc-sys/src/objc_video_frame_buffer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
std::unique_ptr<VideoFrameBuffer> new_native_buffer_from_platform_image_buffer(
CVPixelBufferRef pixelBuffer
) {
RTCCVPixelBuffer *buffer = [[RTCCVPixelBuffer alloc] initWithPixelBuffer:pixelBuffer];
RTC_OBJC_TYPE(RTCCVPixelBuffer) *buffer = [[RTC_OBJC_TYPE(RTCCVPixelBuffer) alloc] initWithPixelBuffer:pixelBuffer];
webrtc::scoped_refptr<webrtc::VideoFrameBuffer> frame_buffer = webrtc::ObjCToNativeVideoFrameBuffer(buffer);
[buffer release];
CVPixelBufferRelease(pixelBuffer);
Expand All @@ -37,8 +37,8 @@ CVPixelBufferRef native_buffer_to_platform_image_buffer(
) {
id<RTC_OBJC_TYPE(RTCVideoFrameBuffer)> rtc_pixel_buffer = webrtc::NativeToObjCVideoFrameBuffer(buffer->get());

if ([rtc_pixel_buffer isKindOfClass:[RTCCVPixelBuffer class]]) {
RTCCVPixelBuffer *cv_pixel_buffer = (RTCCVPixelBuffer *)rtc_pixel_buffer;
if ([rtc_pixel_buffer isKindOfClass:[RTC_OBJC_TYPE(RTCCVPixelBuffer) class]]) {
RTC_OBJC_TYPE(RTCCVPixelBuffer) *cv_pixel_buffer = (RTC_OBJC_TYPE(RTCCVPixelBuffer) *)rtc_pixel_buffer;
return [cv_pixel_buffer pixelBuffer];
} else {
return nullptr;
Expand Down