Post

Replies

Boosts

Views

Activity

display capture issue
I have an app which captures a display (CGDisplayCapture or CGDisplayCaptureWithOptions), grabs its drawing context, and then draw image on it: //1. capture auto cpErr = CGDisplayCaptureWithOptions( mDid, kCGCaptureNoOptions );   if ( cpErr != kCGErrorSuccess )   {     LOGEX( "😂 Failed to capture Display, ID:%d", mDId );     return;   } // Grab context context = CGDisplayGetDrawingContext( mDId ); //Draw image CGContextDrawImage( context, rect, image ); CGContextFlush( context ); The video is pretty good, but two issues: When captured, according to the document, it only capture the event on that display, actually, when the app running, all system key event (i.g. Shift+Cmd+R) and swipe won't work. CGContextDrawImage is taking pretty high CPU usage, in my Mac mini 2018, it is taking over 20% Anyone got the solution to the above issues? -Thanks :)
0
0
796
Aug ’22
Privacy for XPC module
I have an application which is doing screen recording, now I move the screen recording feature to a standalone native XPC module for better performance due to some reason that the app is tied an old lib which cannot generate native code for M1 (Intel only). My question is that, this new xpc module is belong to the App (demanded by the app), if I give the screen recording permission to the app, will the xpc screen scraping module be granted to the permission? Right now looks like it is not after I granted the application with the screen recording permission since display stream won't produce the frame data.
11
0
2.6k
May ’22
network.framework handshaking failure occasionally
I have an application, it was using OpenSSL + Socket, recently I migrated the client to use Network.framework, basically it is running well, but occasionally it encounter the handshaking problem: default 11:54:01.757515-0600 caphost boringssl_context_info_handler(2028) [C80:1][0x7f8e2413ad90] Client handshake started default 11:54:01.757546-0600 caphost boringssl_context_info_handler(2045) [C80:1][0x7f8e2413ad90] Client handshake state: TLS client enter_early_data default 11:54:01.757643-0600 caphost boringssl_context_info_handler(2045) [C80:1][0x7f8e2413ad90] Client handshake state: TLS client read_server_hello default 11:54:01.786245-0600 caphost boringssl_context_info_handler(2045) [C80:1][0x7f8e2413ad90] Client handshake state: TLS client read_server_certificate default 11:54:01.786361-0600 caphost boringssl_context_info_handler(2045) [C80:1][0x7f8e2413ad90] Client handshake state: TLS client read_certificate_status default 11:54:01.786386-0600 caphost boringssl_context_info_handler(2045) [C80:1][0x7f8e2413ad90] Client handshake state: TLS client verify_server_certificate default 11:54:01.786588-0600 caphost boringssl_context_evaluate_trust_async(1635) [C80:1][0x7f8e2413ad90] Performing local trust evaluation default 11:54:01.786619-0600 caphost boringssl_context_evaluate_trust_async_internal(1508) [C80:1][0x7f8e2413ad90] Asyncing for internal verify block default 11:54:01.788428-0600 caphost Trust evaluate failure: [leaf AnchorTrusted SSLHostname] default 11:54:01.788604-0600 caphost boringssl_context_evaluate_trust_async_internal_block_invoke_2(1481) [C80:1][0x7f8e2413ad90] Returning from internal verify block with result: false (Error Domain=NSOSStatusErrorDomain Code=-67843 "“Vodde” certificate is not trusted" UserInfo={NSLocalizedDescription=“Solstice” certificate is not trusted, NSUnderlyingError=0x600001ffbc00 {Error Domain=NSOSStatusErrorDomain Code=-67843 "Certificate 0 “Vodde” has errors: SSL hostname does not match name(s) in certificate, Root is not trusted;" UserInfo={NSLocalizedDescription=Certificate 0 “Vodde” has errors: SSL hostname does not match name(s) in certificate, Root is not trusted;}}}) when this problem happens, I use old OpenSSL+Socket client to connect to it, it will be successful and grab the video stream w/o problem. This problem happens about 1 in 10, I supposed if this happen, it shall always happen, don't get why it is not consistent, is it the bug of Network.framework? my system is Monterey 12.3.1 on 2018 Mac mini. Thanks :)
4
0
732
Apr ’22
xpc module won't get loaded
I have a xpc module (wrote in Swift using NSXPCConnection), it works well with test application (simple swift test app), my plan is to put this module under XPCService of a DAL plugIn, since the plugin written in C++, I created an Objective-C dylib which response for talking to the XPC, and this dylib using NSXConnection to activate the XPC module(as the Swift test App), it exports C API to the plugin. Somehow when application using the plugin, the plugin call the API of the dylib to activate the XPC, but the XPC won't get loaded (from Activity Monitor). Any idea to get this working? I cannot put XPCService folder inside the Obj-C dylib instead of inside the plugin bundle, and I don't want load the xpc as daemon, want it be loaded as plugin demanded. Adding Obj-C into current C plugin is pretty headache, is there any C++ version NSXPConnection for this kind of situation? =======this is the code in the dylib for activating the connection ====== - (int) initXPC {   connection = [[NSXPCConnection alloc] initWithServiceName:@"com....."];   connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(MyProtocol)];       [connection resume];   self->started = false;   NSLog(@"😂 XPC connection setup, result:%@", ((connection == nil) ? @"Failed":@"Succeed!") );   return connection != nil ; } Thanks Steven
7
0
1.4k
Jan ’22
Anyway to start working while waiting approval from Apple
I'm working on new virtual camera by using IOUSBHostControllerInterface, when I run my code, it asks for the approval of com.apple.usb.hostcontrollerinterface entitlement from Apple, I disabled SIP of the system and it won't let me go further. I submitted the FB9203842 by middle of last month and no response from Apple yet, submitted DTS and that won't speed up the approval process. Is there any way I could continue working on it while waiting for Apple's approval? I believe the entitlement approval is only for distribute the product, not developing the product. Thanks Steven
2
0
1.5k
Jul ’21
network.framework client talk to OpenSSL Java Server
The old client was using OpenSSL and Socket, it works just fine, and the server is using TLS1.2 with public signed certificate, the TLS and TCP configuration of the new network.framework client are as below, The server always complains the handshake failed. I tried default TLS, TLS version min to 1.0 max to 1.3, none of them working.  auto config_tcp = ^(nw_protocol_options_t tcp_op) {     nw_tcp_options_set_connection_timeout(tcp_op, connection_timeout); //set timeout to 5 seconds     nw_tcp_options_set_enable_keepalive(tcp_op, true); //keep_live     nw_tcp_options_set_no_delay(tcp_op, true); //enable no delay     nw_tcp_options_set_enable_fast_open(tcp_op, true);   };       auto config_tls = ^(nw_protocol_options_t tls_options) {     sec_protocol_options_t sec_options = nw_tls_copy_sec_protocol_options(tls_options);     sec_protocol_options_set_min_tls_protocol_version(sec_options, tls_protocol_version_TLSv12);     sec_protocol_options_set_max_tls_protocol_version(sec_options, tls_protocol_version_TLSv12);           sec_protocol_options_append_tls_ciphersuite_group(sec_options,tls_ciphersuite_group_default);     nw_release(sec_options);   };       auto endpoint = nw_endpoint_create_host(sip.c_str(), std::to_string( srvPort).c_str());       auto param = nw_parameters_create_secure_tcp(config_tls, //TLSv1.2 for now                          config_tcp);           // create the connection   auto connect = nw_connection_create(endpoint, param);
2
0
737
Dec ’21
Could I bind smartpointer to xpc connection?
I want to bind a smartpointer to xpc connection, will below work? I have class A like this: class A { }; Initialization with xpc_connection currentConnection auto aObj = std::make_shared<A>(); xpc_connection_set_context(currentConnection, aObj.get()) After I done with the connection, I get back the raw pointer: auto pObj = reinterpret_cast<A*>(xpc_connection_get_context(currentConnection)); if (pObj != nullptr) { std::shared_ptr<A> asmarter(pObj);      asmarter.reset(); //release the smart pointer } Will this work?
10
0
1.5k
Oct ’21
Audio server plugin cannot receive mute event
We have a Audio Server Plugin which is pretty similar to NullAudio plugin and Blackhole audio plugin, it works pretty well except one problem, when user click the mic button on Zoom or MS Teams to mute and unmute the microphone, only unmute can receive event of: SetControlPropertyData 0x6:kObjectID_Mute_Input_Master select=0x6263766c(Boolean) value=0 I supposed it would receive the same event but with the value to 1 when we click mute, but according the message dump (I dumped set/get/has/isSetable), totally no event received! Anyone met the same issue and have solution? Thanks
0
0
662
Jul ’21
Xpc service, how to avoid restarting
I created a Xpc daemon service using C++ (not NSXConnect api), my client application doesn't have problem in talking to it. I want to keep some data in the service, but the XPC service daemon sometime restart itself unpredictably, this will cause all the data inside it lost. I checked the code, nothing caused the restart. Looks like once client call xpc_connection_resume(service), the daemon will restart. My ideal way is that, after system boot/user login, this XPC service will not restart until system restart, is it possible? S
8
0
2.0k
Mar ’21
Oh my god, what have I done?
Last login: Sun Mar 28 13:12:13 on console steventang@Stevens-Mac-mini ~ % cd ~/Desktop/workspace/denver/2021/client/ls cd: no such file or directory: /Users/steventang/Desktop/workspace/denver/2021/client/ls steventang@Stevens-Mac-mini ~ % sudo rm -r ./* Password: ^C steventang@Stevens-Mac-mini ~ % pwd /Users/steventang Was supposed to delete the content under client folder, too later for the ^C, all my stuff under my ~ folder are almost gone, anyway to recovery?
2
0
759
Mar ’21
How do we interact Audio Server PlugIn from other app via apple events
I try to pass some information to Audio Server Plugin via Apple Event, in the event sender application, I tried AEBuildAppleEvent with the plugin's bundleID, the plugin is running correctly, anyway, when I call AESendMessage, it always return -600 which means procNotFound, any idea? and I'm also trying to send to coreaudiod for alternative and check if that could work, but it is a daemon w/o bundleId. I know there are other ways like socket and shared memory etc can do the job, anyway, if AppleEvent work, it will be pretty neat! Thanks S
0
0
736
Mar ’21