Skip to content

Commit

Permalink
ONEM-38082: Redesigned telemetry module
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-mielczarczyk-red committed Dec 13, 2024
1 parent afa6c7d commit 456aa86
Show file tree
Hide file tree
Showing 17 changed files with 406 additions and 303 deletions.
6 changes: 5 additions & 1 deletion Source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ if (NOT USE_SYSTEM_MALLOC)
add_subdirectory(bmalloc)
endif ()

add_subdirectory(WTF)
add_subdirectory(ThirdParty/telemetry)
if (USE_RDK_TELEMETRY)
add_definitions(-DRDK_TELEMETRY)
endif ()

add_subdirectory(WTF)

if (USE_CAPSTONE)
add_subdirectory(ThirdParty/capstone)
Expand Down
25 changes: 15 additions & 10 deletions Source/ThirdParty/telemetry/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@ set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(TELEMETRY_DIR "${THIRDPARTY_DIR}/telemetry")

set(TELEMETRY_INCLUDE_DIRECTORIES
"${TELEMETRY_DIR}/src"
"${TELEMETRY_DIR}/include"
"${CMAKE_BINARY_DIR}"
)

set(TELEMETRY_SOURCES
${TELEMETRY_DIR}/src/TelemetryReport.cpp
)

include_directories("${TELEMETRY_INCLUDE_DIRECTORIES}")

if (USE_RDK_TELEMETRY)
Expand All @@ -24,15 +20,24 @@ if (USE_RDK_TELEMETRY)
endif ()

include_directories(
${OdhErrTelemetry_INCLUDE_DIR}
${OdhOttTelemetry_INCLUDE_DIR}
${OdhErrTelemetry_INCLUDE_DIR}
${OdhOttTelemetry_INCLUDE_DIR}
)

set(TELEMETRY_LIBRARIES
${OdhErrTelemetry_LIBRARIES}
${OdhOttTelemetry_LIBRARIES}
${OdhErrTelemetry_LIBRARIES}
${OdhOttTelemetry_LIBRARIES}
)

set(TELEMETRY_SOURCES
${TELEMETRY_DIR}/src/RdkTelemetryReport.cpp
)

add_definitions(-DRDK_TELEMETRY)
else ()
set(TELEMETRY_SOURCES
${TELEMETRY_DIR}/src/DummyTelemetryReport.cpp
)
add_definitions(-DUSE_RDK_TELEMETRY)
endif ()

add_library(telemetry STATIC ${TELEMETRY_SOURCES})
Expand Down
23 changes: 23 additions & 0 deletions Source/ThirdParty/telemetry/include/DummyTelemetryReport.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once

#include "ITelemetry.h"

namespace Telemetry {

class DummyTelemetryReport: public IReport {

public:
void reportPlaybackState(
AVPipelineState state,
const std::string &additionalInfo = "",
MediaType mediaType = MediaType::NONE) override;
void reportDrmInfo(
DrmType drmType,
const std::string &additionalInfo = "") override;
void reportWaylandInfo(
const IWaylandInfoGetter &getter,
WaylandAction action,
WaylandGraphicsState gfxState,
WaylandInputsState inputsState) override;
};
}
100 changes: 100 additions & 0 deletions Source/ThirdParty/telemetry/include/ITelemetry.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#pragma once

#include <string>

namespace Telemetry {

/*
* Helper function to get some telemetry data from Wayland.
*/
class IWaylandInfoGetter {
public:
/*
* Don't include:
* #include <EGL/egl.h>
* #include <EGL/eglplatform.h>
* since there are import order issues.
* Defining needed types as void*, like WebKit does.
*/
typedef void *EGLConfig;
typedef void *EGLContext;
typedef void *EGLDisplay;
typedef void *EGLSurface;

virtual EGLDisplay getEGLDisplay() const = 0;
virtual EGLConfig getEGLConfig() const = 0;
virtual EGLSurface getEGLSurface() const = 0;
virtual EGLContext getEGLContext() const = 0;
virtual unsigned int getWindowWidth() const = 0;
virtual unsigned int getWindowHeight() const = 0;
};

class IReport
{
public:
enum class AVPipelineState {
CREATE,
PLAY,
PAUSE,
STOP,
DESTROY,
FIRST_FRAME_DECODED,
END_OF_STREAM,
DECRYPT_ERROR,
PLAYBACK_ERROR,
DRM_ERROR,
ERROR,
SEEK_START,
SEEK_DONE,
VIDEO_RESOLUTION_CHANGED,
UNKNOWN
};

enum class MediaType {
AUDIO,
VIDEO,
NONE
};

enum class DrmType {
PLAYREADY,
WIDEVINE,
NONE,
UNKNOWN
};

enum class WaylandAction
{
INIT_GFX,
DEINIT_GFX,
INIT_INPUTS,
DEINIT_INPUTS
};

enum class WaylandGraphicsState
{
GFX_NOT_INITIALIZED,
GFX_INITIALIZED
};

enum class WaylandInputsState
{
INPUTS_NOT_INITIALIZED,
INPUTS_INITIALIZED
};

virtual ~IReport() = default;
virtual void reportPlaybackState(
AVPipelineState state,
const std::string &additionalInfo,
MediaType mediaType) = 0;
virtual void reportDrmInfo(
DrmType drmType,
const std::string &additionalInfo) = 0;
virtual void reportWaylandInfo(
const IWaylandInfoGetter &getter,
WaylandAction action,
WaylandGraphicsState gfxState,
WaylandInputsState inputsState) = 0;
};
}
24 changes: 24 additions & 0 deletions Source/ThirdParty/telemetry/include/RdkTelemetryReport.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#pragma once

#include <string>
#include "ITelemetry.h"

namespace Telemetry {

class RdkTelemetryReport: public IReport {

public:
void reportPlaybackState(
AVPipelineState state,
const std::string &additionalInfo = "",
MediaType mediaType = MediaType::NONE) override;
void reportDrmInfo(
DrmType drmType,
const std::string &additionalInfo = "") override;
void reportWaylandInfo(
const IWaylandInfoGetter &getter,
WaylandAction action,
WaylandGraphicsState gfxState,
WaylandInputsState inputsState) override;
};
}
21 changes: 21 additions & 0 deletions Source/ThirdParty/telemetry/include/TelemetryReport.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#pragma once

#include <stdarg.h>
#include <string>

#if defined(RDK_TELEMETRY)
#include "RdkTelemetryReport.h"
using TelemetryImpl = Telemetry::RdkTelemetryReport;
#else
#error "dupa!"
#include "DummyTelemetryReport.h"
using TelemetryImpl = Telemetry::DummyTelemetryReport;
#endif

namespace Telemetry
{
void init(const std::string &name = "WebKitBrowser");
void deinit();
void reportErrorV(const char* file, int line, const char* function, const char* format, va_list args);
void reportError(const char* file, int line, const char* function, const char* format, ...);
}
53 changes: 53 additions & 0 deletions Source/ThirdParty/telemetry/src/DummyTelemetryReport.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#include "TelemetryReport.h"

namespace Telemetry {

void init(const std::string &name) {
(void)name;
}

void deinit() {
}

void reportErrorV(const char* file, int line, const char* function, const char* format, va_list args) {
(void)file;
(void)line;
(void)function;
(void)format;
(void)args;
}

void reportError(const char* file, int line, const char* function, const char* format, ...) {
(void)file;
(void)line;
(void)function;
(void)format;
}

void DummyTelemetryReport::reportPlaybackState(
AVPipelineState state,
const std::string &additionalInfo,
MediaType mediaType) {
(void)state;
(void)additionalInfo;
(void)mediaType;
}

void DummyTelemetryReport::reportDrmInfo(
DrmType drmType,
const std::string &additionalInfo) {
(void)drmType;
(void)additionalInfo;
}

void DummyTelemetryReport::reportWaylandInfo(
const IWaylandInfoGetter &getter,
WaylandAction action,
WaylandGraphicsState gfxState,
WaylandInputsState inputsState) {
(void)getter;
(void)action;
(void)gfxState;
(void)inputsState;
}
}
Loading

0 comments on commit 456aa86

Please sign in to comment.