1.3.12. Debugging
The Proximie SDK has some features to help troubleshoot or diagnose issues with applications using the SDK.
Logging
The SDK has a logging system that can be configured to output log messages at different levels of detail. For more information on logging, see the SDK Logging section.
PxMedia
diagnostics
Use the PxMedia::Configuration
object
to configure SDK diagnostics and logging for media streaming.
Configuration
is a simple singleton accessed as follows:
// Get the configuration singleton auto& config = PxMedia::Configuration::get();
Configuring GStreamer
Use the gstreamerDebugLevel()
function to set the GStreamer debug level.
Note that the debug level is the GStreamer library debug level type
GstDebugLevel,
not the Proximie SDK logging severity level.
You may also set the target of the GStreamer debug output using
gstreamerLogTarget()
.
You may choose either
GStreamerLogger::PXLOGGER
to log to the Proximie SDK logging system, or
GStreamerLogger::CONSOLE
for standard output. The default is to output to standard output.
// Set the GStreamer debug level config.gstreamerDebugLevel(GST_LEVEL_DEBUG); // Set the GStreamer log target config.gstreamerLogTarget(PxMedia::Configuration::GStreamerLogger::PXLOGGER);
PxMedia
diagnostics folder
Certain diagnostic functions can write files to a folder for further analysis (e.g. GStreamer pipeline graphs - see below).
You may set the target folder for these files using
PxMedia::Configuration::diagnosticsFolder
.
If no folder has been set, the configuration will default to a standard system temp folder,
which typically differs depending on operating system and environment.
Feed debugging
Pipeline output
The SDK will output pipeline details to the logging system, using the
PxLogger::LogSeverity
severity level as INFO
.
By default this logging level is enabled, so you should see pipeline details in
the log output unless you have altered the logging level.
Pipeline graphs
IMPORTANT
This feature is only intended for debugging purposes and should not be used in final/production applications. Graph generation is a non-trivial operation and could impact performance of the application.
Feed objects that have a pipeline running can generate a graph of the underlying GStreamer pipeline for debugging and diagnostics.
Internally, this uses the GStreamer GStreamer debugging function as described in gst_debug_bin_to_dot_data.
The graph data is in the standard DOT graph description format.
The application can either obtain the graph data as a text string using getPipelineGraph()
or request it be written to a file directly using writePipelineGraphToFile()
.
When using file output, you provide a file name which may be absolute or relative to
the PxMedia::Configuration
diagnostics folder
as mentioned above.
feed->onFeedStarted([](auto& feed) { std::cout << "Feed " << feed->streamId() << " started playing" << std::endl; auto path = feed->writePipelineGraphToFile("feed-" + feed->label() + ".dot"); std::cout << "Wrote pipeline graph file to " << path.value() << std::endl; });
You may customise the detail level of the graph output using the function variants
getPipelineGraphWithDetails()
and
writePipelineGraphWithDetailsToFile()
,
both of which take the GStreamer detail constants as outline in
GstDebugGraphDetails.`
There are various tools that read DOT files, e.g. to convert to a PNG:
dot -Tpng feed-graph.dot -o feed-graph.png
Note
The dot command is part of the Graphviz suite of tools.