BugFix Shmdata sink broadcasting Shared Memory

Fix termination of shmdatasink, improved UI and doc.
This commit is contained in:
Bruno Herbelin
2024-05-18 19:19:27 +02:00
parent b38017eb1c
commit 12bff7aa9e
4 changed files with 21 additions and 9 deletions

View File

@@ -127,9 +127,16 @@ Optionnal:
apt-get install libglm-dev libstb-dev libtinyxml2-dev ableton-link-dev
+ Follow the instructions to [install Shmdata](https://gitlab.com/sat-mtl/tools/shmdata).
+ Follow the instructions to [install Shmdata](https://github.com/nicobou/shmdata/blob/develop/doc/install-from-sources.md).
git clone https://gitlab.com/sat-metalab/shmdata.git
mkdir shmdata-build
cd shmdata-build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_BUILD_TYPE=Release -DWITH_PYTHON=0 -DWITH_SDCRASH=0 -DWITH_SDFLOW=0 ../shmdata-build
cmake --build . --target package
sudo dpkg -i ./libshmdata_1.3*_amd64.deb
#### OSX with Brew
~$ brew install cmake libpng glfw gstreamer icu4c
brew install cmake libpng glfw gstreamer icu4c

View File

@@ -142,6 +142,7 @@ void Settings::Save(uint64_t runtime, const std::string &filename)
applicationNode->SetAttribute("broadcast_port", application.broadcast_port);
applicationNode->SetAttribute("loopback_camera", application.loopback_camera);
applicationNode->SetAttribute("shm_socket_path", application.shm_socket_path.c_str());
applicationNode->SetAttribute("shm_method", application.shm_method);
applicationNode->SetAttribute("accept_audio", application.accept_audio);
pRoot->InsertEndChild(applicationNode);
@@ -462,6 +463,7 @@ void Settings::Load(const string &filename)
applicationNode->QueryIntAttribute("broadcast_port", &application.broadcast_port);
applicationNode->QueryIntAttribute("loopback_camera", &application.loopback_camera);
applicationNode->QueryBoolAttribute("accept_audio", &application.accept_audio);
applicationNode->QueryIntAttribute("shm_method", &application.shm_method);
// text attributes
const char *tmpstr = applicationNode->Attribute("shm_socket_path");

View File

@@ -169,6 +169,9 @@ std::string ShmdataBroadcast::init(GstCaps *caps)
void ShmdataBroadcast::terminate()
{
// end src
gst_app_src_end_of_stream (src_);
// force finished
endofstream_ = true;
active_ = false;
@@ -188,9 +191,9 @@ std::string ShmdataBroadcast::gst_pipeline() const
pipeline += (method_ == SHM_SHMDATASINK) ? "shmdatasrc" : "shmsrc";
pipeline += " socket-path=";
pipeline += socket_path_;
pipeline += " is-live=true";
if (method_ == SHM_SHMSINK){
pipeline += " is-live=true";
pipeline += " ! ";
pipeline += std::string( gst_caps_to_string(caps_) );
pipeline = std::regex_replace(pipeline, std::regex("\\(int\\)"), "");

View File

@@ -5772,14 +5772,14 @@ void Navigator::RenderMainPannelSettings()
ImFormatString(msg, IM_ARRAYSIZE(msg), "Shared Memory\n\n"
"vimix can share to RAM with "
"gstreamer default 'shmsink' "
"and with 'shmdatasink'.\n"
"and with 'shmdatasink'.\n\n"
"Socket file to connect to:\n%s\n",
_shm_socket_file.c_str());
}
else {
ImFormatString(msg, IM_ARRAYSIZE(msg), "Shared Memory\n\n"
"vimix can share to RAM with "
"gstreamer 'shmsink'.\n"
"gstreamer 'shmsink'.\n\n"
"Socket file to connect to:\n%s\n",
_shm_socket_file.c_str());
}
@@ -5787,9 +5787,9 @@ void Navigator::RenderMainPannelSettings()
ImGui::SameLine(0);
ImGui::SetCursorPosX(width_);
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
char bufsocket[64] = "";
snprintf(bufsocket, 64, "%s", Settings::application.shm_socket_path.c_str());
ImGui::InputTextWithHint("##SHM path", SystemToolkit::home_path().c_str(), bufsocket, 64);
char bufsocket[128] = "";
snprintf(bufsocket, 128, "%s", Settings::application.shm_socket_path.c_str());
ImGui::InputTextWithHint("##SHM path", SystemToolkit::home_path().c_str(), bufsocket, 128);
if (ImGui::IsItemDeactivatedAfterEdit()) {
Settings::application.shm_socket_path = bufsocket;
}
@@ -5799,7 +5799,7 @@ void Navigator::RenderMainPannelSettings()
if (ShmdataBroadcast::available(ShmdataBroadcast::SHM_SHMDATASINK)) {
ImGui::SetCursorPosX(width_);
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
ImGui::Combo("SHM plugin", &Settings::application.shm_method, "shmsink\0shmdatasink\0");
ImGui::Combo("SHM sink", &Settings::application.shm_method, "shmsink\0shmdatasink\0");
}
}