【问题标题】:WebRTC - how to differentiate between two MediaStreamTracks sent over the same connection?WebRTC - 如何区分通过同一连接发送的两个 MediaStreamTrack?
【发布时间】:2016-01-04 16:47:12
【问题描述】:

我想使用 WebRTC 从 Peer1 向 Peer2 发送两个视频流:我们以前置和后置摄像头为例。

从概念上讲,Peer2 如何知道哪个流来自哪个摄像头?

MediaStream documentation 提到所有MediaStreamMediaStreamTrack 字段都是只读的,所以我不能直接向它们附加任何信息。我无法通过信令通道发送像 {"stream1 id": "camera", "stream2 id": "screenshare"} 这样的字典,因为 Peer2 将为每个流和轨道生成自己的 id。

【问题讨论】:

    标签: javascript webrtc mediastreamsource


    【解决方案1】:

    https://datatracker.ietf.org/doc/html/draft-ietf-mmusic-msid-11

    In the RTP specification, media streams are identified using the SSRC
    field.  Streams are grouped into RTP Sessions, and also carry a
    CNAME.  Neither CNAME nor RTP session correspond to a MediaStream.
    Therefore, the association of an RTP media stream to MediaStreams
    need to be explicitly signaled.
    
    WebRTC defines a mapping (documented in [I-D.ietf-rtcweb-jsep]) where
    one SDP media description is used to describe each MediaStreamTrack,
    and the BUNDLE mechanism [I-D.ietf-mmusic-sdp-bundle-negotiation] is
    used to group MediaStreamTracks into RTP sessions.  Therefore, the
    need is to specify the ID of a MediaStreamTrack and its associated
    MediaStream for each media description, which can be accomplished
    with a media-level SDP attribute.
    
    This document defines a new SDP [RFC4566] media-level "msid"
    attribute.  This new attribute allows endpoints to associate RTP
    media streams that are described in different media descriptions with
    the same MediaStreams as defined in [W3C.WD-webrtc-20150210]., and to
    carry an identifier for each MediaStreamTrack in its "appdata" field.
    

    所以在浏览器支持自定义msid之前似乎无法做到这一点。

    【讨论】:

    • 已支持 MSID - 只需读取每个流的发送方上的 msid,然后像您提到的那样通过信令通道发送它们。
    • @xdumaine msid 在哪里可用?我不认为它是由 getUserMedia 创建的流的属性。
    猜你喜欢
    • 2020-03-07
    • 2017-08-10
    • 1970-01-01
    • 2020-12-25
    • 2020-09-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-05
    相关资源
    最近更新 更多