Trying to get segment data

This commit is contained in:
Rafael Caricio 2021-05-13 10:34:22 +02:00
parent 4ad2b7f850
commit 8ffc3b65e6
Signed by: rafaelcaricio
GPG key ID: 3C86DBCE8E93C947
2 changed files with 14 additions and 6 deletions

View file

@ -488,9 +488,9 @@ impl ObjectImpl for FlexHlsSink {
.expect("Could not make element splitmuxsink");
let app_sink = gst::ElementFactory::make("appsink", Some("giostreamsink_replacement_sink"))
.expect("Could not make element appsink");
app_sink.set_property("sync", &false).unwrap();
app_sink.set_property("async", &false).unwrap();
app_sink.set_property("emit-signals", &true).unwrap();
// app_sink.set_property("sync", &false).unwrap();
// app_sink.set_property("async", &false).unwrap();
// app_sink.set_property("emit-signals", &true).unwrap();
let mux = gst::ElementFactory::make("mpegtsmux", Some("mpeg-ts_mux"))
.expect("Could not make element mpegtsmux");
@ -507,6 +507,7 @@ impl ObjectImpl for FlexHlsSink {
("muxer", &mux),
("sink", &app_sink),
("reset-muxer", &false),
("async-finalize", &false),
])
.unwrap();
@ -531,10 +532,17 @@ impl ObjectImpl for FlexHlsSink {
.unwrap();
let appsink = app_sink.downcast_ref::<gst_app::AppSink>().unwrap();
appsink.set_emit_signals(true);
appsink.connect_eos(|appsink| {
gst_info!(CAT, "Got EOS from giostreamsink_replacement_sink");
});
let this = self.clone();
let element_weak = obj.downgrade();
appsink.connect_new_sample(move |appsink| {
gst_info!(CAT, "Got new sample from giostreamsink_replacement_sink");
let sample = appsink.pull_sample().map_err(|_| gst::FlowError::Eos)?;
let buffer = sample.buffer().ok_or(gst::FlowError::Error)?;

View file

@ -29,7 +29,7 @@ fn init() {
fn test_basic_element_with_video_content() {
init();
const BUFFER_NB: i32 = 500;
const BUFFER_NB: i32 = 200;
let pipeline = gst::Pipeline::new(Some("video_pipeline"));
@ -48,10 +48,9 @@ fn test_basic_element_with_video_content() {
// 6 - 391
let app_queue = gst::ElementFactory::make("queue", Some("test_app_queue")).unwrap();
let app_sink = gst::ElementFactory::make("appsink", Some("test_appsink")).unwrap();
let app_sink = gst::ElementFactory::make("appsink", Some("test_sink")).unwrap();
app_sink.set_property("sync", &false).unwrap();
app_sink.set_property("async", &false).unwrap();
app_sink.set_property("emit-signals", &true).unwrap();
pipeline
.add_many(&[
@ -88,6 +87,7 @@ fn test_basic_element_with_video_content() {
let appsink = app_sink.dynamic_cast::<gst_app::AppSink>().unwrap();
appsink.set_emit_signals(true);
let (sender, receiver) = mpsc::channel();
appsink.connect_new_sample(move |appsink| {
let sample = appsink.pull_sample().map_err(|_| gst::FlowError::Eos)?;