Open fzwoch opened 2 years ago
Process 2159 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x000000013fe00634 obs-test.so`notok + 4
obs-test.so`notok:
-> 0x13fe00634 <+4>: str x8, [x8]
0x13fe00638 <+8>: b 0x13fe00638 ; <+8>
0x13fe0063c <+12>: udf #0x0
obs-test.so`runtime.open_trampoline.abi0:
0x13fe00640 <+0>: str x30, [sp, #-0x10]!
Target 0: (OBS) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
* frame #0: 0x000000013fe00634 obs-test.so`notok + 4
frame #1: 0x000000013fe00c30 obs-test.so`runtime.sigaltstack_trampoline.abi0 + 32
frame #2: 0x000000013fdff908 obs-test.so`runtime.asmcgocall.abi0 + 200
frame #3: 0x000000013fdff908 obs-test.so`runtime.asmcgocall.abi0 + 200
frame #4: 0x000000013fdff908 obs-test.so`runtime.asmcgocall.abi0 + 200
I also believe I am running into this on OBS 28 beta 2 on an M1 mini.
I wonder if anyone with a beta of macOS Ventura wants to check if the issue persists.
I tried it. OBS will not start after installing the plugin(obs-teleport.plugin).
macOS Ventura 13.0 Beta OBS 28.0.1 arm64
Thanks for checking. It does not take us much further - but is a good piece of information.
A custom build of OBS with enabled Address-Sanitizer
loads the plugin just fine. Without the sanitizer the same crash as above happens.
Things are getting wild. With this OBS patch applied it seems to run fine:
--- a/UI/obs-app.cpp
+++ b/UI/obs-app.cpp
@@ -3055,6 +3055,19 @@ void ctrlc_handler(int s)
int main(int argc, char *argv[])
{
+#if defined __APPLE__ && defined __arm64__
+ char signalStack[SIGSTKSZ];
+ stack_t ss;
+ memset(&ss, 0, sizeof(ss));
+ ss.ss_sp = signalStack;
+ ss.ss_flags = 0;
+ ss.ss_size = SIGSTKSZ;
+ if (sigaltstack(&ss, NULL) < 0) {
+ perror("sigaltstack");
+ abort();
+ }
+#endif
+
#ifndef _WIN32
signal(SIGPIPE, SIG_IGN);
Not sure though whether this breaks any existing signals/signal handlers.
Here is a 0.6.1 version of the macOS plugin for M1/M2 if anyone interested. You will need to apply the patch below to OBS Studio and build it yourself to make it work though.
diff --git a/UI/obs-app.cpp b/UI/obs-app.cpp
index 02cf48d6c016a..d1143603f93c0 100644
--- a/UI/obs-app.cpp
+++ b/UI/obs-app.cpp
@@ -3165,13 +3165,28 @@ void ctrlc_handler(int s)
int main(int argc, char *argv[])
{
#ifndef _WIN32
- signal(SIGPIPE, SIG_IGN);
+ stack_t ss;
+ ss.ss_sp = malloc(SIGSTKSZ);
+ if (ss.ss_sp == NULL) {
+ fprintf(stderr, "ss_sp alloc failed\n");
+ exit(1);
+ }
+ ss.ss_size = SIGSTKSZ;
+ ss.ss_flags = 0;
+ if (sigaltstack(&ss, NULL) < 0) {
+ perror("sigaltstack");
+ exit(1);
+ }
struct sigaction sig_handler;
- sig_handler.sa_handler = ctrlc_handler;
+ sig_handler.sa_handler = SIG_IGN;
sigemptyset(&sig_handler.sa_mask);
- sig_handler.sa_flags = 0;
+ sig_handler.sa_flags = SA_ONSTACK;
+
+ sigaction(SIGPIPE, &sig_handler, NULL);
+
+ sig_handler.sa_handler = ctrlc_handler;
sigaction(SIGINT, &sig_handler, NULL);
For everyone trying this out. Please write back your macOS version and hardware configuration, and whether it has been working for you or not. (You didn't have to have the patch applied, I just want to collect information what may be the root cause of the original problem)
When launching OBS 29.0.2 native
with obs-teleport-0.6.1
or 0.6.5
on m1 mac 13.2.1
, OBS bounces in the dock forever and doesn't appear.
Yes, this is what thich ticket is about..
I can start up OBS when I connect a 2nd monitor and close my Macbook Air's lid.
To date (February 20, 2023), the only fully working option for how you can play on a PC and stream through a macbook m1 is: Download the obs version for intel on a macbook m1 and install this plugin (teleport) according to the instructions. Since the teleport didn’t start through the obs version of apple silicon, I found a way out in installing the obs version for intel, which works great on the M1. Good luck to all! And thanks for the great alternative to the buggy NDI. P.S. If you have no sound through the teleport plugin when recording a video / broadcast from the obs, then just add your audio sources through the teleport filter. This link works flawlessly.
Here is a 0.6.1 version of the macOS plugin for M1/M2 if anyone interested. You will need to apply the patch below to OBS Studio and build it yourself to make it work though.
diff --git a/UI/obs-app.cpp b/UI/obs-app.cpp index 02cf48d6c016a..d1143603f93c0 100644 --- a/UI/obs-app.cpp +++ b/UI/obs-app.cpp @@ -3165,13 +3165,28 @@ void ctrlc_handler(int s) int main(int argc, char *argv[]) { #ifndef _WIN32 - signal(SIGPIPE, SIG_IGN); + stack_t ss; + ss.ss_sp = malloc(SIGSTKSZ); + if (ss.ss_sp == NULL) { + fprintf(stderr, "ss_sp alloc failed\n"); + exit(1); + } + ss.ss_size = SIGSTKSZ; + ss.ss_flags = 0; + if (sigaltstack(&ss, NULL) < 0) { + perror("sigaltstack"); + exit(1); + } struct sigaction sig_handler; - sig_handler.sa_handler = ctrlc_handler; + sig_handler.sa_handler = SIG_IGN; sigemptyset(&sig_handler.sa_mask); - sig_handler.sa_flags = 0; + sig_handler.sa_flags = SA_ONSTACK; + + sigaction(SIGPIPE, &sig_handler, NULL); + + sig_handler.sa_handler = ctrlc_handler; sigaction(SIGINT, &sig_handler, NULL);
this worked for me thank you
Hello, how does it look with support for apple silicon? I tried it on my macbook pro with m2 max chip and can't even start obs. I'm really looking forward to a possible fix.
Here is a 0.6.1 version of the macOS plugin for M1/M2 if anyone interested. You will need to apply the patch below to OBS Studio and build it yourself to make it work though.
diff --git a/UI/obs-app.cpp b/UI/obs-app.cpp index 02cf48d6c016a..d1143603f93c0 100644 --- a/UI/obs-app.cpp +++ b/UI/obs-app.cpp @@ -3165,13 +3165,28 @@ void ctrlc_handler(int s) int main(int argc, char *argv[]) { #ifndef _WIN32 - signal(SIGPIPE, SIG_IGN); + stack_t ss; + ss.ss_sp = malloc(SIGSTKSZ); + if (ss.ss_sp == NULL) { + fprintf(stderr, "ss_sp alloc failed\n"); + exit(1); + } + ss.ss_size = SIGSTKSZ; + ss.ss_flags = 0; + if (sigaltstack(&ss, NULL) < 0) { + perror("sigaltstack"); + exit(1); + } struct sigaction sig_handler; - sig_handler.sa_handler = ctrlc_handler; + sig_handler.sa_handler = SIG_IGN; sigemptyset(&sig_handler.sa_mask); - sig_handler.sa_flags = 0; + sig_handler.sa_flags = SA_ONSTACK; + + sigaction(SIGPIPE, &sig_handler, NULL); + + sig_handler.sa_handler = ctrlc_handler; sigaction(SIGINT, &sig_handler, NULL);
Re-rolling this patch for 29.x version.
diff --git a/UI/obs-app.cpp b/UI/obs-app.cpp
index e0b9d114a..b48a0d11c 100644
--- a/UI/obs-app.cpp
+++ b/UI/obs-app.cpp
@@ -3245,13 +3245,27 @@ void OBSApp::ProcessSigInt(void)
int main(int argc, char *argv[])
{
#ifndef _WIN32
- signal(SIGPIPE, SIG_IGN);
+ stack_t ss;
+ ss.ss_sp = malloc(SIGSTKSZ);
+ if (ss.ss_sp == NULL) {
+ fprintf(stderr, "ss_sp alloc failed\n");
+ exit(1);
+ }
+ ss.ss_size = SIGSTKSZ;
+ ss.ss_flags = 0;
+ if (sigaltstack(&ss, NULL) < 0) {
+ perror("sigaltstack");
+ exit(1);
+ }
struct sigaction sig_handler;
- sig_handler.sa_handler = OBSApp::SigIntSignalHandler;
+ sig_handler.sa_handler = SIG_IGN;
sigemptyset(&sig_handler.sa_mask);
- sig_handler.sa_flags = 0;
+ sig_handler.sa_flags = SA_ONSTACK;
+ sigaction(SIGPIPE, &sig_handler, NULL);
+
+ sig_handler.sa_handler = OBSApp::SigIntSignalHandler;
sigaction(SIGINT, &sig_handler, NULL);
I am on a Mac Studio 2022, M1 Max with 32gb of RAM on MacOS Ventura 13.3.1.
Thanks, I haven't noticed they did some changes in that area.
I have updated the original PR here:
https://github.com/obsproject/obs-studio/pull/7973
Check the branch here: https://github.com/fzwoch/obs-studio/tree/sigaltstack
Note that I don't expect it to me merged ever.
Apple also does not seem to care about the issue, or they consider it a user-space issue but are not telling.
Thanks, I haven't noticed they did some changes in that area.
I have updated the original PR here: obsproject/obs-studio#7973
Note that I don't expect it to me merged ever.
Apple also does not seem to care about the issue, or they consider it a user-space issue but are not telling.
Does it mean that I have to edit something inside obs?
Sorry for my stupid questions :)
Does it mean that I have to edit something inside obs? Sorry for my stupid questions :)
Yes.
Does it mean that I have to edit something inside obs? Sorry for my stupid questions :)
Yes.
Is there a guide somewhere? I'm not that experienced.
Is there a guide somewhere? I'm not that experienced.
Start here: https://github.com/obsproject/obs-studio/wiki/Build-Instructions-For-Mac
In general you will have to build OBS with the patch in the PR, or the pasted one above applied. It can be quite an en-devour for the inexperienced I guess. But you will have to check OBS guides, or guides for these developer tools in general. It is way out of the scope than I can do here..
Is there a guide somewhere? I'm not that experienced.
Start here: https://github.com/obsproject/obs-studio/wiki/Build-Instructions-For-Mac
In general you will have to build OBS with the patch in the PR, or the pasted one above applied. It can be quite an en-devour for the inexperienced I guess. But you will have to check OBS guides, or guides for these developer tools in general. It is way out of the scope than I can do here..
Agree with this.
If anyone is inexperienced, the Prerequisites
sections at the top of the guide might be confusing.
About this Mac
. At the time of writing this, you need to at least be on MacOS 12.0. So if the number listed is lower, consider upgrading to MacOS Ventura.brew install cmake
brew install ccache
After that, you can follow the first step from the Configuring Build Project
which is cloning the project. Copy the git clone --recursive https://github.com/obsproject/obs-studio.git
command into your terminal and then run cd obs-studio
to go the new directory from git.
Note: It is important that you use the --recursive
flag so that all of the submodules are pulled in too.
Run git fetch origin pull/7973/head:bugfix/7973
to pull in the code from fzwoch's PR and put it into a new local branch named bugfix/7973
.
Run git checkout bugfix/7973
to switch to the new local branch.
After that, you can continue to follow the steps in the official wiki's instructions without any issues.
My only issue when following the guide was that building from the command line did not work in the Build obs-studio
section.
When running xcodebuild -configuration <Debug|Release|RelWithDebInfo|MinSizeRel> -scheme obs-studio -parallelizeTargets -destination "generic/platform=macOS,name=Any Mac"
, I got an error saying:
xcodebuild: error: Unknown build action 'obs-studio'
But to get around that:
build_arm64
folder that is generated from running cmake --preset macos-arm64
.obs-studio.xcodeproj
file.Product
at the top, then Scheme
and then Choose Scheme
and then select install
from the list.I wouldn't mind sharing the build I created, but I'm not sure if that is against the rules or anything.
There is also a CI/build-macos.sh
script that does the right thing sometimes..
@andrewmriv can you share ?
There is also a
CI/build-macos.sh
script that does the right thing sometimes..
Hello, what script do you mean?
It has been removed in the meantime from the OBS repository. Check with the OBS team on how to build OBS for macOS.
Same problem, this was my last outing, I hate NDI, I'm going to get a capture card at once:
MAC M1, 2020 - Ventura 13.5
OBS 29.0.2 (64 bit)
Is this change being pushed to the OBS branch? I would like to see a work around that does not require people to manually build both OBS and the plugin. I am switching to MacOS for streaming and could really use this plugin.
I tried getting a fix upstream, but i ran again into issues when trying to remove the signal stack and restoring the old one on exit. Then I hit another documentaion issue on Apple's side and I gave up. But anyone can try getting a proper change upstream..
One can do it without patching OBS. It is still annoying though.
Make sure System Integrity Protection
is off
:
% csrutil status
System Integrity Protection status: disabled.
If it is not check https://developer.apple.com/documentation/security/disabling_and_enabling_system_integrity_protection?language=objc
Run OBS
with loaded address sanitizer:
DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib /Applications/OBS.app/Contents/MacOS/OBS
You will have to check what Xcode version you have installed. So you will need an installation of Xcode. Change the directory for the file location where the sanitizer library is found.
Eventually startup fails with something similar to this:
signal 16 received but handler not on signal stack
mp.gsignal stack [0x106d50000 0x106dd0000], mp.g0 stack [0x16afa0000 0x16b79c000], sp=0x114000058768
fatal error: non-Go code set up signal handler without SA_ONSTACK flag
I guess that can happen since the signals are not properly set up now (which the patch does). Just try again, its seems to be working most of the time for me (but only God knows what impacts this behavior).
Not sure why this signal would sometimes be triggered though, and I'm not sure if it can happen again while OBS is running.. someone will find out?
i tried out the workaround mentioned above, and while OBS did open and the plugin loaded, i wasnt able to transmit video via the plugin, nothing would show up in a teleport source (both locally and on another computer)
i was able to receive video from another OBS instance on the other computer though
edit: my bad, i acidentally had NDI enabled at the same time as teleport so it didnt work, got it fully working now, the fix above seems to be stable
update: experiencing stability issues with the workaround, the stream isnt always picked up by another OBS instance, and lag issues keep happening as well at random (cant replicate it with changing settings either)
Check the logs in the case of stability issues. It could very likely be a network congestion (WLAN?).
There may indeed be a problem on first start where the plugin is not work correctly. I have not found the reason for it happening. It seems to happen after first installation normally. So I blame Apple's security systems - but could very well be a bug in the plugin, but I don't think it is related to this bug or the workaround. I never found a reliable way to trigger it.
Hey everyone, so I manage to get it to "work"
Here is what I did:
Now, I tried recording my PC via Teleport on my Macbook Pro, quality is good (set to 90) but the audio was laggy. So I'm going to check my settings on that.
Here is my MBP info btw: Macbook Pro - M2 Pro macOS Sonoma 14.2.1 OBS 30.0.0 (for the Mac), 30.0.2 (for the Windows PC)
Please forgive me as I don't know the proper use of lingo, quotations, etc in Github
Yeah, running inside Rosetta is fine. But ideally one could run it natively without the translation layer.
Hey I'm running into this issue on my m1 as well. Here are the log files during startup with the latest plugin release and the latest obs. I started without the plugin as well so you can see the full log logs.zip
please dm me if you want help troubleshooting 1:1
Hello all... so I´m one of those NDI users that LOVED to have teleport on his M1 Max machine, but because Teleport didn´t work on OBS M1 version, never really tried. Since yesterday that the NDI plugin just got messed out - there´s tons of people dealing with this and no one knows what´s happening - I really had to make sure I got teleport, and hey, what a BEAST! In spite of I only got it working on OBS Intel version (so it´s not using my resources of M1 Max and not optimized so I need to use more CPU power to have this working), I can tell that Teleport is THE thing! I only needed Alpha Transparency but... well seems that may take some time, so I am working with Color Key. Not ideal, but it makes what it´s needed, of course with a lack of quality but, it´s damn fast and damn good! Great Quality on transmission! My question is: I don´t know how to "build" obs. I´m really noob in that matter. I really don´t know, even following those guides you posted above, how or even what to do. Shall I build an OBS that have the plugins already that I need? and sources and scenes already? And then, I can change something so that teleport is recognized with my M1 OBS version? Or maybe you are just releasing a version that WILL work on M1 computers? Please do.... I truly appreciate that...
You should check on the OBS site on how to build it. Instructions constantly change and things here get outdated too quickly.
I don't have a macOS sign key, Twitch API keys etc.. so it makes little sense to build an OBS version without them for distribution. Also it is too much work for me to maintain it. So you will have to go through that yourself.
On Sat, Feb 10, 2024 at 4:42 PM nunowonder @.***> wrote:
Hello all... so I´m one of those NDI users that LOVED to have teleport on his M1 Max machine, but because Teleport didn´t work on OBS M1 version, never really tried. Since yesterday that the NDI plugin just got messed out
- there´s tons of people dealing with this and no one knows what´s happening - I really had to make sure I got teleport, and hey, what a BEAST! In spite of I only got it working on OBS Intel version (so it´s not using my resources of M1 Max and not optimized so I need to use more CPU power to have this working), I can tell that Teleport is THE thing! I only needed Alpha Transparency but... well seems that may take some time, so I am working with Color Key. Not ideal, but it makes what it´s needed, of course with a lack of quality but, it´s damn fast and damn good! Great Quality on transmission! My question is: I don´t know how to "build" obs. I´m really noob in that matter. I really don´t know, even following those guides you posted above, how or even what to do. Shall I build an OBS that have the plugins already that I need? and sources and scenes already? And then, I can change something so that teleport is recognized with my M1 OBS version? Or maybe you are just releasing a version that WILL work on M1 computers? Please do.... I truly appreciate that...
— Reply to this email directly, view it on GitHub https://github.com/fzwoch/obs-teleport/issues/43#issuecomment-1937046905, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADLKNJQ2AZW54YZ64AMGQTYS6IODAVCNFSM547XBYIKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJTG4YDINRZGA2Q . You are receiving this because you authored the thread.Message ID: @.***>
@fzwoch Thank you very much for your answer, but what I was asking for was a Teleport version that would work on M1 OBS, not the build itself, that would be asking too much! ehehe :) Anyway, of course having alpha transparency, it it was something you could do easily, would be actually more important than M1 version, because I can work with OBS (intel mode) on my M1, so... Well, I will be here for anything, any tests needed, I can help as you want so we can go through this :)
The Teleport version available is all it can do to work on M1. Due to an Apple bug it is not. So it requires a patched OBS version or the workaround loading address sanitizer libraries.
There will be no alpha channel support.
Ups I didn´t read about alpha channel. Can I ask why? Sorry it's only because I really don´t know why, because we get it with NDI. If it was like a "filter" on source, or sources, or scenes, that would send instead of Main Output?
Here is another workaround that does not require running with Apple's address sanitizer or building a patched OBS version. I'll also attach a binary, so you won't even need Xcode to be installed. Check the SIP note below though!
signalstack.c
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
stack_t stack;
__attribute__((constructor))
void init()
{
printf("SET UP SIGALTSTACK.. ");
stack.ss_sp = malloc(SIGSTKSZ);
if (stack.ss_sp == NULL) {
printf("ss_sp alloc failed\n");
exit(1);
}
stack.ss_size = SIGSTKSZ;
stack.ss_flags = 0;
if (sigaltstack(&stack, NULL) != 0) {
printf("sigaltstack failed\n");
exit(1);
}
printf("DONE\n");
}
Compile with:
clang -shared signalstack.c -o signalstack.dylib
Run with:
DYLD_INSERT_LIBRARIES=/path/to/signalstack.dylib /Applications/OBS.app/Contents/MacOS/OBS
You will probably still have to tinker with Apple's SIP to allow injection of shared libraries. https://developer.apple.com/documentation/security/disabling_and_enabling_system_integrity_protection
Check the output for the SET UP SIGALTSTACK.. DONE
line to verify the loading is successful.
@fzwoch thank you so much for your help! The problem for me is: I don´t understand anything that you wrote... :)
As another side note: It works just fine with PRISM Live Studio ¯\(ツ)/¯
Was thinking about another try checking address sanitizer and thread sanitizer.. but OBS Studio does not compile with these options enabled.
Looks like interacting with the the frontend API is deadlocking/crashing OBS.
Can be reproduced with the following plugin:
Could be a Go runtime issue when using cgo. But I have no idea..