forked from WebKit/WebKit-http
-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
680d0af
commit 0a6461e
Showing
16 changed files
with
614 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") | ||
set(TELEMETRY_DIR "${THIRDPARTY_DIR}/telemetry") | ||
|
||
set(TELEMETRY_INCLUDE_DIRECTORIES | ||
"${TELEMETRY_DIR}/include" | ||
"${CMAKE_BINARY_DIR}" | ||
) | ||
|
||
include_directories("${TELEMETRY_INCLUDE_DIRECTORIES}") | ||
|
||
if (USE_RDK_TELEMETRY) | ||
find_package(OdhErrTelemetry) | ||
if (NOT OdhErrTelemetry_FOUND) | ||
message(FATAL_ERROR "OdhErrTelemetry is needed for USE_RDK_TELEMETRY") | ||
endif () | ||
|
||
find_package(OdhOttTelemetry) | ||
if (NOT OdhOttTelemetry_FOUND) | ||
message(FATAL_ERROR "OdhOttTelemetry is needed for USE_RDK_TELEMETRY") | ||
endif () | ||
|
||
include_directories( | ||
${OdhErrTelemetry_INCLUDE_DIR} | ||
${OdhOttTelemetry_INCLUDE_DIR} | ||
) | ||
|
||
set(TELEMETRY_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 | ||
) | ||
endif () | ||
|
||
add_library(telemetry STATIC ${TELEMETRY_SOURCES}) | ||
target_link_libraries(telemetry PRIVATE ${TELEMETRY_LIBRARIES}) |
45 changes: 45 additions & 0 deletions
45
Source/ThirdParty/telemetry/cmake/FindOdhErrTelemetry.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#============================================================================ | ||
# Copyright (c) 2023 Liberty Global | ||
#============================================================================ | ||
|
||
# - Try to find ODH telemetry | ||
# | ||
# Once done this will define | ||
# OdhErrTelemetry_FOUND - System has the component | ||
# OdhErrTelemetry_INCLUDE_DIRS - Component include directories | ||
# OdhErrTelemetry_LIBRARIES - Libraries needed to use the component | ||
|
||
find_package(PkgConfig QUIET) | ||
|
||
find_path(OdhErrTelemetry_INCLUDE_DIR | ||
NAMES odherr.h | ||
HINTS ${TARGET_SYS_ROOT}/usr/include/rdk/libodherr | ||
) | ||
|
||
find_library(OdhErrTelemetry_LIBRARY | ||
NAMES odherr | ||
HINTS ${TARGET_SYS_ROOT}/usr/lib | ||
) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(OdhErrTelemetry | ||
FOUND_VAR OdhErrTelemetry_FOUND | ||
REQUIRED_VARS OdhErrTelemetry_LIBRARY OdhErrTelemetry_INCLUDE_DIR | ||
) | ||
|
||
if (OdhErrTelemetry_LIBRARY AND NOT TARGET OdhErrTelemetry::OdhErrTelemetry) | ||
add_library(OdhErrTelemetry::OdhErrTelemetry UNKNOWN IMPORTED GLOBAL) | ||
set_target_properties(OdhErrTelemetry::OdhErrTelemetry PROPERTIES | ||
IMPORTED_LOCATION "${OdhErrTelemetry_LIBRARY}" | ||
INTERFACE_COMPILE_OPTIONS "${OdhErrTelemetry_COMPILE_OPTIONS}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${OdhErrTelemetry_INCLUDE_DIR}" | ||
) | ||
endif () | ||
|
||
mark_as_advanced(OdhErrTelemetry_INCLUDE_DIR OdhErrTelemetry_LIBRARY) | ||
|
||
if (OdhErrTelemetry_FOUND) | ||
set(OdhErrTelemetry_INCLUDE_DIRS ${OdhErrTelemetry_INCLUDE_DIR}) | ||
set(OdhErrTelemetry_LIBRARIES ${OdhErrTelemetry_LIBRARY}) | ||
set(OdhErrTelemetry_PKG_EXTRA_LIBS "-lodherr") | ||
endif () |
45 changes: 45 additions & 0 deletions
45
Source/ThirdParty/telemetry/cmake/FindOdhOttTelemetry.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#============================================================================ | ||
# Copyright (c) 2023 Liberty Global | ||
#============================================================================ | ||
|
||
# - Try to find ODH telemetry | ||
# | ||
# Once done this will define | ||
# OdhOttTelemetry_FOUND - System has the component | ||
# OdhOttTelemetry_INCLUDE_DIRS - Component include directories | ||
# OdhOttTelemetry_LIBRARIES - Libraries needed to use the component | ||
|
||
find_package(PkgConfig QUIET) | ||
|
||
find_path(OdhOttTelemetry_INCLUDE_DIR | ||
NAMES odhott_wl.h | ||
HINTS ${TARGET_SYS_ROOT}/usr/include/odhott | ||
) | ||
|
||
find_library(OdhOttTelemetry_LIBRARY | ||
NAMES odhott | ||
HINTS ${TARGET_SYS_ROOT}/usr/lib | ||
) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(OdhOttTelemetry | ||
FOUND_VAR OdhOttTelemetry_FOUND | ||
REQUIRED_VARS OdhOttTelemetry_LIBRARY OdhOttTelemetry_INCLUDE_DIR | ||
) | ||
|
||
if (OdhOttTelemetry_LIBRARY AND NOT TARGET OdhOttTelemetry::OdhOttTelemetry) | ||
add_library(OdhOttTelemetry::OdhOttTelemetry UNKNOWN IMPORTED GLOBAL) | ||
set_target_properties(OdhOttTelemetry::OdhOttTelemetry PROPERTIES | ||
IMPORTED_LOCATION "${OdhOttTelemetry_LIBRARY}" | ||
INTERFACE_COMPILE_OPTIONS "${OdhOttTelemetry_COMPILE_OPTIONS}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${OdhOttTelemetry_INCLUDE_DIR}" | ||
) | ||
endif () | ||
|
||
mark_as_advanced(OdhOttTelemetry_INCLUDE_DIR OdhOttTelemetry_LIBRARY) | ||
|
||
if (OdhOttTelemetry_FOUND) | ||
set(OdhOttTelemetry_INCLUDE_DIRS ${OdhOttTelemetry_INCLUDE_DIR}) | ||
set(OdhOttTelemetry_LIBRARIES ${OdhOttTelemetry_LIBRARY}) | ||
set(OdhOttTelemetry_PKG_EXTRA_LIBS "-lodhott") | ||
endif () |
23 changes: 23 additions & 0 deletions
23
Source/ThirdParty/telemetry/include/DummyTelemetryReport.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#pragma once | ||
|
||
#include <stdarg.h> | ||
#include <string> | ||
|
||
#if defined(RDK_TELEMETRY) | ||
#include "RdkTelemetryReport.h" | ||
using TelemetryImpl = Telemetry::RdkTelemetryReport; | ||
#else | ||
#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, ...); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
Oops, something went wrong.