removed queue from appsink
This commit is contained in:
parent
e9a125500e
commit
b9969f746c
1 changed files with 16 additions and 18 deletions
|
@ -16,7 +16,6 @@ pub struct WebcamPipeline {
|
|||
pub queue_app: Element,
|
||||
pub sink_paintable: Element,
|
||||
|
||||
pub queue: Element,
|
||||
pub resize: Element,
|
||||
pub sink_frame: Arc<Mutex<AppSink>>,
|
||||
}
|
||||
|
@ -47,7 +46,12 @@ impl WebcamPipeline {
|
|||
.build()
|
||||
.context(BuildSnafu { element: "tee" })?;
|
||||
|
||||
let queue_app = ElementFactory::make("queue").build().context(BuildSnafu {
|
||||
let queue_app = ElementFactory::make("queue")
|
||||
.property("max-size-time", 1u64)
|
||||
.property("max-size-buffers", 0u32)
|
||||
.property("max-size-bytes", 0u32)
|
||||
.build()
|
||||
.context(BuildSnafu {
|
||||
element: "paintable queue",
|
||||
})?;
|
||||
let sink_paintable = ElementFactory::make("gtk4paintablesink")
|
||||
|
@ -57,9 +61,9 @@ impl WebcamPipeline {
|
|||
element: "gtkpaintablesink",
|
||||
})?;
|
||||
|
||||
let queue = ElementFactory::make("queue").build().context(BuildSnafu {
|
||||
element: "appsink queue",
|
||||
})?;
|
||||
// queue.connect_closure("overrun", false, glib::closure!(|queue: Element| {
|
||||
// println!("The queue is full!");
|
||||
// }));
|
||||
|
||||
let resize = ElementFactory::make("videoscale")
|
||||
.build()
|
||||
|
@ -67,7 +71,7 @@ impl WebcamPipeline {
|
|||
element: "videoscale",
|
||||
})?;
|
||||
|
||||
let caps_string = "video/x-raw,format=RGB,width=640,height=480,max-buffers=1,drop=true";
|
||||
let caps_string = "video/x-raw,format=RGB,width=640,height=480";
|
||||
// let caps_string = String::from("video/x-raw,format=RGB,max-buffers=1,drop=true");
|
||||
let appsrc_caps = gstreamer::Caps::from_str(caps_string).context(BuildSnafu {
|
||||
element: "appsink caps",
|
||||
|
@ -76,7 +80,7 @@ impl WebcamPipeline {
|
|||
let sink_frame = AppSink::builder()
|
||||
.name("frame_output")
|
||||
.sync(false)
|
||||
.max_buffers(1u32)
|
||||
.max_buffers(3u32)
|
||||
.drop(true)
|
||||
.caps(&appsrc_caps)
|
||||
.build();
|
||||
|
@ -92,7 +96,6 @@ impl WebcamPipeline {
|
|||
&queue_app,
|
||||
&sink_paintable,
|
||||
&resize,
|
||||
&queue,
|
||||
&sink_frame.upcast_ref(),
|
||||
])
|
||||
.context(LinkSnafu {
|
||||
|
@ -147,23 +150,19 @@ impl WebcamPipeline {
|
|||
.ok_or(PipelineError::PadRequestError {
|
||||
element: "tee pad 2".to_string(),
|
||||
})?;
|
||||
let appsink_queue_sinkpad =
|
||||
queue
|
||||
let appsink_resize_sinkpad =
|
||||
resize
|
||||
.static_pad("sink")
|
||||
.ok_or(PipelineError::PadRequestError {
|
||||
element: "appsink queue".to_string(),
|
||||
})?;
|
||||
tee_src_2
|
||||
.link(&appsink_queue_sinkpad)
|
||||
.link(&appsink_resize_sinkpad)
|
||||
.context(PadLinkSnafu {
|
||||
from: "tee src pad 2",
|
||||
to: "appsink queue sinkpad",
|
||||
})?;
|
||||
|
||||
queue.link(&resize).context(LinkSnafu {
|
||||
from: "appsink queue",
|
||||
to: "videoscale",
|
||||
})?;
|
||||
resize.link(&sink_frame).context(LinkSnafu {
|
||||
from: "videoscale",
|
||||
to: "appsink",
|
||||
|
@ -177,7 +176,6 @@ impl WebcamPipeline {
|
|||
queue_app,
|
||||
sink_paintable,
|
||||
resize,
|
||||
queue,
|
||||
sink_frame: Arc::new(Mutex::new(sink_frame)),
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue