Skip to content

Commit cffc13f

Browse files
committed
fix for intel mac.
1 parent aaa0c1c commit cffc13f

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

sdk/objc/native/src/objc_desktop_capture.mm

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,24 @@
7575
int real_width = width;
7676

7777
if(type_ == kWindow) {
78-
// A multiple of 32 must be used as the width of the src frame,
78+
int multiple = 0;
79+
#if defined(WEBRTC_ARCH_X86_FAMILY)
80+
multiple = 16;
81+
#elif defined(WEBRTC_ARCH_ARM64)
82+
multiple = 32;
83+
#endif
84+
// A multiple of $multiple must be used as the width of the src frame,
7985
// and the right black border needs to be cropped during conversion.
80-
if( (width % 32) != 0 ) {
81-
width = (width / 32 + 1) * 32;
86+
if( multiple != 0 && (width % multiple) != 0 ) {
87+
width = (width / multiple + 1) * multiple;
8288
}
8389
}
8490

8591
if (!i420_buffer_ || !i420_buffer_.get() ||
8692
i420_buffer_->width() * i420_buffer_->height() != real_width * height) {
87-
88-
89-
9093
i420_buffer_ = webrtc::I420Buffer::Create(real_width, height);
9194
}
95+
9296
libyuv::ConvertToI420(frame->data(),
9397
0,
9498
i420_buffer_->MutableDataY(),

sdk/objc/native/src/objc_desktop_media_list.mm

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,16 @@
166166
int real_width = width;
167167

168168
if(type_ == kWindow) {
169-
// A multiple of 32 must be used as the width of the src frame,
169+
int multiple = 0;
170+
#if defined(WEBRTC_ARCH_X86_FAMILY)
171+
multiple = 16;
172+
#elif defined(WEBRTC_ARCH_ARM64)
173+
multiple = 32;
174+
#endif
175+
// A multiple of $multiple must be used as the width of the src frame,
170176
// and the right black border needs to be cropped during conversion.
171-
if( (width % 32) != 0 ) {
172-
width = (width / 32 + 1) * 32;
177+
if( multiple != 0 && (width % multiple) != 0 ) {
178+
width = (width / multiple + 1) * multiple;
173179
}
174180
}
175181

0 commit comments

Comments
 (0)