Code Monkey home page Code Monkey logo

Comments (4)

ystreet avatar ystreet commented on June 30, 2024

Each input pad is a stream so you can have multiple input/output pads for multiple audio/video streams. The example already uses two streams, one for video and the other for audio.

from gstwebrtc-demos.

themanonthemoon1 avatar themanonthemoon1 commented on June 30, 2024

Okay so in the browser there would be a media source object with two different video tracks in this case. How would one go about having each track played in a separate video element?

Eventually I want to have separate video elements, but I still can't even get it working in a single video element. Even though I have both video tracks in a single video element, I can't find a way to 'switch' between each track. Both tracks are by default 'enabled', and if I try disabling the first track then I still don't see the second track (I just see a black video).

Is there any example code somewhere for dealing with multiple video tracks? Can't seem to find any anywhere.

from gstwebrtc-demos.

alexlapa avatar alexlapa commented on June 30, 2024

@ystreet ,

The example already uses two streams, one for video and the other for audio.

Is there any way to send 2+ unrelated videos via single webrtcbin?

Each input pad is a stream so you can have multiple input/output pads for multiple audio/video streams.

I have tried naive calling add_video_source() twice (videotestsrc ! videoconvert ! vp8enc ! rtpvp8pay ! queue ! webrtcbin), which, i believe, is equivalent of peerConection.addTrack()/addStream(), changing add_video_source() to request additional pads:

    queue2
        .get_static_pad("src").unwrap()
        .link(&webrtcbin.get_request_pad("sink_%u").unwrap());

SDP seems to be correct:

v=0
o=- 4306522639330325592 0 IN IP4 0.0.0.0
s=-
t=0 0
a=ice-options:trickle
a=group:BUNDLE video0 video1
m=video 9 UDP/TLS/RTP/SAVPF 96
c=IN IP4 0.0.0.0
a=setup:actpass
a=ice-ufrag:KWyUvykHdcMZA2QAnHOB5Q7GB1I6ipLP
a=ice-pwd:VN1/BwXUNx0BSXfWuwSHs9gGqNy5mzyg
a=rtcp-mux
a=rtcp-rsize
a=sendrecv
a=rtpmap:96 VP8/90000
a=rtcp-fb:96 nack pli
a=framerate:30
a=ssrc:352868639 msid:user3161682870@host-6aeee50b webrtctransceiver0
a=ssrc:352868639 cname:user3161682870@host-6aeee50b
a=mid:video0
a=fingerprint:sha-256 2E:51:11:BA:F3:D5:D9:C8:79:2E:AC:F9:5A:F9:58:80:96:93:F3:F9:40:51:D3:B7:16:CD:EE:28:EC:79:8C:58
m=video 0 UDP/TLS/RTP/SAVPF 96
c=IN IP4 0.0.0.0
a=setup:actpass
a=ice-ufrag:KWyUvykHdcMZA2QAnHOB5Q7GB1I6ipLP
a=ice-pwd:VN1/BwXUNx0BSXfWuwSHs9gGqNy5mzyg
a=bundle-only
a=rtcp-mux
a=rtcp-rsize
a=sendrecv
a=rtpmap:96 VP8/90000
a=rtcp-fb:96 nack pli
a=framerate:30
a=ssrc:2097363443 msid:user3161682870@host-6aeee50b webrtctransceiver1
a=ssrc:2097363443 cname:user3161682870@host-6aeee50b
a=mid:video1
a=fingerprint:sha-256 2E:51:11:BA:F3:D5:D9:C8:79:2E:AC:F9:5A:F9:58:80:96:93:F3:F9:40:51:D3:B7:16:CD:EE:28:EC:79:8C:58

But onaddstream is fired only once (for video0). Related gst dot:
pipeline_2_pads

I have also tried adding multiple streams via add-transceiver, but couldn't find a way of connecting videosrc to transceivers sender. W3C spec states that tracks are supposed to be passed to peerConnection.addTransceiver(), which is not the case for webrtcbin's add-transceiver.

Trying to hack into webrtcbin by connecting video src's directly to rtpbin's send_rtp_sink_%u also failed, since no transceiver is being added(fails on this assert).

from gstwebrtc-demos.

ystreet avatar ystreet commented on June 30, 2024

This is a werbtcbin question and should be directed at the GStreamer mailing list or IRC channel.

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.