Include mid -> trackID in SDP. (#1256)
* Include mid -> trackID in SDP. And send it in subscriber peer connection offer also. It can be useful to clients even in dual peer connection case. * generated protobuf --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -111,8 +111,6 @@ message SignalResponse {
|
||||
MediaSectionsRequirement media_sections_requirement = 25;
|
||||
// when audio subscription changes, used to enable simulcasting of audio codecs based on subscriptions
|
||||
SubscribedAudioCodecUpdate subscribed_audio_codec_update = 26;
|
||||
// sent when server answers publisher, includes the mid -> trackID mapping
|
||||
MappedSessionDescription mapped_answer = 27;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,11 +218,7 @@ message SessionDescription {
|
||||
string type = 1; // "answer" | "offer" | "pranswer" | "rollback"
|
||||
string sdp = 2;
|
||||
uint32 id = 3;
|
||||
}
|
||||
|
||||
message MappedSessionDescription {
|
||||
SessionDescription session_description = 1;
|
||||
map<string, string> mid_to_track_id = 2;
|
||||
map<string, string> mid_to_track_id = 4;
|
||||
}
|
||||
|
||||
message ParticipantUpdate {
|
||||
|
||||
@@ -21,19 +21,20 @@ import (
|
||||
"github.com/pion/webrtc/v4"
|
||||
)
|
||||
|
||||
func ToProtoSessionDescription(sd webrtc.SessionDescription, id uint32) *livekit.SessionDescription {
|
||||
func ToProtoSessionDescription(sd webrtc.SessionDescription, id uint32, midToTrackID map[string]string) *livekit.SessionDescription {
|
||||
if sd.SDP == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
return &livekit.SessionDescription{
|
||||
Type: sd.Type.String(),
|
||||
Sdp: sd.SDP,
|
||||
Id: id,
|
||||
Type: sd.Type.String(),
|
||||
Sdp: sd.SDP,
|
||||
Id: id,
|
||||
MidToTrackId: midToTrackID,
|
||||
}
|
||||
}
|
||||
|
||||
func FromProtoSessionDescription(sd *livekit.SessionDescription) (webrtc.SessionDescription, uint32) {
|
||||
func FromProtoSessionDescription(sd *livekit.SessionDescription) (webrtc.SessionDescription, uint32, map[string]string) {
|
||||
var sdType webrtc.SDPType
|
||||
switch sd.Type {
|
||||
case webrtc.SDPTypeOffer.String():
|
||||
@@ -48,22 +49,7 @@ func FromProtoSessionDescription(sd *livekit.SessionDescription) (webrtc.Session
|
||||
return webrtc.SessionDescription{
|
||||
Type: sdType,
|
||||
SDP: sd.Sdp,
|
||||
}, sd.Id
|
||||
}
|
||||
|
||||
func ToProtoMappedSessionDescription(sd webrtc.SessionDescription, id uint32, midToTrackID map[string]string) *livekit.MappedSessionDescription {
|
||||
if sd.SDP == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
return &livekit.MappedSessionDescription{
|
||||
SessionDescription: &livekit.SessionDescription{
|
||||
Type: sd.Type.String(),
|
||||
Sdp: sd.SDP,
|
||||
Id: id,
|
||||
},
|
||||
MidToTrackId: midToTrackID,
|
||||
}
|
||||
}, sd.Id, sd.MidToTrackId
|
||||
}
|
||||
|
||||
func ToProtoTrickle(candidateInit webrtc.ICECandidateInit, target livekit.SignalTarget, final bool) *livekit.TrickleRequest {
|
||||
|
||||
Reference in New Issue
Block a user