AppSink with pull_sample issue

Hi,

I’m trying to add following appsink into gstreamer pipeline and get the video out from the gst-meet. But pull_sample method not get frames. Could you please tell me what’s wrong in this code?

  let bin = gstreamer::Bin::new(None);
  let sink_video = gstreamer::ElementFactory::make("appsink", None)?;
  bin.add(&sink_video)?;
  conference.add_bin(&bin).await?;

  let appsink_video: gstreamer_app::AppSink = sink_video
    .dynamic_cast::<gstreamer_app::AppSink>()
    .expect("Sink element is expected to be an appsink!");

  if let Some(video_element) = bin.by_name("video") {
    println!("Add remote sink element");
    conference
    .set_remote_participant_video_sink_element(Some(video_element))
    .await;
  }
  
  thread::spawn(move || {
      loop {
        if let sample = appsink_video.pull_sample().map_err(|_| gstreamer::FlowError::Eos) {
          println!("appsink => {:?}",sample);
        }
      }
  });

There’s nothing wrong with that part of the code, your problem is going to be in the code around it. Can you provide the full code to reproduce this problem?

Also, instead of spawning a new thread you can go via the new-sample callback like in this example. It will be called whenever a new sample is available (in your case it would still never be called though until you solved the other problem).

Thanks @sdroege

Above code was created as wrapper of gst-meet. I think some linking not happen properly. Same issue for new-sample as well.

This doesn’t have the code to create the actual pipeline.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.