mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-11 12:46:29 +00:00
9b96cfc452
Contrary to the existing Task Sink, the Async and Sync Mutex Sinks handle buffers in the `PadSinkHandler` directly. The Async Mutex Sink uses an async Mutex for the `PadSinkHandlerInner` while the Sync Mutex Sink uses... a sync Mutex. All Sinks share the same settings and stats manager. Use the `--sink` command line option to select the sink (default is `sync-mutex` since it allows evaluating the framework with as little overhead as possible. Also apply various fixes: - Only keep the segment start instead of the full `Segment`. This helps with cache locality (`Segment` is a plain struct with many fields) and avoids downcasting the generic `Segment` upon each buffer handling. - Box the `Stat`s. This should improve cache locality a bit. - Fix EOS handling which took ages for no benefits in this particular use case. - Use a macro to raise log level in the main element. - Move error handling during item processing in `handle_loop_error`. This function was precisely designed for this and it should reduce the `handle_item`'s Future size.
66 lines
1.7 KiB
Rust
66 lines
1.7 KiB
Rust
use super::super::CAT;
|
|
use clap::Parser;
|
|
|
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, clap::ValueEnum)]
|
|
pub enum Sink {
|
|
/// Item handling in PadHandler with async Mutex
|
|
AsyncMutex,
|
|
/// Item handling in PadHandler with sync Mutex
|
|
SyncMutex,
|
|
/// Item handling in runtime::Task
|
|
Task,
|
|
}
|
|
|
|
impl Sink {
|
|
pub fn element_name(self) -> &'static str {
|
|
use super::super::sink;
|
|
use Sink::*;
|
|
match self {
|
|
AsyncMutex => sink::ASYNC_MUTEX_ELEMENT_NAME,
|
|
SyncMutex => sink::SYNC_MUTEX_ELEMENT_NAME,
|
|
Task => sink::TASK_ELEMENT_NAME,
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Parser, Debug)]
|
|
#[clap(version)]
|
|
#[clap(
|
|
about = "Standalone pipeline threadshare runtime test. Use `GST_DEBUG=ts-standalone*:4` for stats"
|
|
)]
|
|
pub struct Args {
|
|
/// Parallel streams to process.
|
|
#[clap(short, long, default_value_t = 5000)]
|
|
pub streams: u32,
|
|
|
|
/// Threadshare groups.
|
|
#[clap(short, long, default_value_t = 2)]
|
|
pub groups: u32,
|
|
|
|
/// Threadshare Context wait in ms (max throttling duration).
|
|
#[clap(short, long, default_value_t = 20)]
|
|
pub wait: u32,
|
|
|
|
/// Buffer push period in ms.
|
|
#[clap(short, long, default_value_t = 20)]
|
|
pub push_period: u32,
|
|
|
|
/// Number of buffers per stream to output before sending EOS (-1 = unlimited).
|
|
#[clap(short, long, default_value_t = 5000)]
|
|
pub num_buffers: i32,
|
|
|
|
/// The Sink variant to use.
|
|
#[clap(long, value_enum, default_value_t = Sink::SyncMutex)]
|
|
pub sink: Sink,
|
|
|
|
/// Disables statistics logging.
|
|
#[clap(short, long)]
|
|
pub disable_stats_log: bool,
|
|
}
|
|
|
|
pub fn args() -> Args {
|
|
let args = Args::parse();
|
|
gst::info!(CAT, "{:?}", args);
|
|
|
|
args
|
|
}
|