Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Unified Diff: webrtc/pc/mediasession.cc

Issue 2505003003: Let MediaSession generate a FlexFEC SSRC when FlexFEC is active. (Closed)
Patch Set: Rebase. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/pc/mediasession_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/mediasession.cc
diff --git a/webrtc/pc/mediasession.cc b/webrtc/pc/mediasession.cc
index f91a7297204541d7fcf24b82b053273e9dc614f6..abeeeab09c8a0feab0a8c0c3f3d69a93ef901e41 100644
--- a/webrtc/pc/mediasession.cc
+++ b/webrtc/pc/mediasession.cc
@@ -446,6 +446,9 @@ static bool AddStreamParams(MediaType media_type,
return true;
}
+ const bool include_flexfec_stream =
+ ContainsFlexfecCodec(content_description->codecs());
+
MediaSessionOptions::Streams::const_iterator stream_it;
for (stream_it = streams.begin();
stream_it != streams.end(); ++stream_it) {
@@ -481,6 +484,21 @@ static bool AddStreamParams(MediaType media_type,
}
content_description->set_multistream(true);
}
+ // Generate extra ssrc for include_flexfec_stream case.
+ if (include_flexfec_stream) {
+ // TODO(brandtr): Update when we support multistream protection.
+ if (ssrcs.size() == 1) {
+ std::vector<uint32_t> flexfec_ssrcs;
+ GenerateSsrcs(*current_streams, 1, &flexfec_ssrcs);
+ stream_param.AddFecFrSsrc(ssrcs[0], flexfec_ssrcs[0]);
+ content_description->set_multistream(true);
+ } else if (!ssrcs.empty()) {
+ LOG(LS_WARNING)
+ << "Our FlexFEC implementation only supports protecting "
+ << "a single media streams. This session has multiple "
+ << "media streams however, so no FlexFEC SSRC will be generated.";
+ }
+ }
stream_param.cname = options.rtcp_cname;
stream_param.sync_label = stream_it->sync_label;
content_description->AddStream(stream_param);
@@ -672,9 +690,8 @@ static bool UpdateCryptoParamsForBundle(const ContentGroup& bundle_group,
template <class C>
static bool ContainsRtxCodec(const std::vector<C>& codecs) {
- typename std::vector<C>::const_iterator it;
- for (it = codecs.begin(); it != codecs.end(); ++it) {
- if (IsRtxCodec(*it)) {
+ for (const auto& codec : codecs) {
+ if (IsRtxCodec(codec)) {
return true;
}
}
@@ -686,6 +703,21 @@ static bool IsRtxCodec(const C& codec) {
return stricmp(codec.name.c_str(), kRtxCodecName) == 0;
}
+template <class C>
+static bool ContainsFlexfecCodec(const std::vector<C>& codecs) {
+ for (const auto& codec : codecs) {
+ if (IsFlexfecCodec(codec)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+template <class C>
+static bool IsFlexfecCodec(const C& codec) {
+ return stricmp(codec.name.c_str(), kFlexfecCodecName) == 0;
+}
+
static TransportOptions GetTransportOptions(const MediaSessionOptions& options,
const std::string& content_name) {
TransportOptions transport_options;
« no previous file with comments | « no previous file | webrtc/pc/mediasession_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698