Gstreamer Debugging 방법

 Gstreamer Debugging 

1. Debug Export

GST_DEBUG export 하거나 실행시 Define을 같이 전달할 경우 Level에 맞게 Debug Log를 확인할 수 있다.

Example 1)
    $ export GST_DEBUG=2

Example 2)
    $ GST_DEBUG=2 gst-launch-1.0 ...


1.1 Level

자세한 레벨은 아래와 같다
| # | Name    | Description                                                    |
|---|---------|----------------------------------------------------------------|
| 0 | none    | No debug information is output.                                |
| 1 | ERROR   | Logs all fatal errors. These are errors that do not allow the  |
|   |         | core or elements to perform the requested action. The          |
|   |         | application can still recover if programmed to handle the      |
|   |         | conditions that triggered the error.                           |
| 2 | WARNING | Logs all warnings. Typically these are non-fatal, but          |
|   |         | user-visible problems are expected to happen.                  |
| 3 | FIXME   | Logs all "fixme" messages. Those typically that a codepath that|
|   |         | is known to be incomplete has been triggered. It may work in   |
|   |         | most cases, but may cause problems in specific instances.      |
| 4 | INFO    | Logs all informational messages. These are typically used for  |
|   |         | events in the system that only happen once, or are important   |
|   |         | and rare enough to be logged at this level.                    |
| 5 | DEBUG   | Logs all debug messages. These are general debug messages for  |
|   |         | events that happen only a limited number of times during an    |
|   |         | object's lifetime; these include setup, teardown, change of    |
|   |         | parameters, etc.                                               |
| 6 | LOG     | Logs all log messages. These are messages for events that      |
|   |         | happen repeatedly during an object's lifetime; these include   |
|   |         | streaming and steady-state conditions. This is used for log    |
|   |         | messages that happen on every buffer in an element for example.|
| 7 | TRACE   | Logs all trace messages. Those are message that happen very    |
|   |         | very often. This is for example is each time the reference     |
|   |         | count of a GstMiniObject, such as a GstBuffer or GstEvent, is  |
|   |         | modified.                                                      |
| 9 | MEMDUMP | Logs all memory dump messages. This is the heaviest logging and|
|   |         | may include dumping the content of blocks of memory.           |
+------------------------------------------------------------------------------+


2. Information Format

Debug Log의 Format은 아래와 같다
| Example          | Explained                                                 |
|------------------|-----------------------------------------------------------|
|0:00:00.868050000 | Time stamp in HH:MM:SS.sssssssss format since the start of|
|                  | the program.                                              |
|1592              | Process ID from which the message was issued. Useful when |
|                  | your problem involves multiple processes.                 |
|09F62420          | Thread ID from which the message was issued. Useful when  |
|                  | your problem involves multiple threads.                   |
|WARN              | Debug level of the message.                               |
|filesrc           | Debug Category of the message.                            |
|gstfilesrc.c:1044 | Source file and line in the GStreamer source code where   |
|                  | this message was issued.                                  |
|gst_file_src_start| Function that issued the message.                         |
|<filesrc0>        | Name of the object that issued the message. It can be an  |
|                  | element, a pad, or something else. Useful when you have   |
|                  | multiple elements of the same kind and need to distinguish|
|                  | among them. Naming your elements with the name property   |
|                  | makes this debug output more readable but GStreamer       |
|                  | assigns each new element a unique name by default.        |
| error: No such   |                                                           |
| file ....        | The actual message.                                       |
+------------------------------------------------------------------------------+


2. Graviz Graph 

Pipeline을 이미지르 취득하는 방법이 있으며, 아래와 같다.

2.1. graphviz 설치

$ apt install graphviz

2.2. export

$ export GST_DEBUG_DUMP_DOT_DIR ./tmp/ 

2.3. run

$ gst-launch-1.0 ...

2.4. dot file check

$ ls -all ./tmp/ | grep dot

2.5. image conversion

$ got -Tpng ./tmp/{File Name} > ./tmp/{File Name}.png


2.6 Converting Script

#!/bin/bash

DOT_FILES_DIR="."
PNG_FILES_DIR="."

DOT_FILES=`ls $DOT_FILES_DIR | grep dot`

for D in $DOT_FILES; do
        PNG_FILE=`echo $D | sed s/.dot/.png/`
        echo "dot -Tpng $DOT_FILES_DIR/$D > $PNG_FILES_DIR/$PNG_FILE"
        dot -Tpng $DOT_FILES_DIR/$D > $PNG_FILES_DIR/$PNG_FILE

done


위와 같이 실행시 ./tmp/ 경로에 png 파일이 존재하는 것을 확인할 수 있다

출처 : https://gstreamer.freedesktop.org/documentation/tutorials/basic/debugging-tools.html?gi-language=c 

댓글

가장 많이 본 글