| 7 | #include "api/audio_codecs/opus/audio_encoder_opus.h" |
| 8 | #include "api/rtp_parameters.h" |
| 9 | #include "api/task_queue/default_task_queue_factory.h" |
| 10 | #include "media/base/codec.h" |
| 11 | #include "media/base/media_constants.h" |
| 12 | #include "media/engine/webrtc_media_engine.h" |
| 13 | #include "modules/audio_device/include/audio_device_default.h" |
| 14 | #include "rtc_base/task_utils/repeating_task.h" |
| 15 | #include "system_wrappers/include/field_trial.h" |
| 16 | #include "api/video/builtin_video_bitrate_allocator_factory.h" |
| 17 | #include "api/video/video_bitrate_allocation.h" |
| 18 |
| 19 | #include "sdk/objc/native/api/video_encoder_factory.h" |
| 20 | #include "sdk/objc/native/api/video_decoder_factory.h" |
| 21 |
| 22 | #include "sdk/objc/api/RTCVideoRendererAdapter.h" |
| 23 | #include "sdk/objc/native/api/video_frame.h" |
| 24 | #include "api/media_types.h" |
| 25 |
| 26 | #ifndef WEBRTC_IOS |
| 27 | #import "VideoCameraCapturerMac.h" |
| 28 | #import "tgcalls/platform/darwin/DesktopSharingCapturer.h" |
| 29 | #import "tgcalls/desktop_capturer/DesktopCaptureSourceHelper.h" |
| 30 | #import "CustomExternalCapturer.h" |
| 31 | #import "VideoCMIOCapture.h" |
| 32 | #else |
| 33 | #import "VideoCameraCapturer.h" |
| 34 | #import "CustomExternalCapturer.h" |
| 35 | #endif |
| 36 | #import <AVFoundation/AVFoundation.h> |
| 37 |
| 38 | #import "VideoCaptureInterface.h" |
| 39 | #import "platform/PlatformInterface.h" |
| 40 |
| 41 | @interface VideoCapturerInterfaceImplSourceDescription : NSObject |
| 42 |
| 43 | @property (nonatomic, readonly) bool isFrontCamera; |
| 44 | @property (nonatomic, readonly) bool keepLandscape; |
| 45 | @property (nonatomic, readonly) NSString *deviceId; |
| 46 | @property (nonatomic, strong, readonly, nullable) AVCaptureDevice *device; |
| 47 | @property (nonatomic, strong, readonly, nullable) AVCaptureDeviceFormat *format; |
| 48 |
| 49 | @end |
| 50 |
| 51 | @implementation VideoCapturerInterfaceImplSourceDescription |
| 52 |
| 53 | - (instancetype)initWithIsFrontCamera:(bool)isFrontCamera keepLandscape:(bool)keepLandscape deviceId:(NSString *)deviceId device:(AVCaptureDevice * _Nullable)device format:(AVCaptureDeviceFormat * _Nullable)format { |
| 54 | self = [super init]; |
| 55 | if (self != nil) { |
| 56 | _isFrontCamera = isFrontCamera; |
| 57 | _keepLandscape = keepLandscape; |
| 58 | _deviceId = deviceId; |
| 59 | _device = device; |
| 60 | _format = format; |
| 61 | } |
| 62 | return self; |
| 63 | } |
| 64 |
| 65 | @end |
| 66 |
| 67 | @interface VideoCapturerInterfaceImplReference : NSObject { |
| 68 | #ifdef WEBRTC_IOS |
| 69 | CustomExternalCapturer *_customExternalCapturer; |
| 70 | VideoCameraCapturer *_videoCameraCapturer; |
| 71 | #else |
| 72 | id<CapturerInterface> _videoCapturer; |
| 73 | #endif |
| 74 | } |
| 75 |
| 76 | @end |
| 77 |
| 78 | @implementation VideoCapturerInterfaceImplReference |
| 79 |
| 80 | - (id)videoCameraCapturer { |
| 81 | #ifdef WEBRTC_IOS |
| 82 | return _videoCameraCapturer; |
| 83 | #else |
| 84 | return _videoCapturer; |
| 85 | #endif |
| 86 | } |
| 87 |
| 88 | + (AVCaptureDevice *)selectCapturerDeviceWithDeviceId:(NSString *)deviceId { |
| 89 | AVCaptureDevice *selectedCamera = nil; |
| 90 |
| 91 | #ifdef WEBRTC_IOS |
| 92 | bool useFrontCamera = ![deviceId hasPrefix:@"back"]; |
| 93 | AVCaptureDevice *frontCamera = nil; |
| 94 | AVCaptureDevice *backCamera = nil; |
| 95 | for (AVCaptureDevice *device in [VideoCameraCapturer captureDevices]) { |
| 96 | if (device.position == AVCaptureDevicePositionFront) { |
| 97 | frontCamera = device; |
| 98 | } else if (device.position == AVCaptureDevicePositionBack) { |
| 99 | backCamera = device; |
| 100 | } |
| 101 | } |
| 102 | if (useFrontCamera && frontCamera != nil) { |
| 103 | selectedCamera = frontCamera; |
| 104 | } else { |
| 105 | selectedCamera = backCamera; |
| 106 | } |
| 107 | #else |
| 108 |
| 109 | NSArray *deviceComponents = [deviceId componentsSeparatedByString:@":"]; |
| 110 | if (deviceComponents.count == 2) { |
| 111 | deviceId = deviceComponents[0]; |
| 112 | } |
| 113 | //&& [devices[i] hasMediaType:AVMediaTypeVideo] |
| 114 | NSArray<AVCaptureDevice *> *devices = [VideoCameraCapturer captureDevices]; |
| 115 | for (int i = 0; i < devices.count; i++) { |
| 116 | if (devices[i].isConnected && !devices[i].isSuspended ) { |
| 117 | if ([deviceId isEqualToString:@""] || [deviceId isEqualToString:devices[i].uniqueID]) { |
| 118 | selectedCamera = devices[i]; |
| 119 | break; |
| 120 | } |
| 121 | } |
| 122 | } |
| 123 | if (selectedCamera == nil) { |
| 124 | for (int i = 0; i < devices.count; i++) { |
| 125 | if (devices[i].isConnected && !devices[i].isSuspended) { |
| 126 | selectedCamera = devices[i]; |
| 127 | break; |
| 128 | } |
| 129 | } |
| 130 | } |
| 131 | #endif |
| 132 |
| 133 | return selectedCamera; |
| 134 | } |
| 135 |
| 136 | + (AVCaptureDeviceFormat *)selectCaptureDeviceFormatForDevice:(AVCaptureDevice *)selectedCamera { |
| 137 | NSMutableArray<AVCaptureDeviceFormat *> *sortedFormats = [NSMutableArray arrayWithArray:[[VideoCameraCapturer supportedFormatsForDevice:selectedCamera] sortedArrayUsingComparator:^NSComparisonResult(AVCaptureDeviceFormat* lhs, AVCaptureDeviceFormat *rhs) { |
| 138 | int32_t width1 = CMVideoFormatDescriptionGetDimensions(lhs.formatDescription).width; |
| 139 | int32_t width2 = CMVideoFormatDescriptionGetDimensions(rhs.formatDescription).width; |
| 140 | return width1 < width2 ? NSOrderedAscending : NSOrderedDescending; |
| 141 | }]]; |
| 142 | for (int i = (int)[sortedFormats count] - 1; i >= 0; i--) { |
| 143 | if ([[sortedFormats[i] description] containsString:@"x420"]) { |
| 144 | [sortedFormats removeObjectAtIndex:i]; |
| 145 | } |
| 146 | } |
| 147 |
| 148 | AVCaptureDeviceFormat *bestFormat = sortedFormats.firstObject; |
| 149 |
| 150 | bool didSelectPreferredFormat = false; |
| 151 | #ifdef WEBRTC_IOS |
| 152 | for (AVCaptureDeviceFormat *format in sortedFormats) { |
| 153 | CMVideoDimensions dimensions = CMVideoFormatDescriptionGetDimensions(format.formatDescription); |
| 154 | if (dimensions.width == 1280 && dimensions.height == 720) { |
| 155 | if (format.videoFieldOfView > 60.0f && format.videoSupportedFrameRateRanges.lastObject.maxFrameRate == 30) { |
| 156 | didSelectPreferredFormat = true; |
| 157 | bestFormat = format; |
| 158 | break; |
| 159 | } |
| 160 | } |
| 161 | } |
| 162 | #endif |
| 163 | if (!didSelectPreferredFormat) { |
| 164 | for (AVCaptureDeviceFormat *format in sortedFormats) { |
| 165 | CMVideoDimensions dimensions = CMVideoFormatDescriptionGetDimensions(format.formatDescription); |
| 166 | if (dimensions.width >= 720 && dimensions.height >= 720) { |
| 167 | didSelectPreferredFormat = true; |
| 168 | bestFormat = format; |
| 169 | break; |
| 170 | } |
| 171 | } |
| 172 | } |
| 173 | if (!didSelectPreferredFormat) { |
| 174 | for (AVCaptureDeviceFormat *format in sortedFormats) { |
| 175 | CMVideoDimensions dimensions = CMVideoFormatDescriptionGetDimensions(format.formatDescription); |
| 176 | if (dimensions.width >= 640 && dimensions.height >= 640) { |
| 177 | didSelectPreferredFormat = true; |
| 178 | bestFormat = format; |
| 179 | break; |
| 180 | } |
| 181 | } |
| 182 | } |
| 183 |
| 184 | if (bestFormat == nil) { |
| 185 | assert(false); |
| 186 | return nil; |
| 187 | } |
| 188 |
| 189 |
| 190 | return bestFormat; |
| 191 | } |
| 192 |
| 193 | + (VideoCapturerInterfaceImplSourceDescription *)selectCapturerDescriptionWithDeviceId:(NSString *)deviceId { |
| 194 | if ([deviceId isEqualToString:@":ios_custom"]) { |
| 195 | return [[VideoCapturerInterfaceImplSourceDescription alloc] initWithIsFrontCamera:false keepLandscape:false deviceId:deviceId device:nil format:nil]; |
| 196 | } |
| 197 |
| 198 | if ([deviceId hasPrefix:@"desktop_capturer_"]) { |
| 199 | return [[VideoCapturerInterfaceImplSourceDescription alloc] initWithIsFrontCamera:false keepLandscape:true deviceId: deviceId device: nil format: nil]; |
| 200 | } |
| 201 | AVCaptureDevice *selectedCamera = [VideoCapturerInterfaceImplReference selectCapturerDeviceWithDeviceId:deviceId]; |
| 202 |
| 203 | if (selectedCamera == nil) { |
| 204 | return [[VideoCapturerInterfaceImplSourceDescription alloc] initWithIsFrontCamera:![deviceId hasPrefix:@"back"] keepLandscape:[deviceId containsString:@"landscape"] deviceId: deviceId device: nil format: nil]; |
| 205 | } |
| 206 |
| 207 | AVCaptureDeviceFormat *bestFormat = [VideoCapturerInterfaceImplReference selectCaptureDeviceFormatForDevice:selectedCamera]; |
| 208 |
| 209 | return [[VideoCapturerInterfaceImplSourceDescription alloc] initWithIsFrontCamera:![deviceId hasPrefix:@"back"] keepLandscape:[deviceId containsString:@"landscape"] deviceId:deviceId device:selectedCamera format:bestFormat]; |
| 210 | } |
| 211 |
| 212 | - (instancetype)initWithSource:(webrtc::scoped_refptr<webrtc::VideoTrackSourceInterface>)source sourceDescription:(VideoCapturerInterfaceImplSourceDescription *)sourceDescription isActiveUpdated:(void (^)(bool))isActiveUpdated rotationUpdated:(void (^)(int))rotationUpdated { |
| 213 | self = [super init]; |
| 214 | if (self != nil) { |
| 215 | assert([NSThread isMainThread]); |
| 216 |
| 217 | #ifdef WEBRTC_IOS |
| 218 | if ([sourceDescription.deviceId isEqualToString:@":ios_custom"]) { |
| 219 | _customExternalCapturer = [[CustomExternalCapturer alloc] initWithSource:source]; |
| 220 | } else { |
| 221 | _videoCameraCapturer = [[VideoCameraCapturer alloc] initWithSource:source useFrontCamera:sourceDescription.isFrontCamera keepLandscape:sourceDescription.keepLandscape isActiveUpdated:isActiveUpdated rotationUpdated:rotationUpdated]; |
| 222 | [_videoCameraCapturer startCaptureWithDevice:sourceDescription.device format:sourceDescription.format fps:30]; |
| 223 | } |
| 224 | #else |
| 225 | if (const auto desktopCaptureSource = tgcalls::DesktopCaptureSourceForKey([sourceDescription.deviceId UTF8String])) { |
| 226 | DesktopSharingCapturer *sharing = [[DesktopSharingCapturer alloc] initWithSource:source captureSource:desktopCaptureSource]; |
| 227 | _videoCapturer = sharing; |
| 228 | } else if (!tgcalls::ShouldBeDesktopCapture([sourceDescription.deviceId UTF8String])) { |
| 229 | id<CapturerInterface> camera; |
| 230 | if ([sourceDescription.device hasMediaType:AVMediaTypeMuxed]) { |
| 231 | VideoCMIOCapture *value = [[VideoCMIOCapture alloc] initWithSource:source]; |
| 232 | [value setupCaptureWithDevice:sourceDescription.device]; |
| 233 | camera = value; |
| 234 | } else { |
| 235 | VideoCameraCapturer *value = [[VideoCameraCapturer alloc] initWithSource:source isActiveUpdated:isActiveUpdated]; |
| 236 | [value setupCaptureWithDevice:sourceDescription.device format:sourceDescription.format fps:30]; |
| 237 | camera = value; |
| 238 | } |
| 239 | _videoCapturer = camera; |
| 240 | } else { |
| 241 | _videoCapturer = nil; |
| 242 | } |
| 243 | if (_videoCapturer) { |
| 244 | [_videoCapturer start]; |
| 245 | } |
| 246 | #endif |
| 247 |
| 248 | } |
| 249 | return self; |
| 250 | } |
| 251 |
| 252 | - (void)dealloc { |
| 253 | assert([NSThread isMainThread]); |
| 254 |
| 255 | #ifdef WEBRTC_IOS |
| 256 | [_videoCameraCapturer stopCapture]; |
| 257 | #elif TARGET_OS_OSX |
| 258 | if (_videoCapturer) { |
| 259 | [_videoCapturer stop]; |
| 260 | } |
| 261 | #endif |
| 262 | } |
| 263 |
| 264 | -(void)setOnFatalError:(std::function<void()>)error { |
| 265 | #ifdef WEBRTC_IOS |
| 266 | #else |
| 267 | if (_videoCapturer) { |
| 268 | [_videoCapturer setOnFatalError:error]; |
| 269 | } else if (error) { |
| 270 | error(); |
| 271 | } |
| 272 | #endif |
| 273 | } |
| 274 |
| 275 | -(void)setOnPause:(std::function<void(bool)>)pause { |
| 276 | #ifdef WEBRTC_IOS |
| 277 | #else |
| 278 | if (_videoCapturer) { |
| 279 | [_videoCapturer setOnPause:pause]; |
| 280 | } |
| 281 | #endif |
| 282 | } |
| 283 |
| 284 | - (void)setIsEnabled:(bool)isEnabled { |
| 285 | #ifdef WEBRTC_IOS |
| 286 | if (_videoCameraCapturer) { |
| 287 | [_videoCameraCapturer setIsEnabled:isEnabled]; |
| 288 | } |
| 289 | #else |
| 290 | if (_videoCapturer) { |
| 291 | [_videoCapturer setIsEnabled:isEnabled]; |
| 292 | } |
| 293 | #endif |
| 294 | } |
| 295 |
| 296 | - (void)setUncroppedSink:(std::shared_ptr<rtc::VideoSinkInterface<webrtc::VideoFrame>>)sink { |
| 297 | #ifdef WEBRTC_IOS |
| 298 | if (_videoCameraCapturer) { |
| 299 | [_videoCameraCapturer setUncroppedSink:sink]; |
| 300 | } |
| 301 | #else |
| 302 | if (_videoCapturer) { |
| 303 | [_videoCapturer setUncroppedSink:sink]; |
| 304 | } |
| 305 | #endif |
| 306 | } |
| 307 |
| 308 | - (void)setPreferredCaptureAspectRatio:(float)aspectRatio { |
| 309 | #ifdef WEBRTC_IOS |
| 310 | if (_videoCameraCapturer) { |
| 311 | [_videoCameraCapturer setPreferredCaptureAspectRatio:aspectRatio]; |
| 312 | } |
| 313 | #else |
| 314 | if (_videoCapturer) { |
| 315 | [_videoCapturer setPreferredCaptureAspectRatio:aspectRatio]; |
| 316 | } |
| 317 | #endif |
| 318 | } |
| 319 |
| 320 | - (int)getRotation { |
| 321 | #ifdef WEBRTC_IOS |
| 322 | if (_videoCameraCapturer) { |
| 323 | return [_videoCameraCapturer getRotation]; |
| 324 | } else { |
| 325 | return 0; |
| 326 | } |
| 327 | #elif TARGET_OS_OSX |
| 328 | return 0; |
| 329 | #else |
| 330 | #error "Unsupported platform" |
| 331 | #endif |
| 332 | } |
| 333 |
| 334 | - (id)getInternalReference { |
| 335 | #ifdef WEBRTC_IOS |
| 336 | if (_videoCameraCapturer) { |
| 337 | return _videoCameraCapturer; |
| 338 | } else if (_customExternalCapturer) { |
| 339 | return _customExternalCapturer; |
| 340 | } else { |
| 341 | return nil; |
| 342 | } |
| 343 | #endif |
| 344 | return nil; |
| 345 | } |
| 346 |
| 347 | @end |
| 348 |
| 349 | @implementation VideoCapturerInterfaceImplHolder |
| 350 |
| 351 | @end |
| 352 |
| 353 | namespace tgcalls { |
| 354 |
| 355 | VideoCapturerInterfaceImpl::VideoCapturerInterfaceImpl(webrtc::scoped_refptr<webrtc::VideoTrackSourceInterface> source, std::string deviceId, std::function<void(VideoState)> stateUpdated, std::function<void(PlatformCaptureInfo)> captureInfoUpdated, std::pair<int, int> &outResolution) : |
| 356 | _source(source) { |
| 357 | VideoCapturerInterfaceImplSourceDescription *sourceDescription = [VideoCapturerInterfaceImplReference selectCapturerDescriptionWithDeviceId:[NSString stringWithUTF8String:deviceId.c_str()]]; |
| 358 |
| 359 | CMVideoDimensions dimensions = CMVideoFormatDescriptionGetDimensions(sourceDescription.format.formatDescription); |
| 360 | #ifdef WEBRTC_IOS |
| 361 | outResolution.first = dimensions.height; |
| 362 | outResolution.second = dimensions.width; |
| 363 | #else |
| 364 | outResolution.first = dimensions.width; |
| 365 | outResolution.second = dimensions.height; |
| 366 | #endif |
| 367 |
| 368 | _implReference = [[VideoCapturerInterfaceImplHolder alloc] init]; |
| 369 | VideoCapturerInterfaceImplHolder *implReference = _implReference; |
| 370 | dispatch_async(dispatch_get_main_queue(), ^{ |
| 371 | VideoCapturerInterfaceImplReference *value = [[VideoCapturerInterfaceImplReference alloc] initWithSource:source sourceDescription:sourceDescription isActiveUpdated:^(bool isActive) { |
| 372 | stateUpdated(isActive ? VideoState::Active : VideoState::Paused); |
| 373 | } rotationUpdated:^(int angle) { |
| 374 | PlatformCaptureInfo info; |
| 375 | bool isLandscape = angle == 180 || angle == 0; |
| 376 | info.shouldBeAdaptedToReceiverAspectRate = !isLandscape; |
| 377 | info.rotation = angle; |
| 378 | captureInfoUpdated(info); |
| 379 | }]; |
| 380 | if (value != nil) { |
| 381 | implReference.reference = (void *)CFBridgingRetain(value); |
| 382 | } |
| 383 | }); |
| 384 | } |
| 385 |
| 386 | VideoCapturerInterfaceImpl::~VideoCapturerInterfaceImpl() { |
| 387 | VideoCapturerInterfaceImplHolder *implReference = _implReference; |
| 388 | dispatch_async(dispatch_get_main_queue(), ^{ |
| 389 | if (implReference.reference != nil) { |
| 390 | CFBridgingRelease(implReference.reference); |
| 391 | } |
| 392 | }); |
| 393 | } |
| 394 |
| 395 | void VideoCapturerInterfaceImpl::setState(VideoState state) { |
| 396 | VideoCapturerInterfaceImplHolder *implReference = _implReference; |
| 397 | dispatch_async(dispatch_get_main_queue(), ^{ |
| 398 | if (implReference.reference != nil) { |
| 399 | VideoCapturerInterfaceImplReference *reference = (__bridge VideoCapturerInterfaceImplReference *)implReference.reference; |
| 400 | [reference setIsEnabled:(state == VideoState::Active)]; |
| 401 | } |
| 402 | }); |
| 403 | } |
| 404 |
| 405 | void VideoCapturerInterfaceImpl::setPreferredCaptureAspectRatio(float aspectRatio) { |
| 406 | VideoCapturerInterfaceImplHolder *implReference = _implReference; |
| 407 | dispatch_async(dispatch_get_main_queue(), ^{ |
| 408 | if (implReference.reference != nil) { |
| 409 | VideoCapturerInterfaceImplReference *reference = (__bridge VideoCapturerInterfaceImplReference *)implReference.reference; |
| 410 | [reference setPreferredCaptureAspectRatio:aspectRatio]; |
| 411 | } |
| 412 | }); |
| 413 | } |
| 414 |
| 415 | void VideoCapturerInterfaceImpl::withNativeImplementation(std::function<void(void *)> completion) { |
| 416 | VideoCapturerInterfaceImplHolder *implReference = _implReference; |
| 417 | dispatch_async(dispatch_get_main_queue(), ^{ |
| 418 | if (implReference.reference != nil) { |
| 419 | VideoCapturerInterfaceImplReference *reference = (__bridge VideoCapturerInterfaceImplReference *)implReference.reference; |
| 420 | completion((__bridge void *)[reference videoCameraCapturer]); |
| 421 | } |
| 422 | }); |
| 423 | } |
| 424 |
| 425 | void VideoCapturerInterfaceImpl::setUncroppedOutput(std::shared_ptr<rtc::VideoSinkInterface<webrtc::VideoFrame>> sink) { |
| 426 | VideoCapturerInterfaceImplHolder *implReference = _implReference; |
| 427 | dispatch_async(dispatch_get_main_queue(), ^{ |
| 428 | if (implReference.reference != nil) { |
| 429 | VideoCapturerInterfaceImplReference *reference = (__bridge VideoCapturerInterfaceImplReference *)implReference.reference; |
| 430 | [reference setUncroppedSink:sink]; |
| 431 | } |
| 432 | }); |
| 433 | } |
| 434 |
| 435 | void VideoCapturerInterfaceImpl::setOnFatalError(std::function<void()> error) { |
| 436 | VideoCapturerInterfaceImplHolder *implReference = _implReference; |
| 437 | dispatch_async(dispatch_get_main_queue(), ^{ |
| 438 | if (implReference.reference != nil) { |
| 439 | VideoCapturerInterfaceImplReference *reference = (__bridge VideoCapturerInterfaceImplReference *)implReference.reference; |
| 440 | [reference setOnFatalError:error]; |
| 441 | } |
| 442 | }); |
| 443 | } |
| 444 |
| 445 | void VideoCapturerInterfaceImpl::setOnPause(std::function<void(bool)> pause) { |
| 446 | VideoCapturerInterfaceImplHolder *implReference = _implReference; |
| 447 | dispatch_async(dispatch_get_main_queue(), ^{ |
| 448 | if (implReference.reference != nil) { |
| 449 | VideoCapturerInterfaceImplReference *reference = (__bridge VideoCapturerInterfaceImplReference *)implReference.reference; |
| 450 | [reference setOnPause: pause]; |
| 451 | } |
| 452 | }); |
| 453 | } |
| 454 |
| 455 |
| 456 | int VideoCapturerInterfaceImpl::getRotation() { |
| 457 | __block int value = 0; |
| 458 | VideoCapturerInterfaceImplHolder *implReference = _implReference; |
| 459 | dispatch_sync(dispatch_get_main_queue(), ^{ |
| 460 | if (implReference.reference != nil) { |
| 461 | VideoCapturerInterfaceImplReference *reference = (__bridge VideoCapturerInterfaceImplReference *)implReference.reference; |
| 462 | value = [reference getRotation]; |
| 463 | } |
| 464 | }); |
| 465 | return value; |
| 466 | } |
| 467 |
| 468 | id VideoCapturerInterfaceImpl::getInternalReference() { |
| 469 | __block id value = nil; |
| 470 | VideoCapturerInterfaceImplHolder *implReference = _implReference; |
| 471 | dispatch_sync(dispatch_get_main_queue(), ^{ |
| 472 | if (implReference.reference != nil) { |
| 473 | VideoCapturerInterfaceImplReference *reference = (__bridge VideoCapturerInterfaceImplReference *)implReference.reference; |
| 474 | value = [reference getInternalReference]; |
| 475 | } |
| 476 | }); |
| 477 | return value; |
| 478 | } |
| 479 |
| 480 | } // namespace tgcalls |
| 481 |