Save and serialize the receive RIDs in MediaContentDescription
Bug: webrtc:10790 Change-Id: Ifd94a2c5fce3fcac4c65416a9e7831bf2946015c Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/144460 Commit-Queue: Florent Castelli <orphis@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Reviewed-by: Amit Hilbuch <amithi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28463}
This commit is contained in:
parent
e8ed83003d
commit
b60141b14f
@ -235,6 +235,12 @@ class MediaContentDescription {
|
||||
const SimulcastDescription& simulcast) {
|
||||
simulcast_ = simulcast;
|
||||
}
|
||||
virtual const std::vector<RidDescription>& receive_rids() const {
|
||||
return receive_rids_;
|
||||
}
|
||||
virtual void set_receive_rids(const std::vector<RidDescription>& rids) {
|
||||
receive_rids_ = rids;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool rtcp_mux_ = false;
|
||||
@ -255,6 +261,7 @@ class MediaContentDescription {
|
||||
ExtmapAllowMixed extmap_allow_mixed_enum_ = kNo;
|
||||
|
||||
SimulcastDescription simulcast_;
|
||||
std::vector<RidDescription> receive_rids_;
|
||||
};
|
||||
|
||||
// TODO(bugs.webrtc.org/8620): Remove this alias once downstream projects have
|
||||
|
||||
@ -1748,6 +1748,13 @@ void BuildRtpContentAttributes(const MediaContentDescription* media_desc,
|
||||
}
|
||||
}
|
||||
|
||||
for (const RidDescription& rid_description : media_desc->receive_rids()) {
|
||||
InitAttrLine(kAttributeRid, &os);
|
||||
os << kSdpDelimiterColon
|
||||
<< serializer.SerializeRidDescription(rid_description);
|
||||
AddLine(os.str(), message);
|
||||
}
|
||||
|
||||
// Simulcast (a=simulcast)
|
||||
// https://tools.ietf.org/html/draft-ietf-mmusic-sdp-simulcast-13#section-5.1
|
||||
if (media_desc->HasSimulcast()) {
|
||||
@ -3362,6 +3369,7 @@ bool ParseContent(const std::string& message,
|
||||
// Rids that do not appear in simulcast attribute will be removed.
|
||||
// If it is not specified, we assume that all rids are for send layers.
|
||||
std::vector<RidDescription> send_rids;
|
||||
std::vector<RidDescription> receive_rids;
|
||||
if (!simulcast.empty()) {
|
||||
// Verify that the rids in simulcast match rids in sdp.
|
||||
RemoveInvalidRidsFromSimulcast(rids, &simulcast);
|
||||
@ -3378,11 +3386,19 @@ bool ParseContent(const std::string& message,
|
||||
send_rids.push_back(iter->second);
|
||||
}
|
||||
|
||||
for (const auto& layer : simulcast.receive_layers().GetAllLayers()) {
|
||||
auto iter = rid_map.find(layer.rid);
|
||||
RTC_DCHECK(iter != rid_map.end());
|
||||
receive_rids.push_back(iter->second);
|
||||
}
|
||||
|
||||
media_desc->set_simulcast_description(simulcast);
|
||||
} else {
|
||||
send_rids = rids;
|
||||
}
|
||||
|
||||
media_desc->set_receive_rids(receive_rids);
|
||||
|
||||
// Create tracks from the |ssrc_infos|.
|
||||
// If the stream_id/track_id for all SSRCS are identical, one StreamParams
|
||||
// will be created in CreateTracksFromSsrcInfos, containing all the SSRCs from
|
||||
|
||||
@ -4567,12 +4567,20 @@ TEST_F(WebRtcSdpTest, SerializeSimulcast_ComplexSerialization) {
|
||||
send_rids.push_back(RidDescription("3", RidDirection::kSend));
|
||||
send_rids.push_back(RidDescription("4", RidDirection::kSend));
|
||||
send_stream.set_rids(send_rids);
|
||||
std::vector<RidDescription> receive_rids;
|
||||
receive_rids.push_back(RidDescription("5", RidDirection::kReceive));
|
||||
receive_rids.push_back(RidDescription("6", RidDirection::kReceive));
|
||||
receive_rids.push_back(RidDescription("7", RidDirection::kReceive));
|
||||
media->set_receive_rids(receive_rids);
|
||||
|
||||
SimulcastDescription& simulcast = media->simulcast_description();
|
||||
simulcast.send_layers().AddLayerWithAlternatives(
|
||||
{SimulcastLayer("2", false), SimulcastLayer("1", true)});
|
||||
simulcast.send_layers().AddLayerWithAlternatives(
|
||||
{SimulcastLayer("4", false), SimulcastLayer("3", false)});
|
||||
simulcast.receive_layers().AddLayer({SimulcastLayer("5", false)});
|
||||
simulcast.receive_layers().AddLayer({SimulcastLayer("6", false)});
|
||||
simulcast.receive_layers().AddLayer({SimulcastLayer("7", false)});
|
||||
|
||||
TestSerialize(jdesc_);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user