Code Monkey home page Code Monkey logo

Comments (10)

ystreet avatar ystreet commented on September 13, 2024 1

This is not an issue in these examples but in webrtcbin itself or with libnice. Issues for those components are tracked at https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad and https://gitlab.freedesktop.org/libnice/libnice respectively.

from gstwebrtc-demos.

ystreet avatar ystreet commented on September 13, 2024

You can attach a notify signal with a callback on all the *state properties instead of polling but yes, that is probably the best option. The callback will happen in a different thread than any your application owns so synchronisation would be required.

from gstwebrtc-demos.

ystreet avatar ystreet commented on September 13, 2024

E.g. example in C

static void
on_state_notify (gpointer webrtcbin, GParamSpec * pspec, gpointer user_data)
{
  /* do things */
}

// on setup
g_signal_connect (webrtcbin, "notify::connection-state", G_CALLBACK(on_state_notify), some_user_data);

from gstwebrtc-demos.

meldron avatar meldron commented on September 13, 2024

Thanks @ystreet for your info and the example!

My polling approach of the webrtc element properties did not result in changing states (connection-state and ice-connection-state always remained the initial state), so I guess i have to try the signal approach.

But may be my polling approach is wrong? I tried:

    thread::spawn(move || {
        let one_sec = time::Duration::from_millis(1000);

        loop {
            let mut state = None;
            {
                let mut lock = app_control_polling.0.lock().unwrap();
                let mut webrtc = lock.pipeline.get_by_name("sendrecv");
                
                webrtc = match webrtc {
                    Some(w) => {
                        match w.get_property("connection-state") {
                            Ok(r) => { 
                                state = Some(r.clone());
                                },
                            Err(_) => {  }
                        };
                        Some(w)
                    }
                    None => None,
                };

                lock.webrtc = webrtc;
            }

            match state {
                Some(s) => {
                    println!("{:?}", s);
                }
                None => {}
            }

            thread::sleep(one_sec);
        }
    });

from gstwebrtc-demos.

ystreet avatar ystreet commented on September 13, 2024

Hrm, connection-state isn't quite hooked up correctly yet. The DTLS implementation currently doesn't notify us about connection state changes.

I thought ice-connection-state was hooked up though.

That rust code looks fine

from gstwebrtc-demos.

meldron avatar meldron commented on September 13, 2024

Hey I just checked the ice-connection-state again and I found my mistake:

So at first it is GST_WEBRTC_ICE_CONNECTION_STATE_NEW and then it is changed to GST_WEBRTC_ICE_CONNECTION_STATE_CONNECTED. But if I disconnect with the browser the ice-connection-state remains GST_WEBRTC_ICE_CONNECTION_STATE_CONNECTED. Is this intended behavior? I thought it should be GST_WEBRTC_ICE_CONNECTION_STATE_DISCONNECTED after the peer disconnects.

Sorry for the misinformation!

from gstwebrtc-demos.

ystreet avatar ystreet commented on September 13, 2024

That would indicate that libnice doesn't tell us that the connection is not valid anymore and is a fun debugging job.

from gstwebrtc-demos.

givip avatar givip commented on September 13, 2024

Why did you close this topic? This problem remains in GStreamer 1.16.1

from gstwebrtc-demos.

Xaeroxe avatar Xaeroxe commented on September 13, 2024

I concur, this shouldn't be closed. This issue presents a pretty nasty problem for using GstWebRtc in production code.

from gstwebrtc-demos.

Xaeroxe avatar Xaeroxe commented on September 13, 2024

Here's the relevant issue: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/758

Thanks @ystreet !

from gstwebrtc-demos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.