diff --git a/cmake/Findtelemetry.cmake b/cmake/Findtelemetry.cmake new file mode 100644 index 000000000..dff59ae0b --- /dev/null +++ b/cmake/Findtelemetry.cmake @@ -0,0 +1,39 @@ +# +# If not stated otherwise in this file or this component's LICENSE file the +# following copyright and licenses apply: +# +# Copyright 2026 Sky UK +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +if(NOT NATIVE_BUILD) + find_path(TELEMETRY_INCLUDE_DIR NAMES telemetry_busmessage_sender.h) + find_library(TELEMETRY_LIBRARY NAMES telemetry_msgsender) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(TELEMETRY DEFAULT_MSG TELEMETRY_LIBRARY TELEMETRY_INCLUDE_DIR) + + mark_as_advanced(TELEMETRY_INCLUDE_DIR TELEMETRY_LIBRARY) + + if(TELEMETRY_FOUND) + set(TELEMETRY_LIBRARIES ${TELEMETRY_LIBRARY}) + set(TELEMETRY_INCLUDE_DIRS ${TELEMETRY_INCLUDE_DIR}) + else() + set(TELEMETRY_LIBRARIES "") + set(TELEMETRY_INCLUDE_DIRS "") + endif() +else() + set(TELEMETRY_INCLUDE_DIRS "") + set(TELEMETRY_LIBRARIES "") +endif() diff --git a/logging/CMakeLists.txt b/logging/CMakeLists.txt index 2c0751238..607b0e67e 100644 --- a/logging/CMakeLists.txt +++ b/logging/CMakeLists.txt @@ -19,6 +19,7 @@ set(RialtoLogging_HEADERS include/RialtoLogging.h + include/RialtoTelemetry.h ) set(RialtoLogging_SOURCES @@ -34,10 +35,28 @@ set(RialtoLogging_INCLUDES ) add_library(RialtoLogging STATIC ${RialtoLogging_HEADERS} ${RialtoLogging_SOURCES}) -target_include_directories(RialtoLogging PUBLIC "$") -set_target_properties(RialtoLogging PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF) -set_target_properties(RialtoLogging PROPERTIES POSITION_INDEPENDENT_CODE ON) +target_include_directories(RialtoLogging PUBLIC + "$" +) +# Telemetry support +if(CMAKE_TELEMETRY_2_0_REQUIRED) + message(STATUS "Telemetry 2.0 support enabled") + target_compile_definitions(RialtoLogging PUBLIC RIALTO_TELEMETRY_SUPPORT=1) + target_include_directories(RialtoLogging PUBLIC ${TELEMETRY_INCLUDE_DIRS}) + target_link_libraries(RialtoLogging PUBLIC ${TELEMETRY_LIBRARIES}) +else() + message(STATUS "Telemetry support disabled (stub mode)") +endif() + +set_target_properties(RialtoLogging PROPERTIES + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF + POSITION_INDEPENDENT_CODE ON +) + +# EthanLog support find_package(EthanLog) if (EthanLog_FOUND AND RIALTO_ENABLE_ETHAN_LOG) message(STATUS "EthanLog is enabled") @@ -45,9 +64,21 @@ if (EthanLog_FOUND AND RIALTO_ENABLE_ETHAN_LOG) target_include_directories(RialtoEthanLog PUBLIC "$") target_compile_definitions(RialtoEthanLog PRIVATE USE_ETHANLOG) target_link_libraries(RialtoEthanLog PUBLIC EthanLog::EthanLog) - set_target_properties(RialtoEthanLog PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF) - set_target_properties(RialtoEthanLog PROPERTIES POSITION_INDEPENDENT_CODE ON) -else () + if(CMAKE_TELEMETRY_2_0_REQUIRED) + message(STATUS "Telemetry 2.0 support enabled") + target_compile_definitions(RialtoLogging PUBLIC RIALTO_TELEMETRY_SUPPORT=1) + target_include_directories(RialtoLogging PUBLIC ${TELEMETRY_INCLUDE_DIRS}) + target_link_libraries(RialtoLogging PUBLIC ${TELEMETRY_LIBRARIES}) + else() + message(STATUS "Telemetry support disabled (stub mode)") + endif() + set_target_properties(RialtoEthanLog PROPERTIES + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF + POSITION_INDEPENDENT_CODE ON + ) +else() message(STATUS "EthanLog is disabled") add_library(RialtoEthanLog ALIAS RialtoLogging) -endif () +endif() diff --git a/logging/include/RialtoLogging.h b/logging/include/RialtoLogging.h index ca97a228a..1054bb6c4 100644 --- a/logging/include/RialtoLogging.h +++ b/logging/include/RialtoLogging.h @@ -25,6 +25,7 @@ extern "C" { #endif +#include "RialtoTelemetry.h" #include #include diff --git a/logging/include/RialtoTelemetry.h b/logging/include/RialtoTelemetry.h new file mode 100644 index 000000000..11884d8f5 --- /dev/null +++ b/logging/include/RialtoTelemetry.h @@ -0,0 +1,93 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2026 Sky UK + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef RIALTO_TELEMETRY_H_ +#define RIALTO_TELEMETRY_H_ + +#ifdef RIALTO_TELEMETRY_SUPPORT +#include +#endif + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifdef RIALTO_TELEMETRY_SUPPORT + +#define TELEMETRY_INIT(component) \ + do \ + { \ + t2_init(reinterpret_cast(component)); \ + } while (0) + +#define TELEMETRY_UNINIT() \ + do \ + { \ + t2_uninit(); \ + } while (0) + +#define TELEMETRY_EVENT_STRING(marker, value) \ + do \ + { \ + t2_event_s(reinterpret_cast(marker), reinterpret_cast(value)); \ + } while (0) + +#define TELEMETRY_EVENT_FLOAT(marker, value) \ + do \ + { \ + t2_event_f(reinterpret_cast(marker), static_cast(value)); \ + } while (0) + +#define TELEMETRY_EVENT_INT(marker, value) \ + do \ + { \ + t2_event_d(reinterpret_cast(marker), static_cast(value)); \ + } while (0) + +#else /* stub implementation if telemetry not enabled */ + +#define TELEMETRY_INIT(component) \ + do \ + { \ + } while (0) +#define TELEMETRY_UNINIT() \ + do \ + { \ + } while (0) +#define TELEMETRY_EVENT_STRING(m, v) \ + do \ + { \ + } while (0) +#define TELEMETRY_EVENT_FLOAT(m, v) \ + do \ + { \ + } while (0) +#define TELEMETRY_EVENT_INT(m, v) \ + do \ + { \ + } while (0) + +#endif /* RIALTO_TELEMETRY_SUPPORT */ + +#ifdef __cplusplus +} +#endif + +#endif /* RIALTO_TELEMETRY_H_ */ diff --git a/media/client/common/include/RialtoClientLogging.h b/media/client/common/include/RialtoClientLogging.h index 2ca75f2a2..528f4f005 100644 --- a/media/client/common/include/RialtoClientLogging.h +++ b/media/client/common/include/RialtoClientLogging.h @@ -21,6 +21,7 @@ #define RIALTO_CLIENT_LOGGING_H_ #include "RialtoLogging.h" +#include #ifdef __cplusplus extern "C" diff --git a/media/client/ipc/source/ControlIpc.cpp b/media/client/ipc/source/ControlIpc.cpp index 54f68c0e4..53fcc3857 100644 --- a/media/client/ipc/source/ControlIpc.cpp +++ b/media/client/ipc/source/ControlIpc.cpp @@ -115,6 +115,10 @@ bool ControlIpc::getSharedMemory(int32_t &fd, uint32_t &size) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to get the shared memory due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to get the shared memory due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - ControllIpc", telemetryBuff); return false; } @@ -152,6 +156,10 @@ bool ControlIpc::registerClient() if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to register client due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to register client due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - ControllIpc", telemetryBuff); return false; } @@ -181,6 +189,13 @@ bool ControlIpc::registerClient() RIALTO_CLIENT_LOG_ERROR("Server and Client proto schema versions are not compatible. Server schema version: " "%s, Client schema version: %s", kServerSchemaVersion.str().c_str(), kCurrentSchemaVersion.str().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), + "Server and Client proto schema versions are not compatible. Server schema version: " + "%s, Client schema version: %s", + kServerSchemaVersion.str().c_str(), kCurrentSchemaVersion.str().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - ControllIpc", telemetryBuff); + return false; } @@ -260,6 +275,9 @@ void ControlIpc::onPing(const std::shared_ptr &even if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to ack due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to ack due to '%s'", ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - ControllIpc", telemetryBuff); } } }; // namespace firebolt::rialto::client diff --git a/media/client/ipc/source/IpcClient.cpp b/media/client/ipc/source/IpcClient.cpp index 57f2f5c60..55d9d08a0 100644 --- a/media/client/ipc/source/IpcClient.cpp +++ b/media/client/ipc/source/IpcClient.cpp @@ -159,6 +159,10 @@ void IpcClient::processIpcThread() if (!m_disconnecting) { RIALTO_CLIENT_LOG_ERROR("The ipc channel unexpectedly disconnected, destroying the channel"); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), + "The ipc channel unexpectedly disconnected, destroying the channel"); + TELEMETRY_EVENT_STRING("Rialto Client - IpcClient", telemetryBuff); // Safe to destroy the ipc objects in the ipc thread as the client has already disconnected. // This ensures the channel is destructed and that all ongoing ipc calls are unblocked. diff --git a/media/client/ipc/source/MediaKeysCapabilitiesIpc.cpp b/media/client/ipc/source/MediaKeysCapabilitiesIpc.cpp index 4227f3848..d167b7027 100644 --- a/media/client/ipc/source/MediaKeysCapabilitiesIpc.cpp +++ b/media/client/ipc/source/MediaKeysCapabilitiesIpc.cpp @@ -36,6 +36,10 @@ std::shared_ptr IMediaKeysCapabilitiesIpcFacto catch (const std::exception &e) { RIALTO_CLIENT_LOG_ERROR("Failed to create the media keys capabilities ipc factory, reason: %s", e.what()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), + "Failed to create the media keys capabilities ipc factory, reason: %s", e.what()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaKeysCapabilitiesIpc", telemetryBuff); } return factory; @@ -58,6 +62,10 @@ std::shared_ptr MediaKeysCapabilitiesIpcFactory::getMedi catch (const std::exception &e) { RIALTO_CLIENT_LOG_ERROR("Failed to create the media keys capabilities ipc, reason: %s", e.what()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), + "Failed to create the media keys capabilities ipc, reason: %s", e.what()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaKeysCapabilitiesIpc", telemetryBuff); } MediaKeysCapabilitiesIpcFactory::m_mediaKeysCapabilitiesIpc = mediaKeysCapabilitiesIpc; @@ -115,6 +123,10 @@ std::vector MediaKeysCapabilitiesIpc::getSupportedKeySystems() if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to get supported key systems due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to get supported key systems due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaKeysCapabilitiesIpc", telemetryBuff); return {}; } @@ -144,6 +156,10 @@ bool MediaKeysCapabilitiesIpc::supportsKeySystem(const std::string &keySystem) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to supports key system due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to support key systems due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaKeysCapabilitiesIpc", telemetryBuff); return false; } @@ -175,6 +191,10 @@ bool MediaKeysCapabilitiesIpc::getSupportedKeySystemVersion(const std::string &k { RIALTO_CLIENT_LOG_ERROR("failed to get supported key system version due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to get supported key system versions due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaKeysCapabilitiesIpc", telemetryBuff); return false; } version = response.version(); @@ -207,6 +227,10 @@ bool MediaKeysCapabilitiesIpc::isServerCertificateSupported(const std::string &k { RIALTO_CLIENT_LOG_ERROR("failed to check if server certificate is supported due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to check if server certificate is supported due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaKeysCapabilitiesIpc", telemetryBuff); return false; } diff --git a/media/client/ipc/source/MediaKeysIpc.cpp b/media/client/ipc/source/MediaKeysIpc.cpp index 761566218..4a80143b7 100644 --- a/media/client/ipc/source/MediaKeysIpc.cpp +++ b/media/client/ipc/source/MediaKeysIpc.cpp @@ -141,6 +141,10 @@ std::shared_ptr IMediaKeysIpcFactory::createFactory() catch (const std::exception &e) { RIALTO_CLIENT_LOG_ERROR("Failed to create the media keys ipc factory, reason: %s", e.what()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to create the media keys ipc factory, reason: %s", + e.what()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaKeysIpc", telemetryBuff); } return factory; @@ -158,6 +162,9 @@ std::unique_ptr MediaKeysIpcFactory::createMediaKeysIpc(const std::s catch (const std::exception &e) { RIALTO_CLIENT_LOG_ERROR("Failed to create the media keys ipc, reason: %s", e.what()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to create the media keys ipc, reason: %s", e.what()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaKeysIpc", telemetryBuff); } return mediaKeysIpc; @@ -257,6 +264,10 @@ bool MediaKeysIpc::createMediaKeys(const std::string &keySystem) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to create media keys due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to create media keys due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaKeysIpc", telemetryBuff); return false; } @@ -288,6 +299,10 @@ void MediaKeysIpc::destroyMediaKeys() if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to destroy media keys due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to destroy media keys due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaKeysIpc", telemetryBuff); } } @@ -327,6 +342,10 @@ bool MediaKeysIpc::containsKey(int32_t keySessionId, const std::vector if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("containsKey failed due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "containsKey failed due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaKeysIpc", telemetryBuff); return false; } @@ -910,12 +929,20 @@ MediaKeysIpc::getMediaKeyErrorStatusFromResponse(const std::string methodName, if (controller->Failed()) { RIALTO_CLIENT_LOG_ERROR("%s failed due to '%s'", methodName.c_str(), controller->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "%s failed due to '%s'", methodName.c_str(), + controller->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaKeysIpc", telemetryBuff); return MediaKeyErrorStatus::FAIL; } MediaKeyErrorStatus returnStatus = convertMediaKeyErrorStatus(status); if (MediaKeyErrorStatus::OK != returnStatus) { RIALTO_CLIENT_LOG_ERROR("%s failed due to MediaKeyErrorStatus '%s'", methodName.c_str(), toString(returnStatus)); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "%s failed due to MediaKeyErrorStatus '%s'", methodName.c_str(), + toString(returnStatus)); + TELEMETRY_EVENT_STRING("Rialto Client - MediaKeysIpc", telemetryBuff); return returnStatus; } diff --git a/media/client/ipc/source/MediaPipelineCapabilitiesIpc.cpp b/media/client/ipc/source/MediaPipelineCapabilitiesIpc.cpp index 68843ee9a..ba57f8d8f 100644 --- a/media/client/ipc/source/MediaPipelineCapabilitiesIpc.cpp +++ b/media/client/ipc/source/MediaPipelineCapabilitiesIpc.cpp @@ -16,6 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include #include "MediaPipelineCapabilitiesIpc.h" #include "RialtoClientLogging.h" @@ -34,6 +35,10 @@ std::shared_ptr IMediaPipelineCapabilities catch (const std::exception &e) { RIALTO_CLIENT_LOG_ERROR("Failed to create the media pipeline capabilities ipc factory, reason: %s", e.what()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), + "Failed to create the media pipeline capabilities ipc factory, reason: %s", e.what()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineCapabilitiesIpc", telemetryBuff); } return factory; @@ -51,6 +56,10 @@ std::unique_ptr MediaPipelineCapabilitiesIpcFactory: catch (const std::exception &e) { RIALTO_CLIENT_LOG_ERROR("Failed to create the media pipeline capabilities ipc, reason: %s", e.what()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), + "Failed to create the media pipeline capabilities ipc, reason: %s", e.what()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineCapabilitiesIpc", telemetryBuff); } return mediaPipelineCapabilitiesIpc; @@ -108,6 +117,10 @@ std::vector MediaPipelineCapabilitiesIpc::getSupportedMimeTypes(Med if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to get supported mime types due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to get supported mime types due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineCapabilitiesIpc", telemetryBuff); return {}; } @@ -138,6 +151,10 @@ bool MediaPipelineCapabilitiesIpc::isMimeTypeSupported(const std::string &mimeTy { RIALTO_CLIENT_LOG_ERROR("failed to check if mime type '%s' is supported due to '%s'", mimeType.c_str(), ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to check if mime type '%s' is supported due to '%s'", + mimeType.c_str(), ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineCapabilitiesIpc", telemetryBuff); return false; } @@ -171,6 +188,9 @@ std::vector MediaPipelineCapabilitiesIpc::getSupportedProperties(Me if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed due to '%s'", ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineCapabilitiesIpc", telemetryBuff); return std::vector{}; } @@ -198,6 +218,9 @@ bool MediaPipelineCapabilitiesIpc::isVideoMaster(bool &isVideoMaster) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed due to '%s'", ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineCapabilitiesIpc", telemetryBuff); return false; } diff --git a/media/client/ipc/source/MediaPipelineIpc.cpp b/media/client/ipc/source/MediaPipelineIpc.cpp index ff1b09847..c722f46a1 100644 --- a/media/client/ipc/source/MediaPipelineIpc.cpp +++ b/media/client/ipc/source/MediaPipelineIpc.cpp @@ -209,6 +209,10 @@ bool MediaPipelineIpc::load(MediaType type, const std::string &mimeType, const s if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to load media due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to load media due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -245,6 +249,10 @@ bool MediaPipelineIpc::attachSource(const std::unique_ptrFailed()) { RIALTO_CLIENT_LOG_ERROR("failed to attach source due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to attach source due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -278,6 +286,10 @@ bool MediaPipelineIpc::removeSource(int32_t sourceId) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to remove source due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to remove source due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -308,6 +320,10 @@ bool MediaPipelineIpc::allSourcesAttached() { RIALTO_CLIENT_LOG_ERROR("failed to notify about all sources attached due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to notify about all sources attached due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -342,6 +358,10 @@ bool MediaPipelineIpc::setVideoWindow(uint32_t x, uint32_t y, uint32_t width, ui if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to set the video window due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to set the video window due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -372,6 +392,9 @@ bool MediaPipelineIpc::play(bool &async) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to play due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to play due to '%s'", ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -404,6 +427,9 @@ bool MediaPipelineIpc::pause() if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to pause due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to pause due to '%s'", ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -434,6 +460,9 @@ bool MediaPipelineIpc::stop() if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to stop due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to stop due to '%s'", ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -467,6 +496,9 @@ bool MediaPipelineIpc::haveData(MediaSourceStatus status, uint32_t numFrames, ui if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to stop due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to stop due to '%s'", ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -498,6 +530,10 @@ bool MediaPipelineIpc::setPosition(int64_t position) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to set position due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to set position due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -528,6 +564,10 @@ bool MediaPipelineIpc::getPosition(int64_t &position) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to get position due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to get position due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -561,6 +601,10 @@ bool MediaPipelineIpc::setImmediateOutput(int32_t sourceId, bool immediateOutput if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to set immediate-output due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to set immediate-output due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -592,6 +636,10 @@ bool MediaPipelineIpc::getImmediateOutput(int32_t sourceId, bool &immediateOutpu if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to get immediate-output due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to get immediate-output due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } else @@ -627,6 +675,10 @@ bool MediaPipelineIpc::getStats(int32_t sourceId, uint64_t &renderedFrames, uint if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to get stats due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to get stats due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -660,6 +712,10 @@ bool MediaPipelineIpc::setPlaybackRate(double rate) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to set playback rate due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to set playback rate due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -689,6 +745,10 @@ bool MediaPipelineIpc::renderFrame() if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to render frame due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to render frame due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -722,6 +782,10 @@ bool MediaPipelineIpc::setVolume(double targetVolume, uint32_t volumeDuration, E if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to set volume due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to set volume due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -752,6 +816,10 @@ bool MediaPipelineIpc::getVolume(double &volume) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to get volume due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to get volume due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } volume = response.volume(); @@ -785,6 +853,10 @@ bool MediaPipelineIpc::setMute(int32_t sourceId, bool mute) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to set mute due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to set mute due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -816,6 +888,10 @@ bool MediaPipelineIpc::getMute(std::int32_t sourceId, bool &mute) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to get mute due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to get mute due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -849,6 +925,10 @@ bool MediaPipelineIpc::setTextTrackIdentifier(const std::string &textTrackIdenti if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to set text track identifier due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to set text track identifier due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -879,6 +959,10 @@ bool MediaPipelineIpc::getTextTrackIdentifier(std::string &textTrackIdentifier) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to get mute due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to get mute due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -911,6 +995,10 @@ bool MediaPipelineIpc::setLowLatency(bool lowLatency) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to set low-latency due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to set low-latency due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -942,6 +1030,10 @@ bool MediaPipelineIpc::setSync(bool sync) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to set sync due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to set sync due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -972,6 +1064,10 @@ bool MediaPipelineIpc::getSync(bool &sync) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to get sync due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to get sync due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -1005,6 +1101,10 @@ bool MediaPipelineIpc::setSyncOff(bool syncOff) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to set sync-off due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to set sync-off due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -1037,6 +1137,10 @@ bool MediaPipelineIpc::setStreamSyncMode(int32_t sourceId, int32_t streamSyncMod if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to set stream-sync-mode due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to set stream-sync-mode due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -1067,6 +1171,10 @@ bool MediaPipelineIpc::getStreamSyncMode(int32_t &streamSyncMode) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to get stream-sync-mode due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to get stream-sync-mode due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -1101,6 +1209,9 @@ bool MediaPipelineIpc::flush(int32_t sourceId, bool resetTime, bool &async) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to flush due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to flush due to '%s'", ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -1140,6 +1251,10 @@ bool MediaPipelineIpc::setSourcePosition(int32_t sourceId, int64_t position, boo if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to set source position due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to set source position due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -1172,6 +1287,10 @@ bool MediaPipelineIpc::setSubtitleOffset(int32_t sourceId, int64_t position) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to set subtitle offset due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to set subtitle offset due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -1206,6 +1325,10 @@ bool MediaPipelineIpc::processAudioGap(int64_t position, uint32_t duration, int6 if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to process audio gap due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to process audio gap due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -1237,6 +1360,10 @@ bool MediaPipelineIpc::setBufferingLimit(uint32_t limitBufferingMs) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to set buffering limit due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to set buffering limit due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -1267,6 +1394,10 @@ bool MediaPipelineIpc::getBufferingLimit(uint32_t &limitBufferingMs) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to get buffering limit due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to get buffering limit due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -1300,6 +1431,10 @@ bool MediaPipelineIpc::setUseBuffering(bool useBuffering) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to set use buffering due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to set use buffering due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -1330,6 +1465,10 @@ bool MediaPipelineIpc::getUseBuffering(bool &useBuffering) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to get use buffering due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to get use buffering due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -1368,6 +1507,10 @@ bool MediaPipelineIpc::switchSource(const std::unique_ptrFailed()) { RIALTO_CLIENT_LOG_ERROR("failed to attach source due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to attach source due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -1566,6 +1709,10 @@ bool MediaPipelineIpc::createSession(const VideoRequirements &videoRequirements) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to create session due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to create session due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); return false; } @@ -1597,6 +1744,10 @@ void MediaPipelineIpc::destroySession() if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("failed to destroy session due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to destroy session due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineIpc", telemetryBuff); } } diff --git a/media/client/ipc/source/WebAudioPlayerIpc.cpp b/media/client/ipc/source/WebAudioPlayerIpc.cpp index d4fafa1c6..f5894fb21 100644 --- a/media/client/ipc/source/WebAudioPlayerIpc.cpp +++ b/media/client/ipc/source/WebAudioPlayerIpc.cpp @@ -178,6 +178,9 @@ bool WebAudioPlayerIpc::play() if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("Failed to play due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to play due to '%s'", ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - WebAudioPlayerIpc", telemetryBuff); return false; } @@ -207,6 +210,9 @@ bool WebAudioPlayerIpc::pause() if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("Failed to pause due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to pause due to '%s'", ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - WebAudioPlayerIpc", telemetryBuff); return false; } @@ -236,6 +242,10 @@ bool WebAudioPlayerIpc::setEos() if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("Failed to set eos due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to set eos due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - WebAudioPlayerIpc", telemetryBuff); return false; } @@ -272,6 +282,10 @@ bool WebAudioPlayerIpc::getBufferAvailable(uint32_t &availableFrames, if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("Failed to get buffer available due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to get buffer available due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - WebAudioPlayerIpc", telemetryBuff); return false; } @@ -307,6 +321,10 @@ bool WebAudioPlayerIpc::getBufferDelay(uint32_t &delayFrames) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("Failed to get buffer delay source due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to get buffer delay source due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - WebAudioPlayerIpc", telemetryBuff); return false; } @@ -340,6 +358,10 @@ bool WebAudioPlayerIpc::writeBuffer(const uint32_t numberOfFrames) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("Failed to write to the buffer due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to write to the buffer due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - WebAudioPlayerIpc", telemetryBuff); return false; } @@ -369,6 +391,10 @@ bool WebAudioPlayerIpc::getDeviceInfo(uint32_t &preferredFrames, uint32_t &maxim if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("Failed to get device info source due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to get device info source due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - WebAudioPlayerIpc", telemetryBuff); return false; } @@ -403,6 +429,10 @@ bool WebAudioPlayerIpc::setVolume(double volume) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("Failed to set volume due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to set volume due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - WebAudioPlayerIpc", telemetryBuff); return false; } @@ -432,6 +462,10 @@ bool WebAudioPlayerIpc::getVolume(double &volume) if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("Failed to get volume due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to get volume due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - WebAudioPlayerIpc", telemetryBuff); return false; } @@ -476,6 +510,10 @@ bool WebAudioPlayerIpc::createWebAudioPlayer(const std::string &audioMimeType, c if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("Failed to create web audio player due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to create web audio player due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - WebAudioPlayerIpc", telemetryBuff); return false; } @@ -507,6 +545,10 @@ void WebAudioPlayerIpc::destroyWebAudioPlayer() if (ipcController->Failed()) { RIALTO_CLIENT_LOG_ERROR("Failed to destroy web audio player due to '%s'", ipcController->ErrorText().c_str()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to destroy web audio player due to '%s'", + ipcController->ErrorText().c_str()); + TELEMETRY_EVENT_STRING("Rialto Client - WebAudioPlayerIpc", telemetryBuff); } } diff --git a/media/client/main/source/ClientController.cpp b/media/client/main/source/ClientController.cpp index 5f9fe6b6f..ce678b15d 100644 --- a/media/client/main/source/ClientController.cpp +++ b/media/client/main/source/ClientController.cpp @@ -20,6 +20,7 @@ #include "ClientController.h" #include "RialtoClientLogging.h" #include "SharedMemoryHandle.h" +#include #include #include #include @@ -174,6 +175,9 @@ try if (!m_controlIpc->getSharedMemory(shmFd, shmBufferLen)) { RIALTO_CLIENT_LOG_ERROR("Failed to get the shared memory"); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to get the shared memory"); + TELEMETRY_EVENT_STRING("Rialto Client - ClientController", telemetryBuff); return false; } m_shmHandle = std::make_shared(shmFd, shmBufferLen); @@ -216,6 +220,9 @@ void ClientController::notifyApplicationState(ApplicationState state) if (!initSharedMemory()) { RIALTO_CLIENT_LOG_ERROR("Could not initalise the shared memory"); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Could not initalise the shared memory"); + TELEMETRY_EVENT_STRING("Rialto Client - ClientController", telemetryBuff); return; } // Inform clients after memory initialisation diff --git a/media/client/main/source/MediaKeys.cpp b/media/client/main/source/MediaKeys.cpp index 4d5afa337..45a303777 100644 --- a/media/client/main/source/MediaKeys.cpp +++ b/media/client/main/source/MediaKeys.cpp @@ -44,6 +44,9 @@ std::shared_ptr IMediaKeysFactory::createFactory() catch (const std::exception &e) { RIALTO_CLIENT_LOG_ERROR("Failed to create the media keys factory, reason: %s", e.what()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to create the media keys factory, reason: %s", e.what()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaKeys", telemetryBuff); } return factory; @@ -70,6 +73,9 @@ MediaKeysFactory::createMediaKeys(const std::string &keySystem, catch (const std::exception &e) { RIALTO_CLIENT_LOG_ERROR("Failed to create the media keys, reason: %s", e.what()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to create the media keys, reason: %s", e.what()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaKeys", telemetryBuff); } return mediaKeys; diff --git a/media/client/main/source/MediaKeysCapabilities.cpp b/media/client/main/source/MediaKeysCapabilities.cpp index 7ed7bc997..32af9fc55 100644 --- a/media/client/main/source/MediaKeysCapabilities.cpp +++ b/media/client/main/source/MediaKeysCapabilities.cpp @@ -39,6 +39,10 @@ std::shared_ptr IMediaKeysCapabilitiesFactory::cr catch (const std::exception &e) { RIALTO_CLIENT_LOG_ERROR("Failed to create the media keys capabilities factory, reason: %s", e.what()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), + "Failed to create the media keys capabilities factory, reason: %s", e.what()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaKeysCapabilities", telemetryBuff); } return factory; @@ -61,6 +65,10 @@ std::shared_ptr MediaKeysCapabilitiesFactory::getMediaKe catch (const std::exception &e) { RIALTO_CLIENT_LOG_ERROR("Failed to create the media keys capabilities, reason: %s", e.what()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to create the media keys capabilities, reason: %s", + e.what()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaKeysCapabilities", telemetryBuff); } MediaKeysCapabilitiesFactory::m_mediaKeysCapabilities = mediaKeysCapabilities; diff --git a/media/client/main/source/MediaPipelineCapabilities.cpp b/media/client/main/source/MediaPipelineCapabilities.cpp index fdafd2c67..f4ff28e4c 100644 --- a/media/client/main/source/MediaPipelineCapabilities.cpp +++ b/media/client/main/source/MediaPipelineCapabilities.cpp @@ -22,6 +22,7 @@ #include "IMediaPipelineCapabilitiesIpcFactory.h" #include "MediaPipelineCapabilities.h" #include "RialtoClientLogging.h" +#include namespace firebolt::rialto { @@ -36,6 +37,10 @@ std::shared_ptr IMediaPipelineCapabilitiesFac catch (const std::exception &e) { RIALTO_CLIENT_LOG_ERROR("Failed to create the media pipeline capabilities factory, reason: %s", e.what()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), + "Failed to create the media pipeline capabilities factory, reason: %s", e.what()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineCapabilities", telemetryBuff); } return factory; @@ -52,6 +57,10 @@ std::unique_ptr MediaPipelineCapabilitiesFactory::cr catch (const std::exception &e) { RIALTO_CLIENT_LOG_ERROR("Failed to create the media pipeline capabilities, reason: %s", e.what()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to create the media pipeline capabilities, reason: %s", + e.what()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaPipelineCapabilities", telemetryBuff); } return mediaPipelineCapabilities; diff --git a/media/server/ipc/source/MediaKeysCapabilitiesModuleService.cpp b/media/server/ipc/source/MediaKeysCapabilitiesModuleService.cpp index b33a2bdf4..9b85589ba 100644 --- a/media/server/ipc/source/MediaKeysCapabilitiesModuleService.cpp +++ b/media/server/ipc/source/MediaKeysCapabilitiesModuleService.cpp @@ -39,6 +39,10 @@ std::shared_ptr IMediaKeysCapabiliti { RIALTO_SERVER_LOG_ERROR("Failed to create the media keys capabilities module service factory, reason: %s", e.what()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), + "Failed to create the media keys capabilities module service factory, reason: %s", e.what()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaKeysCapabilitiesModuleService", telemetryBuff); } return factory; @@ -56,6 +60,10 @@ MediaKeysCapabilitiesModuleServiceFactory::create(service::ICdmService &cdmServi catch (const std::exception &e) { RIALTO_SERVER_LOG_ERROR("Failed to create the media keys capabilities module service, reason: %s", e.what()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), + "Failed to create the media keys capabilities module service, reason: %s", e.what()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaKeysCapabilitiesModuleService", telemetryBuff); } return mediaKeysCapabilitiesModule; diff --git a/media/server/ipc/source/MediaKeysModuleService.cpp b/media/server/ipc/source/MediaKeysModuleService.cpp index 6f69d69dd..75f4ae8bb 100644 --- a/media/server/ipc/source/MediaKeysModuleService.cpp +++ b/media/server/ipc/source/MediaKeysModuleService.cpp @@ -131,6 +131,10 @@ std::shared_ptr IMediaKeysModuleServiceFactory:: catch (const std::exception &e) { RIALTO_SERVER_LOG_ERROR("Failed to create the media keys module service factory, reason: %s", e.what()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), + "Failed to create the media keys module service factory, reason: %s", e.what()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaKeysModuleService", telemetryBuff); } return factory; @@ -147,6 +151,10 @@ std::shared_ptr MediaKeysModuleServiceFactory::create(s catch (const std::exception &e) { RIALTO_SERVER_LOG_ERROR("Failed to create the media keys module service, reason: %s", e.what()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to create the media keys module service, reason: %s", + e.what()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaKeysModuleService", telemetryBuff); } return mediaKeysModule; diff --git a/media/server/main/source/MediaKeysCapabilities.cpp b/media/server/main/source/MediaKeysCapabilities.cpp index b22836fb5..b62bf86b5 100644 --- a/media/server/main/source/MediaKeysCapabilities.cpp +++ b/media/server/main/source/MediaKeysCapabilities.cpp @@ -65,6 +65,10 @@ std::shared_ptr IMediaKeysCapabilitiesFactory::cr catch (const std::exception &e) { RIALTO_SERVER_LOG_ERROR("Failed to create the media keys capabilities factory, reason: %s", e.what()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), + "Failed to create the media keys capabilities factory, reason: %s", e.what()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaKeysCapabilities", telemetryBuff); } return factory; @@ -82,6 +86,10 @@ std::shared_ptr MediaKeysCapabilitiesFactory::getMediaKe catch (const std::exception &e) { RIALTO_SERVER_LOG_ERROR("Failed to create the media keys capabilities, reason: %s", e.what()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Failed to create the media keys capabilities, reason: %s", + e.what()); + TELEMETRY_EVENT_STRING("Rialto Client - MediaKeysCapabilities", telemetryBuff); } return mediaKeysCapabilities; diff --git a/media/server/service/source/main.cpp b/media/server/service/source/main.cpp index 94c7e5138..8babad306 100644 --- a/media/server/service/source/main.cpp +++ b/media/server/service/source/main.cpp @@ -23,6 +23,7 @@ #include "IApplicationSessionServer.h" #include "IGstInitialiser.h" #include "RialtoServerLogging.h" +#include "RialtoTelemetry.h" // NOLINT(build/filename_format) @@ -47,6 +48,7 @@ int main(int argc, char *argv[]) RIALTO_SERVER_LOG_WARN("Failed to get git commit ID!"); } + TELEMETRY_INIT("rialto-server"); firebolt::rialto::server::IGstInitialiser::instance().initialise(&argc, &argv); auto appSessionServer = diff --git a/serverManager/common/source/HealthcheckService.cpp b/serverManager/common/source/HealthcheckService.cpp index 6a478a64d..a630999e6 100644 --- a/serverManager/common/source/HealthcheckService.cpp +++ b/serverManager/common/source/HealthcheckService.cpp @@ -141,6 +141,11 @@ void HealthcheckService::handleError(int serverId) { RIALTO_SERVER_MANAGER_LOG_WARN( "Max num of failed pings reached for server with id: %d. Starting recovery action", serverId); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), + "Max num of failed pings reached for server with id: %d. Starting recovery action", serverId); + TELEMETRY_EVENT_STRING("Rialto Server Manager - HealthcheckService", telemetryBuff); + failedPingsNum = 0; m_sessionServerAppManager.restartServer(serverId); } diff --git a/serverManager/common/source/SessionServerAppManager.cpp b/serverManager/common/source/SessionServerAppManager.cpp index 08b465973..a3bbdc245 100644 --- a/serverManager/common/source/SessionServerAppManager.cpp +++ b/serverManager/common/source/SessionServerAppManager.cpp @@ -240,6 +240,9 @@ bool SessionServerAppManager::connectSessionServer(const std::shared_ptrcreateClient(kSessionServer->getServerId(), kSessionServer->getAppManagementSocketName())) @@ -247,6 +250,12 @@ bool SessionServerAppManager::connectSessionServer(const std::shared_ptrgetServerId()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), + "Failed to establish RialtoServerManager - RialtoSessionServer connection for " + "session server with id: %d", + kSessionServer->getServerId()); + TELEMETRY_EVENT_STRING("Rialto Server Manager - SessionServerAppManager", telemetryBuff); kSessionServer->kill(); if (m_healthcheckService) { @@ -307,6 +316,10 @@ bool SessionServerAppManager::changeSessionServerState(const std::string &appNam { RIALTO_SERVER_MANAGER_LOG_ERROR("Change state of %s to %s failed - session server not found.", appName.c_str(), toString(newState)); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Change state of %s to %s failed - session server not found.", + appName.c_str(), toString(newState)); + TELEMETRY_EVENT_STRING("Rialto Server Manager - SessionServerAppManager", telemetryBuff); return false; } sessionServer->setExpectedState(newState); @@ -317,6 +330,10 @@ bool SessionServerAppManager::changeSessionServerState(const std::string &appNam if (!m_ipcController->performSetState(sessionServer->getServerId(), newState)) { RIALTO_SERVER_MANAGER_LOG_ERROR("Change state of %s to %s failed.", appName.c_str(), toString(newState)); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Change state of %s to %s failed.", appName.c_str(), + toString(newState)); + TELEMETRY_EVENT_STRING("Rialto Server Manager - SessionServerAppManager", telemetryBuff); handleStateChangeFailure(sessionServer, newState); return false; } @@ -501,6 +518,10 @@ bool SessionServerAppManager::configureSessionServerWithSocketName(const std::sh { RIALTO_SERVER_MANAGER_LOG_ERROR("Configuration of server with id %d failed - ipc error.", kSessionServer->getServerId()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Configuration of server with id %d failed - ipc error.", + kSessionServer->getServerId()); + TELEMETRY_EVENT_STRING("Rialto Server Manager - SessionServerAppManager", telemetryBuff); return false; } RIALTO_SERVER_MANAGER_LOG_INFO("Configuration of server with id %d succeeded.", kSessionServer->getServerId()); @@ -522,6 +543,10 @@ bool SessionServerAppManager::configureSessionServerWithSocketFd(const std::shar { RIALTO_SERVER_MANAGER_LOG_ERROR("Configuration of server with id %d failed - ipc error.", kSessionServer->getServerId()); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), "Configuration of server with id %d failed - ipc error.", + kSessionServer->getServerId()); + TELEMETRY_EVENT_STRING("Rialto Server Manager - SessionServerAppManager", telemetryBuff); return false; } RIALTO_SERVER_MANAGER_LOG_INFO("Configuration of server with id %d succeeded.", kSessionServer->getServerId()); diff --git a/serverManager/ipc/source/Client.cpp b/serverManager/ipc/source/Client.cpp index c11c0693c..9e50455f2 100644 --- a/serverManager/ipc/source/Client.cpp +++ b/serverManager/ipc/source/Client.cpp @@ -334,6 +334,10 @@ void Client::onDisconnected() const } RIALTO_SERVER_MANAGER_LOG_WARN("Connection to serverId: %d broken, server probably crashed. Starting recovery", m_serverId); + char telemetryBuff[128] = {0}; + snprintf(telemetryBuff, sizeof(telemetryBuff), + "Connection to serverId: %d broken, server probably crashed. Starting recovery", m_serverId); + TELEMETRY_EVENT_STRING("Rialto Server Manager - Client", telemetryBuff); m_sessionServerAppManager->restartServer(m_serverId); } diff --git a/tests/unittests/media/client/ipc/ipcModuleBase/IpcModuleBase.cpp b/tests/unittests/media/client/ipc/ipcModuleBase/IpcModuleBase.cpp index 367367c1b..2c682060e 100644 --- a/tests/unittests/media/client/ipc/ipcModuleBase/IpcModuleBase.cpp +++ b/tests/unittests/media/client/ipc/ipcModuleBase/IpcModuleBase.cpp @@ -86,7 +86,10 @@ void IpcModuleBase::expectIpcApiCallFailure() EXPECT_CALL(*m_blockingClosureMock, wait()).RetiresOnSaturation(); EXPECT_CALL(*m_controllerMock, Failed()).WillOnce(Return(true)).RetiresOnSaturation(); - EXPECT_CALL(*m_controllerMock, ErrorText()).WillOnce(Return("Failed for some reason...")).RetiresOnSaturation(); + EXPECT_CALL(*m_controllerMock, ErrorText()) + .Times(2) + .WillRepeatedly(Return("Failed for some reason...")) + .RetiresOnSaturation(); } void IpcModuleBase::expectIpcApiCallDisconnected()