Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ set(LIBPLAYERGSTINTERFACE_HEADERS
gstplayertaskpool.h
GstHandlerControl.h
InterfacePlayerRDK.h
PlayerTelemetry.h
drm/DrmUtils.h
drm/aes/Aes.h
drm/HlsDrmBase.h
Expand All @@ -172,6 +173,7 @@ install(FILES closedcaptions/CCTrackInfo.h
gstplayertaskpool.h
GstHandlerControl.h
InterfacePlayerRDK.h
PlayerTelemetry.h
SocUtils.h
drm/DrmUtils.h
GstUtils.h
Expand Down Expand Up @@ -219,6 +221,11 @@ set(SOURCES
ProcessHandler.cpp
)

if(CMAKE_PLAYER_TELEMETRY_SUPPORT)
list(APPEND SOURCES PlayerTelemetry.cpp)
add_definitions(-DPLAYER_TELEMETRY_SUPPORT)
endif()

if(NOT (CMAKE_PLATFORM_UBUNTU OR CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
list(APPEND SOURCES
vendor/amlogic/AmlogicSocInterface.cpp
Expand Down
55 changes: 55 additions & 0 deletions InterfacePlayerRDK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
#include "player-xternal-stats.h"
#endif
#include "PlayerUtils.h"
#ifdef PLAYER_TELEMETRY_SUPPORT
#include "PlayerTelemetry.h"
#endif

#define DEFAULT_BUFFERING_TO_MS 10 /**< TimeOut interval to check buffer fullness */
#define DEFAULT_BUFFERING_MAX_MS (1000) /**< max buffering time */
Expand Down Expand Up @@ -1280,19 +1283,71 @@ static GstStateChangeReturn SetStateWithWarnings(GstElement *element, GstState t
case GST_STATE_CHANGE_FAILURE:
MW_LOG_ERR("InterfacePlayerRDK: %s is in FAILURE state : current %s pending %s", SafeName(element).c_str(),gst_element_state_get_name(current), gst_element_state_get_name(pending));
LogStatus(element);
#ifdef PLAYER_TELEMETRY_SUPPORT
{
std::map<std::string, int> i;
std::map<std::string, std::string> s;
std::map<std::string, float> f;
s["cur"] = gst_element_state_get_name(current);
s["pen"] = gst_element_state_get_name(pending);
// GstState is an enum; transmit numeric value (stable for decoding on the backend)
i["tgt"] = static_cast<int>(targetState);
PlayerTelemetry2 telemetry;
telemetry.send("MW_PIPELINE_STATE_CHANGE_FAILURE", i, s, f);
}
#endif
break;
case GST_STATE_CHANGE_SUCCESS:
MW_LOG_DEBUG("InterfacePlayerRDK: %s is in success state : current %s pending %s", SafeName(element).c_str(),gst_element_state_get_name(current), gst_element_state_get_name(pending));
#ifdef PLAYER_TELEMETRY_SUPPORT
{
std::map<std::string, int> i;
std::map<std::string, std::string> s;
std::map<std::string, float> f;
s["cur"] = gst_element_state_get_name(current);
s["pen"] = gst_element_state_get_name(pending);
// GstState is an enum; transmit numeric value (stable for decoding on the backend)
i["tgt"] = static_cast<int>(targetState);
PlayerTelemetry2 telemetry;
telemetry.send("MW_PIPELINE_STATE_CHANGE_SUCCESS", i, s, f);
}
#endif
break;
case GST_STATE_CHANGE_ASYNC:
if(syncOnlyTransition)
{
MW_LOG_MIL("InterfacePlayerRDK: %s state is changing asynchronously : current %s pending %s", SafeName(element).c_str(),gst_element_state_get_name(current), gst_element_state_get_name(pending));
LogStatus(element);
}
#ifdef PLAYER_TELEMETRY_SUPPORT
{
std::map<std::string, int> i;
std::map<std::string, std::string> s;
std::map<std::string, float> f;
s["cur"] = gst_element_state_get_name(current);
s["pen"] = gst_element_state_get_name(pending);
// GstState is an enum; transmit numeric value (stable for decoding on the backend)
i["tgt"] = static_cast<int>(targetState);
PlayerTelemetry2 telemetry;
telemetry.send("MW_PIPELINE_STATE_CHANGE_ASYNC", i, s, f);
}
#endif
break;
default:
MW_LOG_ERR("InterfacePlayerRDK: %s is in an unknown state", SafeName(element).c_str());
#ifdef PLAYER_TELEMETRY_SUPPORT
{
std::map<std::string, int> i;
std::map<std::string, std::string> s;
std::map<std::string, float> f;
s["cur"] = gst_element_state_get_name(current);
s["pen"] = gst_element_state_get_name(pending);
// GstState is an enum; transmit numeric value (stable for decoding on the backend)
i["tgt"] = static_cast<int>(targetState);
PlayerTelemetry2 telemetry;
telemetry.send("MW_PIPELINE_STATE_CHANGE_UNKNOWN", i, s, f);
}
#endif
break;
}

Expand Down
46 changes: 46 additions & 0 deletions PlayerTelemetry.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* If not stated otherwise in this file or this component's license file the
* following copyright and licenses apply:
*
* Copyright 2025 RDK Management
*
* 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.
*/

/**
* @file PlayerTelemetry.cpp
* @brief Implementation of telemetry support for the player interface.
*/

#include "PlayerTelemetry.h"
#include "PlayerLogManager.h"

void PlayerTelemetry2::send(const std::string& marker,
const std::map<std::string, int>& iMap,
const std::map<std::string, std::string>& sMap,
const std::map<std::string, float>& fMap)
{
MW_LOG_MIL("PlayerTelemetry2: %s", marker.c_str());
for (const auto& kv : iMap)
{
MW_LOG_MIL("PlayerTelemetry2: int[%s]=%d", kv.first.c_str(), kv.second);
}
for (const auto& kv : sMap)
{
MW_LOG_MIL("PlayerTelemetry2: str[%s]=%s", kv.first.c_str(), kv.second.c_str());
}
for (const auto& kv : fMap)
{
MW_LOG_MIL("PlayerTelemetry2: float[%s]=%f", kv.first.c_str(), kv.second);
}
}
51 changes: 51 additions & 0 deletions PlayerTelemetry.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* If not stated otherwise in this file or this component's license file the
* following copyright and licenses apply:
*
* Copyright 2025 RDK Management
*
* 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 PLAYER_TELEMETRY_H
#define PLAYER_TELEMETRY_H

/**
* @file PlayerTelemetry.h
* @brief Telemetry support for the player interface.
*/

#include <map>
#include <string>

/**
* @brief Class for sending player telemetry events with typed key-value maps.
*/
class PlayerTelemetry2
{
public:
/**
* @brief Sends a telemetry event with associated data maps.
*
* @param[in] marker The telemetry event name/marker.
* @param[in] iMap Integer key-value pairs associated with the event.
* @param[in] sMap String key-value pairs associated with the event.
* @param[in] fMap Float key-value pairs associated with the event.
*/
void send(const std::string& marker,
const std::map<std::string, int>& iMap,
const std::map<std::string, std::string>& sMap,
const std::map<std::string, float>& fMap);
};

#endif // PLAYER_TELEMETRY_H
Loading