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
Post
Replies
Boosts
Views
Activity
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
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?
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
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
Does the client app developer need any special entitlement for that ?
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?
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);
Is it possible we embed a windowcontroller inside an XPC module and pop/hide the window as demanded? right now the window cannot pop due to not in main thread.
What is the better alternative under the condition that xpc cannot modify the caller for permission.
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
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 :)
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.
I want to hide specific display with displayId for my special purpose, anyway, didn't find any related API like CGDisplayHide(displayId), anyone has a way for that?
I'm thinking of mirroring the other display but it is not ideal.
Thanks
Stang
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 :)
We can use the sample code to generate the SCK capture tool,
Run safari with youtube video.
Run the SCK capture tool
Select Application capture with the above Safari youtube video, the video shall be playing well.
Toggle the youtube video to full screen, you will not able to see the YouTube video.