From ff115053f00865f2e75b3987af4cebdf9d11c0f8 Mon Sep 17 00:00:00 2001 From: fduncanh Date: Tue, 11 Jan 2022 12:50:25 -0500 Subject: [PATCH] enforce -nc option in macOS, as a workaround for a gstreamer issue --- README.html | 4 ++-- README.md | 12 ++++++------ README.txt | 11 ++++++----- uxplay.cpp | 7 +++++++ 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/README.html b/README.html index a3a1f08..6eb088f 100644 --- a/README.html +++ b/README.html @@ -82,8 +82,8 @@

-vs 0 suppresses display of streamed video, but plays streamed audio. (The client’s screen is still mirrored at a reduced rate of 1 frame per second, but is not rendered or displayed.) This feature (which streams audio in AAC audio format) is now probably unneeded, as UxPlay can now stream superior-quality Apple Lossless audio without video in Airplay non-mirror mode.

-as audiosink chooses the GStreamer audiosink, instead of letting autoaudiosink pick it for you. Some audiosink choices are: pulsesink, alsasink, osssink, oss4sink, and osxaudiosink (for macOS). Using quotes “…” might allow some parameters to be included with the audiosink name. (Some choices of audiosink might not work on your system.)

-as 0 (or just -a) suppresses playing of streamed audio, but displays streamed video.

-

-nc maintains previous UxPlay < 1.45 behavior that does not close the video window when the the client sends the “Stop Mirroring” signal.

-

-t timeout will cause the server to relaunch (without stopping uxplay) if no connections have been present during the previous timeout seconds. You may wish to use this if the Server is not visible to new Clients that were inactive when the Server was launched, and an idle Bonjour registration eventually becomes unavailable for new connections (this is a workaround for what may be due to a problem with your DNS-SD or Avahi setup). This option should not be used on macOS, as a window created by GStreamer does not terminate correctly (it causes a segfault) if it is still open when the GStreamer pipeline is closed.

+

-nc maintains previous UxPlay < 1.45 behavior that does not close the video window when the the client sends the “Stop Mirroring” signal. This option is currently used by default in macOS, as the window created in macOS by GStreamer does not terminate correctly (it causes a segfault) if it is still open when the GStreamer pipeline is closed.

+

-t timeout will cause the server to relaunch (without stopping uxplay) if no connections have been present during the previous timeout seconds. You may wish to use this if the Server is not visible to new Clients that were inactive when the Server was launched, and an idle Bonjour registration eventually becomes unavailable for new connections (this is a workaround for what may be due to a problem with your DNS-SD or Avahi setup). This option is currently disabled in macOS, for the same reason that requires the -nc option

Troubleshooting

Note: uxplay is run from a terminal command line, and informational messages are written to the terminal.

1. uxplay starts, but stalls after “Initialized server socket(s)” appears, without any server name showing on the client.

diff --git a/README.md b/README.md index 6cbccbf..5832f46 100644 --- a/README.md +++ b/README.md @@ -329,16 +329,16 @@ Also: image transforms that had been added to RPiPlay have been ported to UxPlay **-as 0** (or just **-a**) suppresses playing of streamed audio, but displays streamed video. **-nc** maintains previous UxPlay < 1.45 behavior that does **not close** the video window when the the client - sends the "Stop Mirroring" signal. - + sends the "Stop Mirroring" signal. _This option is currently used by default in macOS, + as the window created in macOS by GStreamer does not terminate correctly (it causes a segfault) + if it is still open when the GStreamer pipeline is closed._ + **-t _timeout_** will cause the server to relaunch (without stopping uxplay) if no connections have been present during the previous _timeout_ seconds. You may wish to use this if the Server is not visible to new Clients that were inactive when the Server was launched, and an idle Bonjour registration eventually becomes unavailable for new connections (this is a workaround for what - may be due to a problem with your DNS-SD or Avahi setup). _This option should **not** be used on - macOS, as a window created - by GStreamer does not terminate correctly (it causes a segfault) - if it is still open when the GStreamer pipeline is closed._ + may be due to a problem with your DNS-SD or Avahi setup). _This option is currently disabled in + macOS, for the same reason that requires the -nc option_ # Troubleshooting diff --git a/README.txt b/README.txt index 63ec2c6..30d60f0 100644 --- a/README.txt +++ b/README.txt @@ -418,7 +418,10 @@ displays streamed video. **-nc** maintains previous UxPlay \< 1.45 behavior that does **not close** the video window when the the client sends the "Stop Mirroring" -signal. +signal. *This option is currently used by default in macOS, as the +window created in macOS by GStreamer does not terminate correctly (it +causes a segfault) if it is still open when the GStreamer pipeline is +closed.* **-t *timeout*** will cause the server to relaunch (without stopping uxplay) if no connections have been present during the previous @@ -426,10 +429,8 @@ uxplay) if no connections have been present during the previous to new Clients that were inactive when the Server was launched, and an idle Bonjour registration eventually becomes unavailable for new connections (this is a workaround for what may be due to a problem with -your DNS-SD or Avahi setup). *This option should **not** be used on -macOS, as a window created by GStreamer does not terminate correctly (it -causes a segfault) if it is still open when the GStreamer pipeline is -closed.* +your DNS-SD or Avahi setup). *This option is currently disabled in +macOS, for the same reason that requires the -nc option* Troubleshooting =============== diff --git a/uxplay.cpp b/uxplay.cpp index b374cb2..3b62029 100755 --- a/uxplay.cpp +++ b/uxplay.cpp @@ -437,6 +437,13 @@ int main (int argc, char *argv[]) { use_audio = false; } +#if __APPLE__ + /* force use of -nc option on macOS */ + LOGI("macOS detected: use -nc option as workaround for GStreamer problem"); + previous_no_close_behavior = true; + server_timeout = 0; +#endif + if (videosink == "0") { use_video = false; videosink.erase();