diff --git a/compat/msvc/config.h b/compat/msvc/config.h index 5e31cb7dee18d59ebd73f34f59185968ef3367ce..86cc0238975294e78f1584bd8cfdb8d56e7a9244 100644 --- a/compat/msvc/config.h +++ b/compat/msvc/config.h @@ -89,7 +89,7 @@ systems. This function is required for `alloca.c' support on those systems. #define HAVE_PULSE 0 /* Define if you have shared memory support */ -#define HAVE_SHM 0 +#undef ENABLE_SHM /* Define if you have libspeex */ #define HAVE_SPEEX 0 diff --git a/configure.ac b/configure.ac index 025aa84e5087e822ebb953c9497833233de953e2..8e7c38e37eaf3eaeea318c3c9b9922e040203f1b 100644 --- a/configure.ac +++ b/configure.ac @@ -620,10 +620,8 @@ AM_CONDITIONAL([BUILD_NATPMP], test "x$with_natpmp" = "xyes") # SHM dnl check for shm - -AC_DEFINE_UNQUOTED([HAVE_SHM], - `if test "x$with_dbus" == xyes; then echo 1; else echo 0; fi`, - [Define if you have shared memory support]) +AS_IF([test "x$with_dbus" == xyes], + AC_DEFINE([ENABLE_SHM], [1], [Define if you have shared memory support])) # LTTNG AM_COND_IF([ENABLE_TRACEPOINTS], diff --git a/meson.build b/meson.build index f621981191b689f624918c936aaeb53b6c6a025c..45d0c07d7e7ef0702d7883c6298fbed1758e68ce 100644 --- a/meson.build +++ b/meson.build @@ -156,8 +156,7 @@ else endif conf.set10('HAVE_COREAUDIO', host_machine.system() == 'darwin') -conf.set10('HAVE_SHM', get_option('interfaces').contains('dbus')) - +conf.set('ENABLE_SHM', get_option('interfaces').contains('dbus')) configure_file( output: 'config.h', configuration: conf diff --git a/src/client/videomanager.cpp b/src/client/videomanager.cpp index 8cb564139b718235bbb4cb62e4a80821c99e2a67..a0d43c0a0fa961f06a2045130a84ef588332a7fb 100644 --- a/src/client/videomanager.cpp +++ b/src/client/videomanager.cpp @@ -535,7 +535,7 @@ registerSinkTarget(const std::string& sinkId, SinkTarget target) return false; } -#if HAVE_SHM +#ifdef ENABLE_SHM void startShmSink(const std::string& sinkId, bool value) { diff --git a/src/jami/plugin_manager_interface.h b/src/jami/plugin_manager_interface.h index f35a05a11967368c785a09ea81b5f7c21ade523c..8df15ec0ad5e9d26cd9137e8d8ea6b09e5aa1a18 100644 --- a/src/jami/plugin_manager_interface.h +++ b/src/jami/plugin_manager_interface.h @@ -29,7 +29,7 @@ #include <map> #include <list> -#if __APPLE__ +#ifdef __APPLE__ #import "TargetConditionals.h" #endif diff --git a/src/jami/videomanager_interface.h b/src/jami/videomanager_interface.h index 955d290d5149c3f60c800f119dba4af3853e8680..6a444f76166b36f6232894199ff1a1862235dcad 100644 --- a/src/jami/videomanager_interface.h +++ b/src/jami/videomanager_interface.h @@ -43,7 +43,7 @@ void av_frame_free(AVFrame** frame); #include <cstdint> #include <cstdlib> -#if __APPLE__ +#ifdef __APPLE__ #import "TargetConditionals.h" #endif @@ -195,7 +195,7 @@ DRING_PUBLIC bool playerSeekToTime(const std::string& id, int time); int64_t getPlayerPosition(const std::string& id); DRING_PUBLIC bool registerSinkTarget(const std::string& sinkId, SinkTarget target); -#if HAVE_SHM +#ifdef ENABLE_SHM DRING_PUBLIC void startShmSink(const std::string& sinkId, bool value); #endif DRING_PUBLIC std::map<std::string, std::string> getRenderer(const std::string& callId); @@ -252,7 +252,7 @@ struct DRING_PUBLIC VideoSignal const std::string& /*shm_path*/, bool /*is_mixer*/); }; -#if __ANDROID__ +#ifdef __ANDROID__ struct DRING_PUBLIC SetParameters { constexpr static const char* name = "SetParameters"; diff --git a/src/media/video/sinkclient.cpp b/src/media/video/sinkclient.cpp index 4e9f15bd48ccadd9c8df14e24f6f8a69d6917e3d..f9c5c5d74d78bd17c9db2024115fe657696d1b22 100644 --- a/src/media/video/sinkclient.cpp +++ b/src/media/video/sinkclient.cpp @@ -26,9 +26,9 @@ #include "sinkclient.h" -#if HAVE_SHM +#ifdef ENABLE_SHM #include "shm_header.h" -#endif // HAVE_SHM +#endif // ENABLE_SHM #include "media_buffer.h" #include "logger.h" @@ -63,7 +63,7 @@ namespace video { const constexpr char FILTER_INPUT_NAME[] = "in"; -#if HAVE_SHM +#ifdef ENABLE_SHM // RAII class helper on sem_wait/sem_post sempahore operations class SemGuardLock { @@ -300,7 +300,7 @@ SinkClient::stop() noexcept return true; } -#else // HAVE_SHM +#else // ENABLE_SHM std::string SinkClient::openedName() const noexcept @@ -322,7 +322,7 @@ SinkClient::stop() noexcept return true; } -#endif // !HAVE_SHM +#endif // !ENABLE_SHM SinkClient::SinkClient(const std::string& id, bool mixer) : id_ {id} @@ -439,7 +439,7 @@ SinkClient::update(Observable<std::shared_ptr<MediaFrame>>* /*obs*/, } bool doTransfer = hasTransformedListener or hasObservers; -#if HAVE_SHM +#ifdef ENABLE_SHM doTransfer |= (shm_ && doShmTransfer_); #endif @@ -455,7 +455,7 @@ SinkClient::update(Observable<std::shared_ptr<MediaFrame>>* /*obs*/, setFrameSize(frame->width(), frame->height()); return; } -#if HAVE_SHM +#ifdef ENABLE_SHM if (shm_ && doShmTransfer_) shm_->renderFrame(*frame); #endif diff --git a/src/media/video/sinkclient.h b/src/media/video/sinkclient.h index ed3d9fdfe562d6d49beb047da06a3603a5732060..adce5090c3d2f3dcc3b2cdbdf9a6c6c72db64003 100644 --- a/src/media/video/sinkclient.h +++ b/src/media/video/sinkclient.h @@ -42,9 +42,9 @@ class MediaFilter; namespace jami { namespace video { -#if HAVE_SHM +#ifdef ENABLE_SHM class ShmHolder; -#endif // HAVE_SHM +#endif // ENABLE_SHM class VideoScaler; @@ -82,7 +82,7 @@ public: target_ = std::move(target); } -#if HAVE_SHM +#ifdef ENABLE_SHM void enableShm(bool value) { doShmTransfer_.store(value); } #endif @@ -122,11 +122,11 @@ private: std::chrono::steady_clock::time_point lastFrameDebug_; #endif -#if HAVE_SHM +#ifdef ENABLE_SHM // using shared_ptr and not unique_ptr as ShmHolder is forwared only std::shared_ptr<ShmHolder> shm_; std::atomic_bool doShmTransfer_ {false}; -#endif // HAVE_SHM +#endif // ENABLE_SHM }; } // namespace video