From: YoungHun Kim Date: Thu, 25 May 2023 02:19:05 +0000 (+0900) Subject: Configure on-demand with socket activation on licensing TV X-Git-Tag: accepted/tizen/8.0/unified/20240509.175917~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1d5251f0522ce71591a672b7e9d498519bdd738f;p=platform%2Fcore%2Fmultimedia%2Fmmsvc-core.git Configure on-demand with socket activation on licensing TV Change-Id: Ia70c2696231b58d52fd950addae28a8fbbcc7b14 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 48e8f9cc..74cb5ba6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,4 @@ - -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +CMAKE_MINIMUM_REQUIRED(VERSION 2.6...2.8.12) SET(MUSE_CORE "muse-core") PROJECT(${MUSE_CORE}) @@ -31,6 +30,10 @@ SET(dependents ${dependents} " lwipc") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMUSE_USE_LWIPC") ENDIF(${MUSE_LWIPC_ENABLE}) +IF(${MUSE_LW}) +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMUSE_ONDEMAND -DMUSE_LITE") +ENDIF(${MUSE_LW}) + IF(${MUSE_TTRACE_ENABLE}) SET(dependents ${dependents} " ttrace") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMUSE_TTRACE_LOG") diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 441795eb..ecd79b56 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -1,5 +1,4 @@ - -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +CMAKE_MINIMUM_REQUIRED(VERSION 2.6...2.8.12) SET(MUSE_CLIENT "muse-client") PROJECT(${MUSE_CLIENT}) diff --git a/client/src/muse_client.c b/client/src/muse_client.c index b1c924bb..b806f5b2 100644 --- a/client/src/muse_client.c +++ b/client/src/muse_client.c @@ -235,10 +235,12 @@ static int _muse_client_new(muse_channel_e channel) int fd = -1; ms_boost_t bst = { 0 }; +#ifndef MUSE_ONDEMAND if (!muse_server_is_ready()) { LOGE("muse server is not ready"); return MM_ERROR_UNKNOWN; } +#endif if (channel == MUSE_CHANNEL_MSG) _mc_table_new(); diff --git a/core/include/muse_core_internal.h b/core/include/muse_core_internal.h index ff3b4d10..46371f71 100644 --- a/core/include/muse_core_internal.h +++ b/core/include/muse_core_internal.h @@ -130,8 +130,10 @@ extern "C" { typedef enum { MUSE_PLAYER, +#ifndef MUSE_LITE MUSE_CAMERA, MUSE_RECORDER, +#endif MUSE_DRM_SVC, MUSE_EPPLAYER, MUSE_MODULE_MAX diff --git a/isu/CMakeLists.txt b/isu/CMakeLists.txt index 427195d7..b4ae7a75 100644 --- a/isu/CMakeLists.txt +++ b/isu/CMakeLists.txt @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +CMAKE_MINIMUM_REQUIRED(VERSION 2.6...2.8.12) PROJECT(ISU C) INSTALL(FILES isu.cfg DESTINATION /etc/isu/muse-server/ PERMISSIONS OWNER_WRITE OWNER_READ) diff --git a/packaging/muse-server-vd_product_ltv.service b/packaging/muse-server-vd_product_ltv.service new file mode 100644 index 00000000..5fe1a0c7 --- /dev/null +++ b/packaging/muse-server-vd_product_ltv.service @@ -0,0 +1,19 @@ +[Unit] +Description=muse server of vd product (tv) +DefaultDependencies=no +Requires=sysinit.target +After=sysinit.target + +[Service] +Type=simple +User=multimedia_fw +Group=multimedia_fw +SmackProcessLabel=System +ExecStart=/usr/bin/boostShell -a -r 5 -t 5000 -p /usr/bin/muse-server +ExecStopPost=/usr/bin/ewaiter -r "/run/mused/muse_server_ready" +MemoryLimit=300M +EnvironmentFile=/run/tizen-system-env +EnvironmentFile=/run/xdg-root-env +SupplementaryGroups=priv_mediastorage priv_camera priv_recorder +Capabilities=cap_dac_override=i +SecureBits=keep-caps diff --git a/packaging/muse-server.socket b/packaging/muse-server.socket new file mode 100644 index 00000000..4908ef73 --- /dev/null +++ b/packaging/muse-server.socket @@ -0,0 +1,9 @@ +[Socket] +SocketUser=multimedia_fw +SocketGroup=multimedia_fw +ListenStream=/run/mused/muse_server_msg.socket +Service=muse-server.service +SocketMode=0777 + +[Install] +WantedBy=sockets.target diff --git a/packaging/mused.spec b/packaging/mused.spec index 1ba9e118..75dd8313 100644 --- a/packaging/mused.spec +++ b/packaging/mused.spec @@ -9,7 +9,9 @@ Source1: muse-server.service Source2: gtest.input Source4: muse-server-vd_product_tv.service Source5: muse-server-vd_product_audio.service +Source6: muse-server.socket Source7: muse-server.path +Source8: muse-server-vd_product_ltv.service BuildRequires: cmake BuildRequires: pkgconfig(libsystemd) BuildRequires: pkgconfig(capi-system-info) @@ -79,12 +81,16 @@ export CXXFLAGS+=" -fprofile-arcs -ftest-coverage -DMUSE_GCOV_TEST " export LDFLAGS+=" -lgcov " %endif +%if ("%{sec_buildconf_optimized_memory}" == "1") +%cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DLIBDIR=%{_libdir} -DTZ_SYS_DATA=%TZ_SYS_DATA -DMUSE_REGISTER_VIP=1 -DMUSE_TTRACE_ENABLE=1 -DMUSE_LWIPC_ENABLE=1 -DMUSE_BOOST_ENABLE=1 -DMUSE_LW=1 +%else %if ("%{_vd_cfg_product_type}" == "AUDIO") || ("%{_vd_cfg_product_type}" == "TV") || ("%{_vd_cfg_product_type}" == "LFD") || ("%{_vd_cfg_product_type}" == "HTV") || ("%{_vd_cfg_product_type}" == "AV") || ("%{_vd_cfg_product_type}" == "IWB") || ("%{_vd_cfg_product_type}" == "WALL") %cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DLIBDIR=%{_libdir} -DTZ_SYS_DATA=%TZ_SYS_DATA -DMUSE_REGISTER_VIP=1 -DMUSE_TTRACE_ENABLE=1 -DMUSE_LWIPC_ENABLE=1 -DMUSE_BOOST_ENABLE=1 %else export CFLAGS+=" -DMUSE_USE_POWER_OFF_STATE_CHANGE -DMUSE_USE_WATCHDOG" %cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DLIBDIR=%{_libdir} -DTZ_SYS_DATA=%TZ_SYS_DATA -DMUSE_GTESTS_BUILD=%{?gtests:1}%{!?gtests:0} -DMUSE_STORAGE_ENABLE=1 %endif +%endif make %{?jobs:-j%jobs} @@ -93,6 +99,12 @@ rm -rf %{buildroot} %make_install +%if ("%{sec_buildconf_optimized_memory}" == "1") +mkdir -p %{buildroot}%{_unitdir}/sockets.target.wants +install -m 0644 %SOURCE6 %{buildroot}%{_unitdir}/muse-server.socket +%install_service sockets.target.wants muse-server.socket +install -m 0644 %SOURCE8 %{buildroot}%{_unitdir}/muse-server.service +%else %if ("%{_vd_cfg_product_type}" == "AUDIO") mkdir -p %{buildroot}%{_unitdir}/stater.target.wants install -m 0644 %SOURCE5 %{buildroot}%{_unitdir}/muse-server.service @@ -109,6 +121,7 @@ install -m 0644 %SOURCE1 %{buildroot}%{_unitdir}/muse-server.service install -m 0644 %SOURCE7 %{buildroot}%{_unitdir}/muse-server.path %install_service paths.target.wants muse-server.path +%endif %endif %endif @@ -135,6 +148,10 @@ chsmack -a "System::Shared" /var/log/%{name} %{_libdir}/libmuse-*.so.* %license LICENSE.APLv2 %{_unitdir}/muse-server.service +%if ("%{sec_buildconf_optimized_memory}" == "1") +%{_unitdir}/muse-server.socket +%{_unitdir}/sockets.target.wants/muse-server.socket +%else %if ("%{_vd_cfg_product_type}" == "AUDIO") %{_unitdir}/starter.target.wants/muse-server.service %else @@ -146,6 +163,8 @@ chsmack -a "System::Shared" /var/log/%{name} %{_unitdir}/muse-server.path %endif %endif +%endif + %{TZ_SYS_DATA}/%{name} /var/log/%{name} %{_bindir}/* diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index b55d9689..df87ac54 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -1,5 +1,4 @@ - -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +CMAKE_MINIMUM_REQUIRED(VERSION 2.6...2.8.12) SET(MUSE_SERVER "muse-server") PROJECT(${MUSE_SERVER}) diff --git a/server/include/muse_server_config.h b/server/include/muse_server_config.h index b3b5c1c8..64b00794 100644 --- a/server/include/muse_server_config.h +++ b/server/include/muse_server_config.h @@ -62,7 +62,7 @@ extern "C" { #define DEFAULT_WATCHDOG_DISABLED_API_INDEX -1 /* Watchdog is applied to all dispatcher functions */ #define DEFAULT_MAX_INSTANCE -1 /* Unlimited */ #define DEFAULT_CAUTION_INSTANCE -1 -#define DEFAULT_ON_DEMAND_MAX_IDLE_TIME 600 /* 10 minute */ +#define DEFAULT_ON_DEMAND_MAX_IDLE_TIME 300 /* 5 minute */ #define DEFAULT_ON_DEMAND_MAX_IDLE_MEMORY 30000 /* 30MB */ #define DEFAULT_IDLE_STATE_WAIT_TIME 10 /* seconds */ diff --git a/server/src/muse_server_connection.c b/server/src/muse_server_connection.c index 4e12f61f..e62e2150 100644 --- a/server/src/muse_server_connection.c +++ b/server/src/muse_server_connection.c @@ -69,7 +69,7 @@ static void _ms_connection_module_instance_info(muse_module_h m, ms_connection_t int ms_connection_register(muse_module_h m) { - int caution_instance; + int caution_instance, idx; GQueue *queue; ms_connection_t *connection = NULL; g_autoptr(GMutexLocker) locker = NULL; @@ -97,9 +97,10 @@ int ms_connection_register(muse_module_h m) caution_instance = ms_config_get_caution_instance(m->idx); if (caution_instance != DEFAULT_CAUTION_INSTANCE && connection->instance_count[m->idx] > caution_instance) { - LOGI("[MUSE_MODULE_COMMAND_CREATE_CAUTION] player # %d | camera # %d | recorder # %d > %d", - connection->instance_count[MUSE_PLAYER], connection->instance_count[MUSE_CAMERA], - connection->instance_count[MUSE_RECORDER], caution_instance); + for (idx = MUSE_PLAYER; idx < MUSE_MODULE_MAX; idx++) { + LOGI("[MUSE_MODULE_COMMAND_CREATE_CAUTION] %s # %d > %d", + ms_config_get_host_name(idx), connection->instance_count[idx], caution_instance); + } ms_cmd_dispatch(m, MUSE_MODULE_COMMAND_CREATE_CAUTION); } diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt index 8fb14eb6..16031ef0 100644 --- a/unittest/CMakeLists.txt +++ b/unittest/CMakeLists.txt @@ -1,5 +1,4 @@ - -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +CMAKE_MINIMUM_REQUIRED(VERSION 2.6...2.8.12) LINK_DIRECTORIES(${CMAKE_BINARY_DIR}) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/server/include) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/client/include)