2016-12-05 21:12:24 +00:00
|
|
|
# Stream Status
|
|
|
|
|
|
|
|
This document describes the design and use cases for the stream status
|
|
|
|
messages.
|
|
|
|
|
2016-12-30 08:33:16 +00:00
|
|
|
`STREAM_STATUS` messages are posted on the bus when the state of a
|
|
|
|
streaming thread changes. The purpose of this messages is to allow the
|
2016-12-05 21:12:24 +00:00
|
|
|
application to interact with the streaming thread properties, such as
|
|
|
|
the thread priority or the threadpool to use.
|
|
|
|
|
2016-12-30 08:33:16 +00:00
|
|
|
## Requirements and scenarios
|
|
|
|
|
2016-12-05 21:12:24 +00:00
|
|
|
We accommodate for the following requirements:
|
|
|
|
|
|
|
|
- Application is informed when a streaming thread is about to be
|
|
|
|
created. It should be possible for the application to suggest a
|
2016-12-30 08:33:16 +00:00
|
|
|
custom `GstTaskPool`.
|
2016-12-05 21:12:24 +00:00
|
|
|
|
|
|
|
- Application is informed when the status of a streaming thread is
|
|
|
|
changed. This can be interesting for GUI application that want to
|
|
|
|
visualize the status of the streaming threads
|
|
|
|
(playing/paused/stopped)
|
|
|
|
|
|
|
|
- Application is informed when a streaming thread is destroyed.
|
|
|
|
|
|
|
|
We allow for the following scenarios:
|
|
|
|
|
|
|
|
- Elements require a specific (internal) streaming thread to operate
|
|
|
|
or the application can create/specify a thread for the element.
|
|
|
|
|
|
|
|
- Elements allow the application to configure a priority on the
|
|
|
|
threads.
|
|
|
|
|
|
|
|
## Use cases
|
|
|
|
|
|
|
|
- boost the priority of the udp receiver streaming thread
|
|
|
|
|
|
|
|
```
|
2016-12-30 08:33:16 +00:00
|
|
|
.--------. .-------. .------. .-------.
|
|
|
|
| udpsrc | | depay | | adec | | asink |
|
|
|
|
| src->sink src->sink src->sink |
|
|
|
|
'--------' '-------' '------' '-------'
|
2016-12-05 21:12:24 +00:00
|
|
|
```
|
|
|
|
|
2016-12-30 08:33:16 +00:00
|
|
|
- when going from `READY` to `PAUSED` state, udpsrc will require a
|
2016-12-05 21:12:24 +00:00
|
|
|
streaming thread for pushing data into the depayloader. It will
|
2016-12-30 08:33:16 +00:00
|
|
|
post a `STREAM_STATUS` message indicating its requirement for a
|
2016-12-05 21:12:24 +00:00
|
|
|
streaming thread.
|
|
|
|
|
2016-12-30 08:33:16 +00:00
|
|
|
- The application will usually react to the `STREAM_STATUS`
|
2016-12-05 21:12:24 +00:00
|
|
|
messages with a sync bus handler.
|
|
|
|
|
2016-12-30 08:33:16 +00:00
|
|
|
- The application can configure the `GstTask` with a custom
|
|
|
|
`GstTaskPool` to manage the streaming thread or it can ignore the
|
|
|
|
message which will make the element use its default `GstTaskPool`.
|
2016-12-05 21:12:24 +00:00
|
|
|
|
2016-12-30 08:33:16 +00:00
|
|
|
- The application can react to the `ENTER/LEAVE` stream status
|
2016-12-05 21:12:24 +00:00
|
|
|
message to configure the thread right before it is
|
|
|
|
started/stopped. This can be used to configure the thread
|
|
|
|
priority.
|
|
|
|
|
2016-12-30 08:33:16 +00:00
|
|
|
- Before the `GstTask` is changed state (start/pause/stop) a
|
|
|
|
`STREAM_STATUS` message is posted that can be used by the
|
2016-12-05 21:12:24 +00:00
|
|
|
application to keep track of the running streaming threads.
|
|
|
|
|
|
|
|
## Messages
|
|
|
|
|
2016-12-30 08:33:16 +00:00
|
|
|
The existing `STREAM_STATUS` message will be further defined and implemented in
|
2016-12-05 21:12:24 +00:00
|
|
|
(selected) elements. The following fields will be contained in the message:
|
|
|
|
|
2016-12-30 08:33:16 +00:00
|
|
|
- **`type`**, `GST_TYPE_STREAM_STATUS_TYPE`:
|
2016-12-05 21:12:24 +00:00
|
|
|
|
|
|
|
- a set of types to control the lifecycle of the thread:
|
2016-12-30 08:33:16 +00:00
|
|
|
`GST_STREAM_STATUS_TYPE_CREATE`: a new streaming thread is going
|
2016-12-05 21:12:24 +00:00
|
|
|
to be created. The application has the chance to configure a custom
|
2016-12-30 08:33:16 +00:00
|
|
|
thread. `GST_STREAM_STATUS_TYPE_ENTER`: the streaming thread is
|
2016-12-05 21:12:24 +00:00
|
|
|
about to enter its loop function for the first time.
|
2016-12-30 08:33:16 +00:00
|
|
|
`GST_STREAM_STATUS_TYPE_LEAVE`: the streaming thread is about to
|
|
|
|
leave its loop. `GST_STREAM_STATUS_TYPE_DESTROY`: a streaming
|
2016-12-05 21:12:24 +00:00
|
|
|
thread is destroyed
|
|
|
|
|
|
|
|
- A set of types to control the state of the threads:
|
2016-12-30 08:33:16 +00:00
|
|
|
`GST_STREAM_STATUS_TYPE_START`: a streaming thread is started
|
|
|
|
`GST_STREAM_STATUS_TYPE_PAUSE`: a streaming thread is paused
|
|
|
|
`GST_STREAM_STATUS_TYPE_STOP`: a streaming thread is stopped
|
2016-12-05 21:12:24 +00:00
|
|
|
|
2016-12-30 08:33:16 +00:00
|
|
|
- **`owner`**: `GST_TYPE_ELEMENT`: The owner element of the thread. The
|
2016-12-05 21:12:24 +00:00
|
|
|
message source will contain the pad (or one of the pads) that will
|
|
|
|
produce data by this thread. If this thread does not produce data on
|
|
|
|
a pad, the message source will contain the owner as well. The idea
|
|
|
|
is that the application should be able to see from the element/pad
|
|
|
|
what function this thread has in the context of the application and
|
2018-09-13 04:24:24 +00:00
|
|
|
configure the thread appropriately.
|
2016-12-05 21:12:24 +00:00
|
|
|
|
2016-12-30 08:33:16 +00:00
|
|
|
- **`object`**: `G_TYPE`, `GstTask/GThread`: A `GstTask/GThread` controlling
|
2016-12-05 21:12:24 +00:00
|
|
|
this streaming thread.
|
|
|
|
|
2016-12-30 08:33:16 +00:00
|
|
|
- **`flow-return`**: `GstFlowReturn`: A status code for why the thread state
|
2016-12-05 21:12:24 +00:00
|
|
|
changed. when threads are created and started, this is usually
|
2016-12-30 08:33:16 +00:00
|
|
|
`GST_FLOW_OK` but when they are stopping it contains the reason code
|
2016-12-05 21:12:24 +00:00
|
|
|
why it stopped.
|
|
|
|
|
2016-12-30 08:33:16 +00:00
|
|
|
- **`reason`**: `G_TYPE_STRING`: A string describing the reason why the
|
2016-12-05 21:12:24 +00:00
|
|
|
thread started/stopped/paused. Can be NULL if no reason is given.
|
|
|
|
|
|
|
|
## Events
|
|
|
|
|
|
|
|
FIXME
|